-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_pipeline.py
More file actions
53 lines (41 loc) · 1.89 KB
/
Copy pathrun_pipeline.py
File metadata and controls
53 lines (41 loc) · 1.89 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
"""
Pipeline Runner
===============
Runs the full earnings sentiment analysis pipeline end-to-end:
Stage 1: Collect earnings transcripts (SEC EDGAR + synthetic fallback)
Stage 2: Score transcripts with LM lexicon and VADER
Stage 3: Run event study and statistical analysis
Run this file to execute the complete pipeline in one command.
Author: Atrija Haldar
"""
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
from collection.fetcher import collect_transcripts, TICKERS
from sentiment.analyser import score_transcripts, ticker_sentiment_summary
from analysis.price_reaction import (fetch_price_data, run_event_study,
analyse_sentiment_return_relationship,
build_summary_table, build_dashboard,
export_analysis_outputs, MARKET_PROXY)
def run():
print("=" * 60)
print(" Earnings Sentiment & Price Reaction Pipeline")
print("=" * 60)
print("\n[Stage 1/3] Collecting transcripts...")
transcripts = collect_transcripts(TICKERS, quarters=8)
print("\n[Stage 2/3] Scoring sentiment...")
scores = score_transcripts(transcripts)
summary = ticker_sentiment_summary(scores)
print("\n[Stage 3/3] Running event study & analysis...")
stock_returns, market_returns = fetch_price_data(TICKERS, MARKET_PROXY)
events = run_event_study(scores, stock_returns, market_returns)
stats_results = analyse_sentiment_return_relationship(events)
stat_summary = build_summary_table(events, stats_results)
build_dashboard(events, stats_results, stat_summary)
export_analysis_outputs(events, stats_results, stat_summary)
print("\n" + "=" * 60)
print(" Pipeline complete. Outputs saved to /output")
print(" Open output/analysis/sentiment_analysis_dashboard.html")
print("=" * 60)
if __name__ == "__main__":
run()