|
@@ -64,7 +64,9 @@ def get_data(stock_id, this_timestamp, this_db):
|
|
|
:return:
|
|
:return:
|
|
|
"""
|
|
"""
|
|
|
cursor = this_db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)
|
|
cursor = this_db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)
|
|
|
- query = """SELECT current_price, available_shares, forecast FROM stocks WHERE stock_id = %s AND timestamp = %s"""
|
|
|
|
|
|
|
+ query = """SELECT current_price, available_shares, forecast, total_shares
|
|
|
|
|
+ FROM stocks
|
|
|
|
|
+ WHERE stock_id = %s AND timestamp = %s"""
|
|
|
cursor.execute(query, (stock_id, this_timestamp))
|
|
cursor.execute(query, (stock_id, this_timestamp))
|
|
|
this_data = cursor.fetchone()
|
|
this_data = cursor.fetchone()
|
|
|
cursor.close()
|
|
cursor.close()
|
|
@@ -96,9 +98,9 @@ def is_npc_drop(data_previous, data_latest):
|
|
|
:return:
|
|
:return:
|
|
|
"""
|
|
"""
|
|
|
npc_drop = False
|
|
npc_drop = False
|
|
|
- if data_latest.available_shares - data_previous.available_shares > 0:
|
|
|
|
|
- print('data_latest.available_shares {}'.format(data_latest.available_shares))
|
|
|
|
|
- print('data_previous.available_shares {}'.format(data_previous.available_shares))
|
|
|
|
|
|
|
+ if data_latest.total_shares - data_previous.totals_shares > 0:
|
|
|
|
|
+ print('data_latest.total_shares {}'.format(data_latest.total_shares))
|
|
|
|
|
+ print('data_previous.total_shares {}'.format(data_previous.totals_shares))
|
|
|
npc_drop = True
|
|
npc_drop = True
|
|
|
return npc_drop
|
|
return npc_drop
|
|
|
|
|
|