mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-08 03:37:24 -04:00
feat: automate merged.jsonl creation during price fetching
Streamline the data preparation workflow by having get_daily_price.py automatically invoke merge_jsonl.py after fetching all stock prices. Changes: - Modified get_daily_price.py to call merge_jsonl.py automatically - Updated entrypoint.sh to remove redundant merge_jsonl.py call - Updated main.sh to remove redundant merge_jsonl.py call - Fixed import order for linting compliance Benefits: - Single command now handles both fetching and merging - Ensures merged.jsonl is always created after price updates - Simplifies Docker container startup process - Prevents missing merged.jsonl errors in production
This commit is contained in:
@@ -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")
|
||||
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")
|
||||
Reference in New Issue
Block a user