Questions tagged [finance]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
363 views

Pset7 Finance: register.php gives me an error

Haven't started my implementation of register but I followed the spec up to creating register.php and copying the contents on the specs over. When I navigate to register.php I get this error: Is this ...
1
vote
1answer
240 views

Debugging in Problem Set 7: CS50 Finance

I am in the process of completing Problem Set 7 and I would like to know if there is a better way to debug than using print statements.
1
vote
1answer
259 views

Foreign key constraint error when linking ID to users table

In pset 7 I need to connect the ID from my table to the ID in users. But when I try to insert rows into my table I get the following error: SQL query: INSERT INTO `pset7`.`table` ( `id`, `...
1
vote
2answers
39 views

finance password strength validation fails to call function

I'm trying to call a function which I've defined but the code fails to call it. Does it matter where the function is defined? def register(): """Register user""" ...
1
vote
1answer
120 views

CS50 Finance: Index - list indices must be integers or slices, not str

I've been stuck on this for quite some time. I believe that I'm getting back data in the form of a dictionary but can't figure out how to get the information that I need. Error messages that have ...
1
vote
3answers
351 views

CS50 FINANCE- INDEX doesn't display price

I am trying to do the index part of this pset but the problem is since I want the price to be the current price, not price bought, I need to use the lookup function. But how do I display the price? ...
1
vote
2answers
224 views

PSET8: Finance - “check50 ran into an error while running checks!” Contact sysadmins@cs50.harvard.edu with the URL of this check!

While checking my code for PSET8 (Finance) with check50 I ran into the error "check50 ran into an error while running checks!" and with a note in the end stating "Contact sysadmins@cs50.harvard.edu ...
1
vote
1answer
2k views

CS50 Finance 2019 /check subproblem

In the 2019 edition of CS50 Finance there is a final subproblem where you have to use AJAX to ask the server if a username a new user is trying to register with is already taken, and then alert the ...
1
vote
1answer
100 views

Pset7 Finance Unable to Buy Multiple Shares

I am able to make 1 purchase which appears on my index page, however if I try buy any further stocks my cash goes down but the stocks are not shown and aren't inserted into my portfolio. Here is my ...
1
vote
1answer
1k views

CS50 Finance (pset7) - register function is not working for application.py in the latest CS50 question

In the latest CS50 - pset7 - CS50 Finance, it is advised to use generate_password_hash instead of pwd_context.encrypt. Also, in the template, there is a change where instead of url_for('register'), /...
1
vote
1answer
64 views

Pset7 Yahoo finance broken

I've been working on this problem for a long time. I've asked people about my code and they say everything looks fine with it, and I've been told the yahoo finance has been taken down. I can't do this ...
1
vote
1answer
89 views

My implementation of cs50 finance goes wrong with check50

My implementation of CS50 finance has security questions as personal touch on the register page. I believe this is why check50 is failing to detect successful user registration. What do I do in such a ...
1
vote
2answers
163 views

Pset7 => “NoneType” error on SELECT query (2017)

I’m really stuck on the index part of PSET7…. Flask keeps iterating over the following SELECT query: dab = db.execute("SELECT SUM(share) FROM portfolio WHERE symbol = :symbol AND user_id = :user_id",...
1
vote
1answer
885 views

AlphaVantage API Error “Please consider optimizing your API call frequency”

On C$50 Finance, when I refresh my web server too many times, AlphaVantage stops returning stock quotes. As a result, Flask returns "TypeError: 'NoneType' object is not subscriptable" when my code ...
1
vote
0answers
80 views

CS50 Pset7 Finance login TypeError: invalid method ''

I got some sort of error when i tried to login with an account that has been registered in my database. I have only done the register function. I can register and automatically login to the website ...
1
vote
1answer
373 views

Pset7 - CS50 Finance - Register - returns the same apology each time

When im testing my code by entering in blank entries in username or password, i expect the site to show me the apologies like "Must provide username" or "Must provide password", but it only shows the ...
1
vote
0answers
41 views

In pset7, cs50 Finance, there is a statement 'After configuring Flask, notice how this file disables caching of responses'. what is cache?

As stated in the question, I don't exactly know how the cache process work. So first question: how the cache process work? second question: why do we need to disable it in application.py? Thanks!
1
vote
1answer
3k views

flask.cli.NoAppException Error when trying to launch web server in pset 7

I'm trying to finish up pset7 and was trying to launch the web server to view the result but every time that I do I get the above error. I'm not really sure what I'm doing wrong. I ran flask in the /...
1
vote
1answer
99 views

pset7 (buy): trouble comparing value of transaction with cash

For some reason it is impossible for me to compare the cost of the buy-transaction with the user's cash balance in pset7. $value correctly comes up as a float, but $cash comes up as a string (even ...
1
vote
0answers
368 views

Pset7 Register.php error [duplicate]

I have filled in register_form and register.php (still have not done the //TODO portion). But when I go to my site, and click register, I get two errors: ( ! ) Warning: Unknown: failed to open ...
1
vote
1answer
247 views

Pset7, Finance, Extra feature, email. Mailer Error: SMTP Error: Could not connect to SMTP host

I would appreciate i anyone can help me here. I am almost done with pset7 but I am stuck on the extra feature. I chose to send a mail to the user in order to reset the password, but can't make the ...
1
vote
2answers
325 views

How many decimal places should the price in `quote.php` be formatted to?

In pset7 I am asked to format price to at least two decimal places but no more than four decimal places. Could someone please clarify? Should the exact number of decimal places be hardcoded, or ...
1
vote
1answer
362 views

CS50 Finance not showing up

I'm starting CS50 Finance and I've reached a small hitch. When I try to load the page "pset7"/localhost (After doing all the first steps listed in the spec), I don't get the CS50 Finance logo, but ...
0
votes
1answer
33 views

Finance: How to check if input is valid in “quote”?

I'm a little bit stuck with checking if user's input is correct. I don't know how to properly call "name" and other fields inside of lookup function to check them. I've tried different combinations of ...
0
votes
1answer
155 views

I can't seem to fix or find the error in finance. Can someone help? I realize in index.html the if condition needs to be fixed

The code was working before. index function @app.route("/") @login_required def index(): """Show portfolio of stocks""" # User reached route via POST (as by submitting a form via POST) #...
0
votes
1answer
65 views

SQL3 SUM troubles

Trying to create a portfolio by selecting all transactions of given stock symbol, summing the shares (negative for "sell" actions) and then displaying only positions where the user_id fits && ...
0
votes
2answers
324 views

Pset 7 - create table (with foreign key) from command-line

For pset7 - finance I am trying to create a new table to keep track of buy transactions. Since I want this table to have a foreign key (referencing the 'id' in the 'users' table) and I understood that ...
0
votes
2answers
451 views

Pset7 cs50 finance register method not displaying register.html

As the title says, I am working on the register method of cs50 finance. When I click on the register tab of the site, my login template seems to be popping up instead. I tried returning the register ...
0
votes
1answer
119 views

CSS Having No Affect in PSET7

I'm trying to left align text in a table in pset7 and none of the CSS code I write in styles.css is having any affect whatsoever. I even went as far as giving an "id" to an individual "td" element and ...
0
votes
1answer
160 views

What does VALUES(shares) refer to in the ON DUPLICATE KEY UPDATE clause?

This is the working snippet: query("INSERT INTO portfolio (id, symbol, shares) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)", $_SESSION['id'], $_POST["...
0
votes
1answer
448 views

Non-negative integer check

The spec says to check for a non-negative integer in buy.php by using preg_match("/^\d+$/", $_POST["shares"]). I've tried to understand this expression and have gotten most of it, but would like some ...
0
votes
1answer
290 views

What is wrong with this SQL command?

query("INSERT INTO stocks (id, symbol, shares) VALUES($_SESSION["id"], $_POST["symbol"], $_POST["number"]) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)"); I am getting this error Parse ...
0
votes
2answers
108 views

I encountered a `503 Service Unavailable` error while trying to access the staff's implementation of C$50 Finance. How can I resolve this?

I am trying to access http://finance.cs50.net/ to see the staff's implementation of the project but I'm getting a 503 Service Unavailable error. How can I resolve this?
0
votes
2answers
41 views

PSET9 Finance: Check50 says Buy doesn't handle fractional/invalid shares, but when I try these things my page does reject them. Why check50 no like?

I have been using some of the html from the cs50 finance example page: https://finance.cs50.net/buy (which is permitted by CS50) I think it may be at the root of the problem. Here's the relevant html ...
0
votes
1answer
157 views

Problem Set 8 / Web Track - Finance (RuntimeError: UNIQUE constraint failed)

y'all. My register function seems to work just fine when inputting new and different usernames. However, when I tested it for the 403 error (ie the one which checks if there is an already existing ...
0
votes
1answer
65 views

How do I get the symbol from sell.html in the drop down menu? I tried request.form.get(“symbol”) but get none

...I even tried request.form.get("symbol_list"). sell.html {% extends "layout.html" %} {% block title %} Sell {% endblock title %} {% block main %} <!--https://www.w3schools.com/html/...
0
votes
1answer
63 views

When I type in a random stock symbol for quote…it says internal server error. I did not understand what the error was.Please help

@app.route("/quote", methods=["GET", "POST"]) @login_required def quote(): """Get stock quote.""" if request.method == "POST": if not request.form.get("symbol"): return ...
0
votes
1answer
249 views

My CS50 Finance Lookup stopped working on 15 Jun 2019. Is there trouble with the API?

Per the title, the API appears to not work.
0
votes
1answer
96 views

CS50 PSET 8 Finance 2019 - why does the length of a row queried from the database equal 1?

Shouldn't the length of the row be equal to the length of the id, username, hash, and cash combined? Why is it written to give a message of invalid if the length does not equal 1? # Query ...
0
votes
1answer
714 views

pset8 - finance - check - ajax - preventDefault()

I have been working on the final check part for the pset8 exercise. In the registration part, when the username is taken, I could get an alert. However, I couldn't seem to stop it from logging in. I ...
0
votes
1answer
88 views

Pset7 - index() ValueError: could not convert string to float

I got ValueError: could not convert string to float at line 66 grand_total = total_holdings + float(current_cash[0]["cash"]) Can anyone show me my mistake? current_cash[0]["cash"] returns a string....
0
votes
1answer
163 views

pset7 quote check50 error

So I did pset7 when there was no check50 for this problem, and I decided to try again to check that my solution fits the specifications, almost all the new problems that I found resolved them by ...
0
votes
1answer
21 views

Best practice advice - store in DB or calculate on the fly (pset7)

I have a table which is basically a "flat" list of all the purchase transactions done in the system - no aggregation of any sort. I was wondering if there are any best practices or guidelines as to ...
0
votes
1answer
129 views

cs50 finance lookup functions returns None when it shouldn't. If I leave out the code in bold ( ** **), it doesn't return None

import os from cs50 import SQL from flask import Flask, flash, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug....
0
votes
1answer
111 views

What's the error?-PSET7/buy

@app.route("/buy", methods=["GET", "POST"]) @login_required def buy(): """Buy shares of stock""" if request.method == "POST": symbol_lookup=lookup(request.form.get("symbol")) ...
0
votes
1answer
128 views

PSET7: Sell invalid shares input - expected status code 400, but got 200

I ran my finance application via Check50 but got following error regarding sell function in application. The code of my sell() function is as follows: @app.route("/sell", methods=["GET", "POST"]) @...
0
votes
2answers
578 views

pset7 finance/index problem updating values in table

First time asking question, sorry if formatted badly. I am trying to set up to update my price and total column in my sql table. I seem to have it mostly correct, as values are being updated properly, ...
0
votes
2answers
434 views

How can I fix the “expected to find “112.00” in page, but it wasn't found” error?

I assumed that it means that the page that you are redirected to after the purchase (index or whatever) would have to show the purchase. When using it myself it does. It would be nice to figure out ...
0
votes
2answers
72 views

After trying to use the register function, nothing happens

I'm trying really hard to get register to work, it seems like when I try to use register, it doesn't do anything after I hit submit. I'm not sure why it does this or how to fix it but any help would ...
0
votes
1answer
65 views

Blank webpage for quote(). No data returns

All my completed functions in: quote, sell, history, etc. return nothing: only a blank webpage appears after sending forms. In here, I want to know the reason by taking my 'quote()' function an ...

1
2
3 4 5
9