-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
63 lines (48 loc) · 1.77 KB
/
Copy pathrun.py
File metadata and controls
63 lines (48 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""Entry point for the LangGraph GlobeNewswire pipeline.
All configuration is in CONFIG.py — edit that file to change run mode,
date range, filters, LLM provider, or signal strategy.
Usage:
python run.py
"""
import sys
import os
# Ensure project root is on sys.path so all imports resolve correctly
_here = os.path.dirname(os.path.abspath(__file__))
if _here not in sys.path:
sys.path.insert(0, _here)
from datetime import date
import CONFIG
from graph import build_pipeline_graph
def main():
# Resolve effective date range from run mode
if CONFIG.RUN_MODE == "live":
today = date.today().strftime("%Y-%m-%d")
date_range = (today, today)
else:
date_range = CONFIG.DATE_RANGE
initial_state = {
"run_mode": CONFIG.RUN_MODE,
"date_range": date_range,
"exchanges": CONFIG.EXCHANGES,
"languages": CONFIG.LANGUAGES,
"subjects": CONFIG.SUBJECTS,
"industries": CONFIG.INDUSTRIES,
"tags": CONFIG.TAGS,
"continents": CONFIG.CONTINENTS,
"countries": CONFIG.COUNTRIES,
"states": CONFIG.STATES,
"page_size": CONFIG.PAGE_SIZE,
}
print(f"Pipeline starting | mode={CONFIG.RUN_MODE} | strategy={CONFIG.SIGNAL_STRATEGY}")
if CONFIG.RUN_MODE == "backtest":
print(f"Date range: {date_range[0]} → {date_range[1]}")
graph = build_pipeline_graph()
final_state = graph.invoke(initial_state)
summary = final_state.get("run_summary", {})
print(f"\nDone. total={summary.get('total', 0)} | "
f"processed={summary.get('processed', 0)} | "
f"skipped={summary.get('skipped', 0)}")
print(f"Output: {summary.get('export_path', 'n/a')}")
return final_state
if __name__ == "__main__":
main()