Questions tagged [pset7]

For problem set 7 (CS50 Finance)

Filter by
Sorted by
Tagged with
0
votes
1answer
33 views

When I go to '/' page for Finance it only shows the cash I have available

I've been struggling for hours with trying to get the '/' page to display the current portfolio. It displays the remaining cash fine but nothing else. On phpliteadmin I can see that the table gets ...
0
votes
1answer
13 views

Pset 7 if statement issue

I have an issue with an if statement that does not match condition in my application.py. However, when I test the same statement in a test script with real values instead of variables, it works as ...
0
votes
0answers
27 views

CS50 IDE Python Bug

I am running into a bug with CS50 IDE. For some reason it is flagging any line of code after line 73 with bad syntax. I even used something simple like cashBalance = 8 and it is getting flagged. No ...
0
votes
1answer
139 views

Python SQL Syntax

I am having issues with the following: db.execute('INSERT INTO "users" ("id", "username", "hash") VALUES (NULL, username =: username, password =: password)', username = request.form.get("username"), ...
0
votes
2answers
46 views

On duplicate key update doesn't work correctly

I'm trying to figure out how to, On a duplicate key, add the amount of shares from the form, to the existing amount of shares. This is proving to be very tricky for me, I described a variable called ...
0
votes
1answer
62 views

Pset 7 - check50 error on buy

Almost finished Pset7 but I'm getting an error on Check50 that I don't understand. The log file says: :( buy handles valid purchase Log sending POST request to /login sending POST request to /buy ...
0
votes
1answer
241 views

PSET7 Finance- Quote and Buy not passing all checks

I've just come back to CS50 after the semester ended and have been trying to debug my program to no avail. The application appears to be working when I test it myself, passes all checks, but has ...
0
votes
0answers
73 views

Running PSET7 shows - ide50 didn't send any data

I just downloaded the distribution code for PSET7 and whenever I try to run the flask server with flask run, I keep getting this error in my browser ide50-rotimi-babalola.cs50.io didn’t send any data....
0
votes
1answer
58 views

Foreign key not working

I'm having problems with the use of foreign key: For pset7 - finance I have created a table portfolio, per the following command: CREATE TABLE finance.portfolio (transactionid INTEGER PRIMARY KEY ...
0
votes
2answers
279 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
1answer
87 views

Pset7 Finance Key Error in Buy

I have some trouble with the insertion into the database table in the buy section. I get a KeyError: "id". This is my code: result = db.execute("INSERT INTO transactions (id, symbol, price, shares, ...
0
votes
1answer
13 views

Update on duplicate portflolio help

I understand how to make portfolio now, but I highly suspect (and by that I mean I know) that my SQL statement is very off. I'm not exactly sure where the "" need to go, or how to add the new amount ...
0
votes
1answer
27 views

Pset7 making a portfolio for each user

I understand that I need a portfolio for each user, to contain their stocks and info, but how do I give each user a portfolio in the phpliteadmin? I know how to make one table, but I would need one "...
0
votes
1answer
42 views

Rollback support in SQL library (pset7)

I need to be able to "rollback" from a "transaction" to the DB in case a sequence of db queries don't all succeed. I could not find any documentation regarding this ability using the SQL library ...
0
votes
1answer
784 views

RuntimeError: unsupported value in cs50 finance

Users can buy stock successfully and see their portfolio (i.e. index), but after a user buys a stock I send them to a bought page with info just on the stock purchased, along with their remaining cash....
0
votes
1answer
117 views

pset7 index function won't iterate through stocks

I'm having some serious trouble getting the index function to iterate through each of the user's stocks to obtain the current market price. It correctly outputs a list of the user's stocks along with ...
0
votes
1answer
83 views

PSET7 - Finance buy - can't buy stock as user is logged out

I'm on the buy section of pset7's finance. I can submit a quote and get the correct information back. However, when I go to the buy page and try to purchase said stock, I get a 403 error code that I ...
0
votes
1answer
74 views

PSET7 sell selling the wrong number

On sell,if i try a number more than one, it sells the wrong number sometimes. I had 5, and sold 3, and now I have -28. I'm not sure why it does this, any help would be appreciated! if request.method =...
0
votes
1answer
20 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
35 views

Pset7 Sell stockprice not a bound parameter

I'm working on sell, and I ran into trouble in one of my db.execute statements. For whatever reason, in the previous line, it was perfectly fine using stock["price"] but in my second db.execute, it ...
0
votes
1answer
105 views

Pset7 :( sell handles valid sale

I try to UPDATE cash but I get an error I don’t understand why. Used this syntax in buy and it works fine but now File "/home/ubuntu/workspace/pset7/finance/application.py", line 243, in sell ...
0
votes
1answer
845 views

Pset7 index TypeError: quote_from_bytes() expected bytes

Pset7 index. I’m getting raise TypeError("quote_from_bytes() expected bytes") TypeError: quote_from_bytes() expected bytes. I tried several times to rewrite the code but I always come across this ...
0
votes
1answer
293 views

PSET7: Finance: check50 errors

I have implemented all pages except the default homepage. Every functionality is working fine. But, check50 shows some errors which never goes. I don't know which frown is turning upside down. Help ...
0
votes
1answer
81 views

Check50 problem with BUY action

I've got another problem with finance, pset7, CS50x. When I check50 my solution, I get an error (see first of image) claiming that a KeyError (on a field named "date_time") occurs when performing a ...
0
votes
2answers
82 views

Pset7 buy portfolio values are null

Pset7 buy. Debug is super clear but I still don’t understand why it doesn’t work: DEBUG:cs50:SELECT cash FROM users WHERE id = 1 DEBUG:cs50:INSERT INTO portfolio (stock, shares, balance) VALUES(NULL, ...
0
votes
1answer
77 views

History, Timezones and Daylight Saving Time

This is a question about pset 7, finance. As I'm just starting with that exercise, I'm not allowed to look at older posts about pset7 or finance at the moment. So if you think this is a duplicate ...
0
votes
1answer
124 views

Pset7 index RuntimeError object has no attribute name

I’m working on index part for two days now and I’m keep getting AttributeError: 'RuntimeError' object has no attribute 'name'. I changed things around but still the same error. Please, help me.
0
votes
1answer
110 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
2k views

PSET7 finance index

This is my application.py code @app.route("/") @login_required def index(): """Show portfolio of stocks""" stocks = db.execute("SELECT stock, number FROM portfolio WHERE id = :id", id = ...
0
votes
1answer
1k views

PSET7 Finance Buy

This is my code so far. It works. Now I am at the stage where you need to check and see if user already has that same stock. If the user has it, I have to add it, if not, just insert it to the table. ...
0
votes
1answer
57 views

Can't display name of stock PSET7

I finally made some forward progress by myself, and I have all the variable rows filled in, buy the stock and symbol show the same thing, when I would like one to say "AAPL" and the other to say "...
0
votes
1answer
37 views

I can't find where my variable names are mixed up

I'm stuck on pset7 and I have been for a while. I'm working on index and I'm pretty sure some of my variable names got mixed up, or I used the wrong names or something like that. I just can't figure ...
0
votes
1answer
597 views

Finance: Buy AttributeError: 'TypeError' object has no attribute 'name'

I have been trying to debug this for the past three hours but I can't find anything to save my life @app.route("/buy", methods=["GET", "POST"]) @login_required def buy(): """Buy shares of stock""" ...
0
votes
1answer
123 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
1answer
61 views

Pset7 finance, after I run buy function, portfolio table updated check 50 fails and I get 404 error

after I run check 50, everything shows green except these: I am trying to fix the error for buy. After I run flask and tried to make purchase, it shows 404 however my portfolio table get updated. So ...
0
votes
1answer
357 views

pset7 finance portfolio table won't update with buy function

Below is my code for buy. After I run flask and tried to make a purchase, the history table updated and cash deducted from users table. However, portfolio table is still empty. I am thinking the error ...
0
votes
1answer
655 views

pset7 finance register and index check50 error

I have implemented all functions. However when i run check50, it gets following errors The errors might come from my index code. I am not sure. Below are my code for register and index. Any ...
1
vote
1answer
623 views

pset7 finance check50 doesn't detect a valid sale despite portfolio updating correctly

I'm puzzled why check50 shows me this error despite my portfolio and SQLite database correctly reflecting the sold shares :( sell handles valid sale expected to find "56.00" in page, but it ...
0
votes
1answer
437 views

Problem retrieving index variables in finance

The table is not able to access different variables to display in the table. Here is the index function def index(): """Show portfolio of stocks""" """Selecting shares that have been purchased ...
0
votes
1answer
571 views

pset7 finance register function check 50

after I run check50 I get following comments: Below are my code for register: @app.route("/register", methods=["GET", "POST"]) def register(): """Register user""" session.clear() if request.method =...
0
votes
1answer
132 views

The predefined login function does not seem to be working in finance

All the registered ids are not able to log in. Even though the username and password are correct the website returns 400 error def login(): """Log user in""" # Forget any user_id session.clear() # ...
0
votes
1answer
29 views

TypeErrors and variable storage questions

I have been struggling with this problem set (pset7) for a couple weeks now and I have looked at countless resources while trying to get my code working. I am the point where I do not remember what is ...
0
votes
2answers
267 views

pset7: check50 error - sell page has all required elements

I'm having an argument with check50 on pset7 finance, when it comes to the SELL part. The web app works fine and I'm able to sell my stocks. When I run check50, though, it keeps telling me that the ...
0
votes
1answer
361 views

How can I debug an internal server error in pset 7 to get past login and register?

Whenever I try to login or register after running "flask run" on pset7, I receive an internal server error. When I run check50, it says that registering a user does not succeed and registration does ...
0
votes
1answer
23 views

jinja not displaying in single statement

I think I'm missing something extremely simple, but I'm trying to display the users name in my index.html, but i'm just getting blank HTML/Jinja: Welcome, <th>{{ user_data.username }} </th&...
0
votes
1answer
28 views

pset7 portfolio shares don't update

For pset7, I have 3 tables (users, transactions, portfolio), in portfolio I want to go in and update the number of shares a user holds in a specific stock if they already own it, or add a new row if ...
1
vote
1answer
95 views

Portfolio not updating in SQLite, Problem Set 7, Buy

I've been having an issue in PSET7 buy where I am prompted with an error whenever I attempt to update my portfolio. Cash is deducted from the users total, but there is no new table containing the ...
0
votes
1answer
216 views

pset7 index table not showing all values

When I try to use index, the table doesn't show all the values: [![erroneous table][1]][1] I'm not sure why it only shows some. My index code is as follows: def index(): """Show portfolio of ...
1
vote
1answer
295 views

cs50 pset7 buy syntax error

i cannot see any syntax error for several days, so if anything can help is highly appropriated here is my code : @app.route("/buy", methods=["GET", "POST"]) @login_required def buy(): """Buy ...
0
votes
1answer
97 views

pset7 finance insert new row

I'm trying to add a row into my finance db using the code below (a few versions), but keeping getting an error saying I'm passing in too many variables to the execute() function. Any direction here ...

1 2
3
4 5
15