Added comments
This commit is contained in:
@@ -24,6 +24,7 @@ __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file
|
||||
@share_price_blueprint.auth_required(auth)
|
||||
@share_price_blueprint.doc(summary="Returns all transaction symbols", description="Returns all transaction symbols for all users")
|
||||
def get_transaction_symbols():
|
||||
# Get all transaction symbols
|
||||
symbols = db.session.execute("SELECT symbol FROM `transactions` GROUP BY symbol;").all()
|
||||
|
||||
return_symbols = []
|
||||
@@ -39,6 +40,7 @@ def get_transaction_symbols():
|
||||
@share_price_blueprint.auth_required(auth)
|
||||
@share_price_blueprint.doc(summary="Returns all transaction symbols", description="Returns all transaction symbols for all users")
|
||||
def add_symbol_price(data):
|
||||
# Check if required data is available
|
||||
if not check_if_symbol_data_exists(data):
|
||||
abort(400, message="Symbol missing")
|
||||
|
||||
@@ -48,14 +50,11 @@ def add_symbol_price(data):
|
||||
if not check_if_time_data_exists(data):
|
||||
abort(400, message="Time missing")
|
||||
|
||||
symbol = data['symbol']
|
||||
price = data['price']
|
||||
time = data['time']
|
||||
|
||||
# Add share price
|
||||
share_price = SharePrice(
|
||||
symbol=symbol,
|
||||
price=price,
|
||||
date=datetime.datetime.strptime(time, '%Y-%m-%dT%H:%M:%S.%fZ'),
|
||||
symbol=data['symbol'],
|
||||
price=data['price'],
|
||||
date=datetime.datetime.strptime(data['time'], '%Y-%m-%dT%H:%M:%S.%fZ'),
|
||||
)
|
||||
|
||||
db.session.add(share_price)
|
||||
|
Reference in New Issue
Block a user