There are few lines of code you may consider editing and removing.It suffices to pass the entire rows of the user rather than selecting individual columns and there is no form for index route and you should pass the rows as key value pairs to the index.html as below :
def index():
"""Show portfolio of stocks"""
rows = db.execute("SELECT * FROM portfolio WHERE id = :id", id = session["user_id"])
return render_template("index.html", ROWS=rows)
Jinja :
{% block main %}
<table class="table table-striped">
<tr>
<th>Symbol</th>
<th>Name</th>
<th>Shares</th>
<th>Price</th>
<th>Total</th>
</tr>
{% for row in ROWS %}
<tr>
<td>{{row.symbol}}</td>
<td>{{row.name}}</td>
<td>{{row.shares}}</td>
<td>{{row.price}}</td>
<td>{{row.stock}}</td>
</tr>
{% endfor %}
</table>
<% endblock %}