1
vote
Accepted
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?
The error message says
RuntimeError: no such column: symbol [SQL: "select shares from stock_info WHERE symbol = 'AAPL' and id = 19"]
That does not mean your stock_info table is empty, it is missing ...
1
vote
Accepted
Finance Pset, SQL DB, db.execute troubles
The flask error log (in the console where flask run) should give you all the info you need to troubleshoot and debug.
Problem with the first (hover to see spoiler):
Problem with the second:
1
vote
Accepted
Rollback support in SQL library (pset7)
It sounds like you're thinking about implementing some of the more complex database concepts that are used in financial programming. Kudos to you! But, these concepts are a little beyond the scope of ...
1
vote
pset7 I can't use usd() and have a problem with datetime method
1)for time stamp you could use this..
from time import gmtime,strftime
....
time=strftime("%Y-%m-%d %H:%M:%S", gmtime())
...
output will look like this.. 2017-12-28 09:40:20
now you ...
1
vote
Accepted
pset8 search function not working like supposed to
Here's a way to see what the problem is using command line python:
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more ...
1
vote
Accepted
Passing SQL values into arrays
This categories = [amounts[0]["category"]] looks suspicious, since categories is always updated with the first element of amounts. Ditto total_amount.
1
vote
Accepted
`RuntimeError: no such column: user_id` pset7 [buy]
I solved it using this link Challenge inserting into database from buy() as a resource.
The problem was with the placement of my quotes
I changed
db.execute("INSERT INTO transactions (user_id, ...
1
vote
Accepted
Pset7 Can't manage to get the result of a SUM() using db.execute
That syntax should work. I suspect that total_stock[0]["SUM(nb_of_shares)"] is 'None' because it did not find any rows that matched username AND stock_symbol. When you use the aggregate function (SUM),...
Only top scored, non community-wiki answers of a minimum length are eligible