#querying the cash at hand for the user in sessionĬash = db.execute("SELECT cash FROM users WHERE id = ?", session) ![]() Stocks = db.execute("SELECT symbol, SUM(number_of_shares) as sumshares, AVG(price) as avgprice FROM 'transaction' WHERE user_id = :i_d GROUP BY symbol", i_d=session) #querying for the symbol and the corresponding sum of the same stock and the average price paid for the stock My funcation in app.py that calles lookup1 in this case is as follows: index(): Not sure why there are 2 GET responses? Is there a faster way to do this?Īlso not sure why for example stock A is called 3 times? DEBUG: "GET /quote/A HTTP/1.1" 200 None INFO: "GET /static/favicon.ico HTTP/1.0" 200. INFO: "GET /static/styles.css HTTP/1.0" 200. INFO: "POST /login HTTP/1.0" 302 -ĭEBUG: Starting new HTTPS connection (1): :443ĭEBUG: "GET /quote/A/holders HTTP/1.1" 200 NoneĭEBUG: "GET /quote/A/financials HTTP/1.1" 200 NoneĭEBUG: "GET /quote/AAPL HTTP/1.1" 200 NoneĭEBUG: "GET /quote/AAPL/holders HTTP/1.1" 200 NoneĭEBUG: "GET /quote/AAPL/financials HTTP/1.1" 200 NoneĭEBUG: "GET /quote/FB HTTP/1.1" 200 NoneĭEBUG: "GET /quote/FB/holders HTTP/1.1" 200 NoneĭEBUG: "GET /quote/FB/financials HTTP/1.1" 200 NoneĭEBUG: "GET /quote/GOOG HTTP/1.1" 200 NoneĭEBUG: "GET /quote/GOOG/holders HTTP/1.1" 200 NoneĭEBUG: "GET /quote/GOOG/financials HTTP/1.1" 200 NoneĭEBUG: "GET /quote/MSFT HTTP/1.1" 200 NoneĭEBUG: "GET /quote/MSFT/holders HTTP/1.1" 200 NoneĭEBUG: "GET /quote/MSFT/financials HTTP/1.1" 200 None ![]() The function works fine, but the issue is that it is very slow, and it seems it queries more info which might be slowing it down, my output in the console shows: INFO: "GET /login HTTP/1.0" 200. I'm building a website using Flask and I have a function that will access the to retrieve "shortName", "currentPrice" and "symbol"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |