Questions tagged [buy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
39 views

CS50 pset8 finance buy

I have been struggling with the buy portion of the finance assignment for CS50. I have created my new tables and written down the logic concerning buying stocks. When I run flask and try to purchase ...
0
votes
0answers
37 views

Finance - Buy Implementation

I am getting the error message "500 Internal Server Error" when trying to buy shares. Can you please tell me what I am missing? The application.py code is: @app.route("/buy", ...
0
votes
1answer
29 views

Week 8 - Finance - Buy - Getting Error Message Missing Shares

I'm trying to get the Buy implementation to work but I keep on getting the error message "Missing Shares" when I log into the cs50 finance site and enter in the symbol and number of shares. ...
0
votes
1answer
120 views

PSET8 Finance Buy

For some reason, my buy function will not work. When I try to "buy" a share of stock, it always goes to internal server error. Here is my code: def buy(): if request.method == "POST&...
0
votes
1answer
140 views

The view function did not return a valid response. The function either returned None or ended without a return statement

I can't figure out what is wrong in my code My python code: def buy(): """Buy shares of stock""" if request.method == "GET": render_template("buy....
0
votes
0answers
29 views

Finance CS50 Buy Function - Sufficient Cash check not working

I've been stuck on buy function for PSET8 Finance for a long time now. I'm stumbling at the very beginning and can't seem to proceed further. The code error checks for incorrect or no inputs in the ...
0
votes
1answer
31 views

cs50 Finance Runtime error FOREIGN KEY constraint failed

I'm working on pset8 cs50 finance and I'm encountering a runtime error with buy. I've gotten both register and quote to work without issue so I've tried comparing my code to check for incorrect syntax,...
0
votes
1answer
38 views

C$50 FINANCE- BUY ERROR

I have a problem with my code on buy. I was wondering if anyone can help me identify the error. Whenever I go to the buy and enter the symbol and shares and click buy, it shows a 500 Internal Server ...
0
votes
1answer
113 views

Finance: Can not Update and Insert to SQL

In my buy function I cant INSERT or UPDATE data in SQL. RuntimeError: (sqlite3.OperationalError) near "ON": syntax error [SQL: INSERT INTO buy (share_name, share_symbol, share_price, shares, id) ...
0
votes
1answer
563 views

C$50 Finance Buy and Quote not working

When I test my code myself, it seems to work, but check50 is showing otherwise. Quote has a single problem, and buy has two problems, but I am not able to figure out where in the code is the error and ...
0
votes
1answer
39 views

CS50 Finance pset8 KeyError on /buy of application.py

I am having real trouble solving the issue I have with the /buy section of the task. I keep getting struck with an issue on the following section of code: db.execute("INSERT INTO transactions (...
0
votes
1answer
147 views

pset8 c$50 finance /buy - transactions RuntimeError: (sqlite3.OperationalError) near “''”: syntax error

I'm stuck on pset8 c$50 finance /buy: Form validation works properly but when i try to execute the INSERT INTO transactions table i get the following error: RuntimeError: (sqlite3.OperationalError) ...
0
votes
1answer
172 views

pset 8 finance: “:( buy handles valid purchase” fails

I`am bug fixing my application and can't find a solution for the ":( buy handles valid purchase" test. Here is Log: expected to find "112.00" in page, but it wasn't found Log sending POST ...
0
votes
1answer
43 views

I am having trouble correctly rendering bought.html Can someone help? More details below

I am getting an bug in my code. This is caused by From the ide DEBUG:cs50:SELECT id FROM stock_info where id = 108 length of rows {} 1 DEBUG:cs50:SELECT * FROM stock_info where id = 108 length of ...
0
votes
1answer
133 views

Getting an error in my code. Can someone help? My main question is can a select statement return an empty list without having an error?

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

Getting an error in buy function. Don't know how to fix it. Can someone help? More detail below

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

How do I get id for the buy function? I am pretty sure I am doing the correct code but still getting an error. Can someone help?

I am trying to get the code to work and am not worrying about sql injections yet. Code from Buy function current_cash = db.execute("SELECT cash FROM users WHERE id=current_id") I asked a similar ...
0
votes
1answer
33 views

pset8 finance portfolio on new stock/id

I'm trying to make it so when the user doesn't already own the stock, it adds it to the table. If they do already own it, it should update. The problem is when I try it, it buys 2x what it is supposed ...
0
votes
1answer
136 views

pset7/ finance.py error: :( buy handles valid purchase application raised an exception (see log for details)

I keep having the same error ":( buy handles valid purchase application raised an exception (see log for details)" for days now and I don't have any clue what I should modify in my code to pass the ...
0
votes
1answer
242 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
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
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
2answers
83 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
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
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
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
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
361 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 ...
1
vote
1answer
96 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 ...
1
vote
1answer
297 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
121 views

pset7 buy function stopped working… not inserting to portfolio

My buy function was working when I tested it, buy yesterday, when I was testing my implementation of "index" it stopped. The "INSERT INTO portfolio" line is no longer executing properly, and I cannot ...
1
vote
1answer
92 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 ...
0
votes
1answer
76 views

can someone please help me with why I am getting internal server error after I enter the symbol and no. and click on buy ?pset7

File "/home/ubuntu/workspace/pset7/finance/helpers.py", line 34, in decorated_function return f(*args, **kwargs) File "/home/ubuntu/workspace/pset7/finance/application.py", line 143, in buy ...
0
votes
1answer
83 views

Pset7 Finance Buy Runtime Error - Date

When I try to update the users portfolio I receive a runtime error from passing in 'when' as date('now'). Please can someone tell what I should be doing. Here is part of my buy function code. # ...
0
votes
1answer
270 views

Pset7 Finance Buy Function Internal Server Error

When I try to insert the portfolio values into the SQL database I receive an internal server error, please can someone tell me what I'm doing wrong. if request.method == "POST": # ensure symbol ...
0
votes
1answer
104 views

Buy causes internal server error

def buy(): """Buy shares of stock""" if request.method == "POST": shares = float(request.form.get("shares")) stock = lookup(request.form.get("symbol")) if not stock: ...
0
votes
1answer
107 views

cs50 pset7 finance always get an error in valid buy execution;;;;;

@app.route("/") @login_required def index(): """Show portfolio of stocks""" cash = db.execute('SELECT cash FROM users where id=:id',id=session["user_id"]) cash = cash[0]["cash"] stocks ...
0
votes
0answers
580 views

Pset7 buy and quote do not pass check50

I ran my code through check50 and it didn't clear the following 2 checks: :( quote handles valid ticker symbol expected to find "28.00" in page, but it wasn't found :( buy handles valid purchase ...
0
votes
1answer
182 views

Pset7 - buy updates shares in portfolio but not cash in users

My portfolio table tracks correctly the number of shares bought, however I encounter issues when I also try to update the cash that's left after this "purchase" in the users table. I have defined the ...
1
vote
1answer
269 views

issues with buy - functionality works but fails check50

Can't figure this out. My code passes functionality it buys stocks no problem but fails check50 with this error: :( buy handles valid purchase application raised an exception (see log for details) ...
1
vote
0answers
77 views

Python PSET7 /Buy

Can't figure this out. My code passes functionality it buys stocks no problem but fails check50 with this error :( buy handles valid purchase application raised an exception (see log for details) ...
0
votes
1answer
283 views

pset7 - Buy doesn't return correct value

I've ran into an issue while running Check50 on what I thought was my functioning solution for pset7, namely it doesn't find the correct value in the index after trying to run the buy function. This ...
0
votes
0answers
106 views

pset 7 buy always returns error 400 HELP!

Whenever I click buy on my buy page, a 400 error is given. New values are also not added to the transactions table. I have been stuck here for hours now. Please help! def buy(): """Buy shares of ...
0
votes
1answer
91 views

Buy and Sell Function not working correctly

Okay I have been working for very long on pset7 but my buy function seemed to be working correctly however when I try to buy the same stock a second time it doesn't get updated in the portfolio table ...
0
votes
0answers
196 views

pset7 no such column price

The following is my code for buy: def buy(): """Buy shares of stock.""" if request.method == "POST": try: symbol = lookup(request.form.get("symbol")) shares = int(request.form....
0
votes
1answer
151 views

pset7 buy typeError can't multiply

@app.route("/buy", methods=["GET", "POST"]) @login_required def buy(): """Buy shares of stock.""" session["user_id"] #check the way of request if request.method == "GET": return ...
0
votes
0answers
273 views

pset7 buy/sell shares via index

As last task to do for pset7, "personal touch", I'd like to empower the user to buy and sell shares via index without having to type the stock symbol. From here I found interesting to create a form ...
0
votes
1answer
317 views

pset7, buy function, date

in pset7, I'm using the date function to store the time of buying, I did some Google search but I keep having this error:undefined variable'date', could someone help me figure out what's wrong? @app....
0
votes
1answer
76 views

pset7 buy error not understood

I have been having problems with "buy" in pset7 for some time and am worried that pset7 will be my waterloo. So far, all I have done is check to see if there's enough cash and then calculated price to ...
0
votes
1answer
487 views

pset7 buy sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near “,”: syntax error [SQL: "SELECT * FROM portfolio WHERE user_id= 16, sy

pset7 is making me crazy. I have huge problems just from the beginning. Register is working, quote is working but Here is another problem in buy: Buy is writing data to history, reducing cash in ...