New answers tagged

1

Add value = "{{ stocks }}" to the symbol input element in buy.html. There are some problems in the GET branch of the buy route: To retrieve values from a GET request, use request.args instead of request.form (i.e. request.args.get('symbol_buy')) Beware discrepancy symb sym If request.args.get('symbol_buy') is None, you may want to send the empty ...


1

The problem is the double double-quotes. The first phrase is: "SELECT SUM(size) AS " the second phrase is: " FROM history WHERE id = ? AND symbol = ?" and Total is in no-man's land. It is not necessary to enclose table/column aliases with delimiters, unless they contain special characters. If that were the case, Total would need a ...


1

You are iterating over a variable called holdings: {% for stock_holdings in holdings %} But you are not passing any such variable to the template: return render_template("index.html", stock_holdings = stock_holdings, cash = usd(cash), total_funds = usd(total_funds)) So there is nothing there to iterate, so nothing is displayed.


1

Use usd function defined in helpers.py symbol = request.form.get('symbol') shares = lookup(symbol) shares['price'] = usd(shares['price']) this will solve the problem


Top 50 recent answers are included