update screener
This commit is contained in:
parent
32ce0e4565
commit
eadf75f84c
@ -72,13 +72,17 @@ def calculate_price_changes(symbol, item, con):
|
|||||||
if not data.empty:
|
if not data.empty:
|
||||||
past_price = data.iloc[0]['close']
|
past_price = data.iloc[0]['close']
|
||||||
current_price = item['price']
|
current_price = item['price']
|
||||||
item[name] = round(((current_price - past_price) / past_price) * 100, 2)
|
change = round(((current_price - past_price) / past_price) * 100, 2)
|
||||||
|
|
||||||
|
# Set item[name] to None if the change is -100
|
||||||
|
item[name] = None if change == -100 else change
|
||||||
|
|
||||||
except:
|
except:
|
||||||
# Handle exceptions by setting all fields to None
|
# Handle exceptions by setting all fields to None
|
||||||
for name in time_frames.keys():
|
for name in time_frames.keys():
|
||||||
item[name] = None
|
item[name] = None
|
||||||
|
|
||||||
|
|
||||||
def filter_data_quarterly(data):
|
def filter_data_quarterly(data):
|
||||||
# Generate a range of quarter-end dates from the start to the end date
|
# Generate a range of quarter-end dates from the start to the end date
|
||||||
start_date = data[0]['date']
|
start_date = data[0]['date']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user