Always use the most recent share price
This commit is contained in:
parent
1023c283b1
commit
85cd363c06
@ -1,11 +1,10 @@
|
||||
import os
|
||||
|
||||
from apiflask import APIBlueprint
|
||||
|
||||
from app.models import SharePrice
|
||||
from app.auth import auth
|
||||
from app.db import database as db
|
||||
from app.helper_functions import make_response, get_email_or_abort_401
|
||||
from app.models import SharePrice
|
||||
from app.schema import PortfolioResponseSchema
|
||||
|
||||
portfolio_blueprint = APIBlueprint('portfolio', __name__, url_prefix='/api')
|
||||
@ -32,7 +31,7 @@ def get_portfolio():
|
||||
'current_price': 0
|
||||
}
|
||||
|
||||
query_share_price = db.session.query(SharePrice).filter_by(symbol=row[0]).first()
|
||||
query_share_price = db.session.query(SharePrice).filter_by(symbol=row[0]).order_by(SharePrice.date.desc()).first()
|
||||
if query_share_price is not None:
|
||||
data['current_price'] = query_share_price.as_dict()['price']
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user