Update swing trading dashboard and High Volume Days strategy following changes to OHLC data volume column

This commit is contained in:
moshferatu 2024-11-22 11:46:47 -08:00
parent 8d9121d02a
commit 6247bb48aa
2 changed files with 3 additions and 4 deletions

View File

@ -22,7 +22,7 @@ def get_daily_data(symbol: str, start_date: datetime = datetime.today() - timede
high_price = intraday_data['High'].max() high_price = intraday_data['High'].max()
low_price = intraday_data['Low'].min() low_price = intraday_data['Low'].min()
close_price = intraday_data['Close'].iloc[-1] close_price = intraday_data['Close'].iloc[-1]
total_volume = intraday_data['Total Volume'].iloc[-1] volume = intraday_data['Volume'].sum()
todays_data = { todays_data = {
'Date': today, 'Date': today,
@ -30,8 +30,7 @@ def get_daily_data(symbol: str, start_date: datetime = datetime.today() - timede
'High': high_price, 'High': high_price,
'Low': low_price, 'Low': low_price,
'Close': close_price, 'Close': close_price,
'Total Volume': total_volume, 'Volume': volume
'Period Volume': 0
} }
daily_data = concat([daily_data, DataFrame([todays_data])], ignore_index = True) daily_data = concat([daily_data, DataFrame([todays_data])], ignore_index = True)

View File

@ -9,7 +9,7 @@ def signals(data: DataFrame) -> Series:
data['200_MA'] = data['Close'].rolling(window = 200).mean() data['200_MA'] = data['Close'].rolling(window = 200).mean()
above_200_ma = data['Close'] > data['200_MA'] above_200_ma = data['Close'] > data['200_MA']
highest_volume = data['Total Volume'] == data['Total Volume'].rolling(window = 5).max() highest_volume = data['Volume'] == data['Volume'].rolling(window = 5).max()
close_lower_than_open = data['Close'] < data['Open'] close_lower_than_open = data['Close'] < data['Open']
signal_condition = above_200_ma & highest_volume & close_lower_than_open signal_condition = above_200_ma & highest_volume & close_lower_than_open