nexus-alpha 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.4
2
+ Name: nexus-alpha
3
+ Version: 1.0.0
4
+ Summary: Python SDK for NEXUS Alpha — institutional alternative data signals from SEC EDGAR filings
5
+ Author-email: NEXUS Alpha <ksaaus1@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://nexusalpha.io
8
+ Project-URL: Documentation, https://nexusalpha.io/docs
9
+ Project-URL: Repository, https://github.com/nexus-alpha/nexus-alpha-python
10
+ Project-URL: Bug Tracker, https://github.com/nexus-alpha/nexus-alpha-python/issues
11
+ Keywords: finance,alternative-data,sec,edgar,signals,quant,hedge-fund
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Office/Business :: Financial :: Investment
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: requests>=2.28
24
+ Provides-Extra: pandas
25
+ Requires-Dist: pandas>=1.5; extra == "pandas"
26
+ Provides-Extra: stream
27
+ Requires-Dist: websocket-client>=1.6; extra == "stream"
28
+ Provides-Extra: all
29
+ Requires-Dist: pandas>=1.5; extra == "all"
30
+ Requires-Dist: websocket-client>=1.6; extra == "all"
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest; extra == "dev"
33
+ Requires-Dist: responses; extra == "dev"
34
+ Requires-Dist: pandas>=1.5; extra == "dev"
35
+ Requires-Dist: websocket-client>=1.6; extra == "dev"
36
+
37
+ # NEXUS Alpha Python SDK
38
+
39
+ **Institutional alternative data signals from SEC EDGAR filings.**
40
+
41
+ [![PyPI](https://img.shields.io/pypi/v/nexus-alpha)](https://pypi.org/project/nexus-alpha/)
42
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue)](https://www.python.org/)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ pip install nexus-alpha # Core (REST API only)
49
+ pip install nexus-alpha[pandas] # + DataFrame support
50
+ pip install nexus-alpha[stream] # + WebSocket streaming
51
+ pip install nexus-alpha[all] # Everything
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ```python
57
+ from nexus_alpha import NexusAlpha
58
+
59
+ client = NexusAlpha("your-api-key")
60
+ # Or: NEXUS_ALPHA_API_KEY=your-key in env, then NexusAlpha()
61
+
62
+ # Top signals right now
63
+ for s in client.signals.top(limit=10):
64
+ print(f"{s.ticker:6s} | {s.signal:12s} | conf={s.confidence:.3f} | {s.freshness_status}")
65
+ print(f" {s.rationale[:100] if s.rationale else ''}")
66
+ ```
67
+
68
+ **Output:**
69
+ ```
70
+ NVDA | OVERWEIGHT | conf=0.712 | LIVE
71
+ GPU demand accelerating; data center revenue beat by 18%
72
+ MSFT | BUY | conf=0.683 | LIVE
73
+ Azure growth +29% YoY; AI copilot ARR surpassed $5B
74
+ ```
75
+
76
+ ## Signal Retrieval
77
+
78
+ ```python
79
+ # Search with filters
80
+ signals = client.signals.search(
81
+ ticker="NVDA",
82
+ signal="BUY",
83
+ min_confidence=0.65,
84
+ )
85
+
86
+ # Full history → pandas DataFrame (Tier 1+)
87
+ df = client.signals.history(
88
+ date_from="2024-01-01",
89
+ date_to="2024-12-31",
90
+ min_confidence=0.65,
91
+ limit=500,
92
+ ).to_dataframe()
93
+
94
+ print(df[["ticker", "signal_date", "signal", "confidence"]].head())
95
+ ```
96
+
97
+ ## Bulk CSV Export (Tier 2+)
98
+
99
+ ```python
100
+ # Downloads up to 10,000 signals as a DataFrame
101
+ df = client.data.export(date_from="2022-01-01")
102
+ df.to_csv("nexus_signals.csv", index=False)
103
+ print(f"Downloaded {len(df)} signals")
104
+ ```
105
+
106
+ ## Analytics & Backtest
107
+
108
+ ```python
109
+ perf = client.analytics.performance()
110
+
111
+ # Best hold period (highest Sharpe)
112
+ best = perf.best_hold_period
113
+ print(f"Best: {best.hold_days}d hold | Sharpe {best.sharpe_annualized} | WR {best.win_rate:.1%}")
114
+ # Best: 60d hold | Sharpe 1.2 | WR 70.6%
115
+
116
+ # Equity curve → DataFrame
117
+ eq_df = perf.equity_curve.to_dataframe()
118
+ print(eq_df[["quarter", "portfolio_return", "spy_return", "excess_return"]])
119
+
120
+ # Per-confidence-bucket breakdown
121
+ for band, stats in best.by_confidence_bucket.items():
122
+ print(f" {band}: {stats['win_rate']:.0%} WR, {stats['mean']:+.1f}% avg return")
123
+ ```
124
+
125
+ ## Real-Time Signal Stream (Tier 1+)
126
+
127
+ ### Blocking (foreground)
128
+ ```python
129
+ def handle_signal(signal: dict):
130
+ print(f"📡 NEW: {signal['ticker']} → {signal['signal']} (conf={signal['confidence']:.3f})")
131
+ print(f" {signal.get('rationale', '')}")
132
+
133
+ client.stream(handle_signal) # blocks; Ctrl-C to stop
134
+ ```
135
+
136
+ ### Non-blocking (background thread)
137
+ ```python
138
+ import time
139
+
140
+ thread = client.stream_async(handle_signal)
141
+
142
+ # Do other work while signals stream in
143
+ while True:
144
+ time.sleep(1)
145
+ ```
146
+
147
+ ## Account Usage
148
+
149
+ ```python
150
+ usage = client.account.usage()
151
+ print(f"Tier: {usage.tier_name}")
152
+ print(f"Requests today: {usage.requests_today}")
153
+ print(f"Remaining this hour: {usage.remaining_this_hour()}")
154
+ ```
155
+
156
+ ## Error Handling
157
+
158
+ ```python
159
+ from nexus_alpha import NexusAlpha, AuthError, RateLimitError, TierError
160
+
161
+ try:
162
+ signals = client.signals.history(limit=5000)
163
+ except TierError as e:
164
+ print(f"Need Tier {e.required_tier}+ — upgrade at nexusalpha.io")
165
+ except RateLimitError:
166
+ print("Rate limit hit — wait for next hour window")
167
+ except AuthError:
168
+ print("Invalid API key")
169
+ ```
170
+
171
+ ## Environment Variable
172
+
173
+ Set `NEXUS_ALPHA_API_KEY` to avoid passing the key in code:
174
+
175
+ ```bash
176
+ export NEXUS_ALPHA_API_KEY=your-api-key
177
+ ```
178
+
179
+ ```python
180
+ client = NexusAlpha() # reads from env automatically
181
+ ```
182
+
183
+ ## API Tiers
184
+
185
+ | Tier | Price | Rate limit | History | Bulk export | Stream |
186
+ |------|-------|-----------|---------|-------------|--------|
187
+ | Insight | $5k/mo | 100/hr | 500 rows | ❌ | ✅ |
188
+ | Intelligence | $15k/mo | 500/hr | 5,000 rows | ✅ (10k) | ✅ |
189
+ | Institutional | $50k/mo | 5,000/hr | 5,000 rows | ✅ (10k) | ✅ |
190
+
191
+ Subscribe at [nexusalpha.io](https://nexusalpha.io).
192
+
193
+ ## Backtest Summary
194
+
195
+ Walk-forward validated 2022–2025 (long-only signals):
196
+
197
+ | Hold Period | Avg Return | vs SPY | Sharpe | Win Rate |
198
+ |-------------|-----------|--------|--------|----------|
199
+ | 20 days | +0.61% | −0.11% | 0.35 | 58.8% |
200
+ | 40 days | +3.63% | +1.34% | 1.13 | 58.8% |
201
+ | **60 days** | **+4.79%** | **+2.45%** | **1.20** | **70.6%** |
202
+
203
+ **Key finding:** 0.65–0.70 confidence band → 90% win rate, +12.3% avg return at 60d.
204
+ IC is negative above 0.75 confidence → signals capped at 0.75.
205
+
206
+ ⚠️ **Important:** Per-signal excess return (+2.45% vs SPY) reflects information edge per trade.
207
+ Full equal-weight portfolio simulation: +9.5% vs SPY +26.2% (2022–2025). These signals
208
+ are designed as **information overlays** on existing positions, not standalone portfolios.
209
+ [Full methodology →](https://nexusalpha.io/methodology)
210
+
211
+ ---
212
+
213
+ *Signals are informational only and do not constitute investment advice.
214
+ NEXUS Alpha is not a registered investment adviser.*
@@ -0,0 +1,178 @@
1
+ # NEXUS Alpha Python SDK
2
+
3
+ **Institutional alternative data signals from SEC EDGAR filings.**
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/nexus-alpha)](https://pypi.org/project/nexus-alpha/)
6
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue)](https://www.python.org/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install nexus-alpha # Core (REST API only)
13
+ pip install nexus-alpha[pandas] # + DataFrame support
14
+ pip install nexus-alpha[stream] # + WebSocket streaming
15
+ pip install nexus-alpha[all] # Everything
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```python
21
+ from nexus_alpha import NexusAlpha
22
+
23
+ client = NexusAlpha("your-api-key")
24
+ # Or: NEXUS_ALPHA_API_KEY=your-key in env, then NexusAlpha()
25
+
26
+ # Top signals right now
27
+ for s in client.signals.top(limit=10):
28
+ print(f"{s.ticker:6s} | {s.signal:12s} | conf={s.confidence:.3f} | {s.freshness_status}")
29
+ print(f" {s.rationale[:100] if s.rationale else ''}")
30
+ ```
31
+
32
+ **Output:**
33
+ ```
34
+ NVDA | OVERWEIGHT | conf=0.712 | LIVE
35
+ GPU demand accelerating; data center revenue beat by 18%
36
+ MSFT | BUY | conf=0.683 | LIVE
37
+ Azure growth +29% YoY; AI copilot ARR surpassed $5B
38
+ ```
39
+
40
+ ## Signal Retrieval
41
+
42
+ ```python
43
+ # Search with filters
44
+ signals = client.signals.search(
45
+ ticker="NVDA",
46
+ signal="BUY",
47
+ min_confidence=0.65,
48
+ )
49
+
50
+ # Full history → pandas DataFrame (Tier 1+)
51
+ df = client.signals.history(
52
+ date_from="2024-01-01",
53
+ date_to="2024-12-31",
54
+ min_confidence=0.65,
55
+ limit=500,
56
+ ).to_dataframe()
57
+
58
+ print(df[["ticker", "signal_date", "signal", "confidence"]].head())
59
+ ```
60
+
61
+ ## Bulk CSV Export (Tier 2+)
62
+
63
+ ```python
64
+ # Downloads up to 10,000 signals as a DataFrame
65
+ df = client.data.export(date_from="2022-01-01")
66
+ df.to_csv("nexus_signals.csv", index=False)
67
+ print(f"Downloaded {len(df)} signals")
68
+ ```
69
+
70
+ ## Analytics & Backtest
71
+
72
+ ```python
73
+ perf = client.analytics.performance()
74
+
75
+ # Best hold period (highest Sharpe)
76
+ best = perf.best_hold_period
77
+ print(f"Best: {best.hold_days}d hold | Sharpe {best.sharpe_annualized} | WR {best.win_rate:.1%}")
78
+ # Best: 60d hold | Sharpe 1.2 | WR 70.6%
79
+
80
+ # Equity curve → DataFrame
81
+ eq_df = perf.equity_curve.to_dataframe()
82
+ print(eq_df[["quarter", "portfolio_return", "spy_return", "excess_return"]])
83
+
84
+ # Per-confidence-bucket breakdown
85
+ for band, stats in best.by_confidence_bucket.items():
86
+ print(f" {band}: {stats['win_rate']:.0%} WR, {stats['mean']:+.1f}% avg return")
87
+ ```
88
+
89
+ ## Real-Time Signal Stream (Tier 1+)
90
+
91
+ ### Blocking (foreground)
92
+ ```python
93
+ def handle_signal(signal: dict):
94
+ print(f"📡 NEW: {signal['ticker']} → {signal['signal']} (conf={signal['confidence']:.3f})")
95
+ print(f" {signal.get('rationale', '')}")
96
+
97
+ client.stream(handle_signal) # blocks; Ctrl-C to stop
98
+ ```
99
+
100
+ ### Non-blocking (background thread)
101
+ ```python
102
+ import time
103
+
104
+ thread = client.stream_async(handle_signal)
105
+
106
+ # Do other work while signals stream in
107
+ while True:
108
+ time.sleep(1)
109
+ ```
110
+
111
+ ## Account Usage
112
+
113
+ ```python
114
+ usage = client.account.usage()
115
+ print(f"Tier: {usage.tier_name}")
116
+ print(f"Requests today: {usage.requests_today}")
117
+ print(f"Remaining this hour: {usage.remaining_this_hour()}")
118
+ ```
119
+
120
+ ## Error Handling
121
+
122
+ ```python
123
+ from nexus_alpha import NexusAlpha, AuthError, RateLimitError, TierError
124
+
125
+ try:
126
+ signals = client.signals.history(limit=5000)
127
+ except TierError as e:
128
+ print(f"Need Tier {e.required_tier}+ — upgrade at nexusalpha.io")
129
+ except RateLimitError:
130
+ print("Rate limit hit — wait for next hour window")
131
+ except AuthError:
132
+ print("Invalid API key")
133
+ ```
134
+
135
+ ## Environment Variable
136
+
137
+ Set `NEXUS_ALPHA_API_KEY` to avoid passing the key in code:
138
+
139
+ ```bash
140
+ export NEXUS_ALPHA_API_KEY=your-api-key
141
+ ```
142
+
143
+ ```python
144
+ client = NexusAlpha() # reads from env automatically
145
+ ```
146
+
147
+ ## API Tiers
148
+
149
+ | Tier | Price | Rate limit | History | Bulk export | Stream |
150
+ |------|-------|-----------|---------|-------------|--------|
151
+ | Insight | $5k/mo | 100/hr | 500 rows | ❌ | ✅ |
152
+ | Intelligence | $15k/mo | 500/hr | 5,000 rows | ✅ (10k) | ✅ |
153
+ | Institutional | $50k/mo | 5,000/hr | 5,000 rows | ✅ (10k) | ✅ |
154
+
155
+ Subscribe at [nexusalpha.io](https://nexusalpha.io).
156
+
157
+ ## Backtest Summary
158
+
159
+ Walk-forward validated 2022–2025 (long-only signals):
160
+
161
+ | Hold Period | Avg Return | vs SPY | Sharpe | Win Rate |
162
+ |-------------|-----------|--------|--------|----------|
163
+ | 20 days | +0.61% | −0.11% | 0.35 | 58.8% |
164
+ | 40 days | +3.63% | +1.34% | 1.13 | 58.8% |
165
+ | **60 days** | **+4.79%** | **+2.45%** | **1.20** | **70.6%** |
166
+
167
+ **Key finding:** 0.65–0.70 confidence band → 90% win rate, +12.3% avg return at 60d.
168
+ IC is negative above 0.75 confidence → signals capped at 0.75.
169
+
170
+ ⚠️ **Important:** Per-signal excess return (+2.45% vs SPY) reflects information edge per trade.
171
+ Full equal-weight portfolio simulation: +9.5% vs SPY +26.2% (2022–2025). These signals
172
+ are designed as **information overlays** on existing positions, not standalone portfolios.
173
+ [Full methodology →](https://nexusalpha.io/methodology)
174
+
175
+ ---
176
+
177
+ *Signals are informational only and do not constitute investment advice.
178
+ NEXUS Alpha is not a registered investment adviser.*
@@ -0,0 +1,38 @@
1
+ """
2
+ NEXUS Alpha Python SDK
3
+ ======================
4
+ Institutional-grade alternative data signals from SEC EDGAR filings.
5
+
6
+ Quick start::
7
+
8
+ from nexus_alpha import NexusAlpha
9
+
10
+ client = NexusAlpha("your-api-key")
11
+
12
+ # Top signals right now
13
+ signals = client.signals.top(limit=10)
14
+ for s in signals:
15
+ print(s.ticker, s.signal, s.confidence, s.rationale)
16
+
17
+ # Full history as a DataFrame
18
+ df = client.signals.history(min_confidence=0.65).to_dataframe()
19
+
20
+ # Live WebSocket stream
21
+ def on_signal(signal):
22
+ print(f"NEW SIGNAL: {signal['ticker']} → {signal['signal']}")
23
+
24
+ client.stream(on_signal) # blocks; Ctrl-C to stop
25
+
26
+ Docs: https://nexusalpha.io/docs
27
+ """
28
+
29
+ from .client import NexusAlpha
30
+ from .exceptions import NexusAlphaError, AuthError, RateLimitError, APIError
31
+ from .models import Signal, SignalCollection, PerformanceReport
32
+
33
+ __version__ = "1.0.0"
34
+ __all__ = [
35
+ "NexusAlpha",
36
+ "NexusAlphaError", "AuthError", "RateLimitError", "APIError",
37
+ "Signal", "SignalCollection", "PerformanceReport",
38
+ ]