From 6247bb48aafcbf76b57c521ea797d647098f6229 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Fri, 22 Nov 2024 11:46:47 -0800 Subject: [PATCH] Update swing trading dashboard and High Volume Days strategy following changes to OHLC data volume column --- daily_data.py | 5 ++--- strategies/high_volume_days.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/daily_data.py b/daily_data.py index 8ae4559..6db405c 100644 --- a/daily_data.py +++ b/daily_data.py @@ -22,7 +22,7 @@ def get_daily_data(symbol: str, start_date: datetime = datetime.today() - timede high_price = intraday_data['High'].max() low_price = intraday_data['Low'].min() close_price = intraday_data['Close'].iloc[-1] - total_volume = intraday_data['Total Volume'].iloc[-1] + volume = intraday_data['Volume'].sum() todays_data = { 'Date': today, @@ -30,8 +30,7 @@ def get_daily_data(symbol: str, start_date: datetime = datetime.today() - timede 'High': high_price, 'Low': low_price, 'Close': close_price, - 'Total Volume': total_volume, - 'Period Volume': 0 + 'Volume': volume } daily_data = concat([daily_data, DataFrame([todays_data])], ignore_index = True) diff --git a/strategies/high_volume_days.py b/strategies/high_volume_days.py index 3d822c8..46d338b 100644 --- a/strategies/high_volume_days.py +++ b/strategies/high_volume_days.py @@ -9,7 +9,7 @@ def signals(data: DataFrame) -> Series: data['200_MA'] = data['Close'].rolling(window = 200).mean() 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'] signal_condition = above_200_ma & highest_volume & close_lower_than_open