title: Error with application.py index in pset7
body: <p>I get this error when I buy a stock or when I try to go to my index.html:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 2000, in __call__
      return self.wsgi_app(environ, start_response)
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1991, in wsgi_app
      response = self.make_response(self.handle_exception(e))
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1567, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
      raise value
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1988, in wsgi_app
      response = self.full_dispatch_request()
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1641, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1544, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
      raise value
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1639, in full_dispatch_request
      rv = self.dispatch_request()
    File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1625, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/home/ubuntu/workspace/pset7/finance/helpers.py", line 31, in decorated_function
      return f(*args, **kwargs)
    File "/home/ubuntu/workspace/pset7/finance/application.py", line 55, in index
      price= stock["price"], total= usd(stocks_total), symbol = symbol, id = session["user_id"])
    File "/usr/local/lib/python3.4/dist-packages/cs50/sql.py", line 112, in execute
      statement = statement.bindparams(sqlalchemy.bindparam(key, value=value, type_=UserDefinedType()))
    File "&lt;string&gt;", line 2, in bindparams
  
    File "/usr/local/lib/python3.4/dist-packages/sqlalchemy/sql/base.py", line 45, in _generative
      fn(self, *args[1:], **kw)
    File "/usr/local/lib/python3.4/dist-packages/sqlalchemy/sql/elements.py", line 1470, in bindparams
      "bound parameter named %r" % bind.key)
  sqlalchemy.exc.ArgumentError: This text() construct doesn't define a bound parameter named 'price'
  </code></pre>
  
  <p>I think the problem is within  the index function but I really cant find it.  Any help please.... </p>
  
  <pre><code>def index():
  
  row_symbols = db.execute("SELECT symbol, shares, price FROM portfolio WHERE 
                           user_id = :id", id = session["user_id"])
  total_cash = 0
  
  if not row_symbols:
      stocks = []
      cash = db.execute("SELECT cash FROM users WHERE id=:id", 
                        id=session["user_id"])
      return render_template("index.html", stocks = stocks, cash = usd(cash[0]
                             ["cash"]), total= usd(cash[0]["cash"]))
  else:
  
      for row_symbol in row_symbols:
          symbol = row_symbol["symbol"]
          shares = row_symbol["shares"]
          stock = lookup(symbol)
          stocks_total = stock["price"] * shares
          total_cash = total_cash + stocks_total
  
          db.execute("UPDATE portfolio SET price =: price, total =:total WHERE 
                      symbol =: symbol AND user_id =: id",\
                      price= stock["price"], total= usd(stocks_total), symbol 
                      = symbol, id = session["user_id"])
  
      update_cash = db.execute("SELECT cash FROM users WHERE id=:id", 
                               id=session["user_id"] )
  
      total_cash = total_cash + update_cash
  
      update_portfolio = db.execute("SELECT * FROM portfolio WHERE user_id =: 
                                     id", id= session["user_id"])
  
      return render_template("index.html", stocks = update_portfolio, cash = 
                              usd(update_cash[0]["cash"]), total = 
                              usd(total_cash) )
  </code></pre>