I am struggling with writing data to database when user buys stocks. After code execution no new insertions appears in database and no error messages appears. Also how to get current user name to link transactions with user actions?
stock = lookup(request.form.get("symbol"))
name = str(stock['name'])
symbol = str(stock['symbol'])
price = float(stock['price'])
quantity = int(request.form.get("shares"))
user = 1
db.execute("INSERT INTO transactions (symbol, quantity, transacted) VALUES(:symbol, :quantity, :transacted)", symbol = symbol, quantity = quantity, transacted = (float(price) * int(quantity)))