From 7a04e8d05fdb7fe90319a14ca699a4521c73be3b Mon Sep 17 00:00:00 2001 From: "Bobby Abellana (aider)" Date: Thu, 6 Feb 2025 22:39:16 -0800 Subject: [PATCH] refactor: Update sunny scanner to use root 'reports' directory --- src/screener/t_sunnyband.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/screener/t_sunnyband.py b/src/screener/t_sunnyband.py index cdbc5ff..087df92 100644 --- a/src/screener/t_sunnyband.py +++ b/src/screener/t_sunnyband.py @@ -1,3 +1,4 @@ +import os from datetime import datetime, timedelta import pandas as pd from db.db_connection import create_client @@ -397,7 +398,10 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf if bullish_signals: print(f"\n🟢 Found {len(bullish_signals)} Bullish Signals:") df_bullish = pd.DataFrame(bullish_signals) - bullish_file = f'src/reports/sunny_bullish_{output_date}.csv' + # Create reports directory if it doesn't exist + os.makedirs('reports', exist_ok=True) + + bullish_file = f'reports/sunny_bullish_{output_date}.csv' df_bullish.to_csv(bullish_file, index=False) print(f"Saved to {bullish_file}") @@ -421,7 +425,10 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf if bearish_signals: print(f"\n🔴 Found {len(bearish_signals)} Bearish Signals:") df_bearish = pd.DataFrame(bearish_signals) - bearish_file = f'src/reports/sunny_bearish_{output_date}.csv' + # Create reports directory if it doesn't exist + os.makedirs('reports', exist_ok=True) + + bearish_file = f'reports/sunny_bearish_{output_date}.csv' df_bearish.to_csv(bearish_file, index=False) print(f"Saved to {bearish_file}")