diff --git a/data/get_daily_price.py b/data/get_daily_price.py index 909a921..58a37ea 100644 --- a/data/get_daily_price.py +++ b/data/get_daily_price.py @@ -1,8 +1,12 @@ -import requests -import os -from dotenv import load_dotenv -load_dotenv() import json +import os +import subprocess +import sys + +import requests +from dotenv import load_dotenv + +load_dotenv() all_nasdaq_100_symbols = [ @@ -42,4 +46,15 @@ if __name__ == "__main__": for symbol in all_nasdaq_100_symbols: get_daily_price(symbol) - get_daily_price("QQQ") \ No newline at end of file + get_daily_price("QQQ") + + # Automatically run merge after fetching + print("\nšŸ“¦ Merging price data...") + try: + script_dir = os.path.dirname(os.path.abspath(__file__)) + merge_script = os.path.join(script_dir, "merge_jsonl.py") + subprocess.run([sys.executable, merge_script], check=True) + print("āœ… Price data merged successfully") + except Exception as e: + print(f"āš ļø Failed to merge data: {e}") + print(" Please run 'python merge_jsonl.py' manually") \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index c1a81b3..7015932 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,10 +44,10 @@ if [ -f "/app/data/merged.jsonl" ] && [ -s "/app/data/merged.jsonl" ]; then echo " To refresh data, delete /app/data/merged.jsonl and restart" else echo "šŸ“Š Fetching and merging price data..." - # Run scripts from /app/scripts but output to /app/data + # Run script from /app/scripts but output to /app/data + # Note: get_daily_price.py now automatically calls merge_jsonl.py after fetching cd /app/data python /app/scripts/get_daily_price.py - python /app/scripts/merge_jsonl.py cd /app fi diff --git a/main.sh b/main.sh index 6b2dc0b..6a85f2b 100644 --- a/main.sh +++ b/main.sh @@ -10,8 +10,8 @@ echo "šŸš€ Launching AI Trader Environment..." echo "šŸ“Š Now getting and merging price data..." cd ./data +# Note: get_daily_price.py now automatically calls merge_jsonl.py after fetching python get_daily_price.py -python merge_jsonl.py cd ../ echo "šŸ”§ Now starting MCP services..."