-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
348 lines (331 loc) · 10.6 KB
/
pyproject.toml
File metadata and controls
348 lines (331 loc) · 10.6 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
[build-system]
requires = ["setuptools>=61.0", "wheel>=0.46.2"]
build-backend = "setuptools.build_meta"
[project]
name = "quantstack"
version = "1.0.0"
description = "Quantitative Trading Research Platform"
readme = "README.md"
license = {text = "Apache-2.0"}
authors = [
{name = "Kshitij Bichave"}
]
requires-python = ">=3.11"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Financial and Insurance Industry",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business :: Financial :: Investment",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
keywords = ["quantitative", "trading", "backtesting", "finance", "machine-learning", "mcp"]
dependencies = [
"pandas>=2.0.0",
"numpy>=1.24.0,<2.0.0",
"scipy>=1.10.0",
"psycopg[binary,pool]>=3.1",
"requests>=2.31.0",
"aiohttp>=3.9.0",
"pydantic>=2.0.0",
"pydantic-settings>=2.0.0",
"python-dotenv>=1.0.0",
"loguru>=0.7.0",
"pytz>=2023.3",
"python-dateutil>=2.8.2",
"tqdm>=4.66.0",
"typing-extensions>=4.8.0",
# Core libs only — ML/RL/viz moved to optional extras for lean Docker images.
"pyyaml>=6.0.0",
"httpx>=0.27.0",
"certifi>=2023.7.0",
"joblib>=1.3.0",
# LLM providers
"boto3>=1.34.0",
"anthropic>=0.40.0",
"litellm>=1.82.2",
"langchain-groq>=0.2.0",
# Observability
"langfuse>=2.0.0,<3.0.0",
"prometheus-client>=0.19.0",
# Data providers
"alpaca-py>=0.20.0",
"fredapi>=0.5.0",
"edgartools>=3.0.0",
"websockets>=12.0",
# DB
"exchange-calendars>=4.5.0",
"langgraph-bigtool>=0.0.3",
"langgraph>=0.4.11",
"openevals>=0.1.0",
# TUI
"textual>=0.50",
]
[project.optional-dependencies]
dev = [
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.0.0",
"hypothesis>=6.90.0",
"agentevals>=0.0.9",
"textual-dev>=1.0",
"ruff>=0.1.0",
"mypy>=1.7.0",
"types-PyYAML>=6.0.0",
"mcp>=1.0.0",
]
ml = [
# ML/data-science stack — heavy deps (~1.5GB), not needed by graph services
"scikit-learn>=1.3.0",
"lightgbm>=4.0.0",
"xgboost>=2.0.0",
"catboost>=1.2.0",
"shap>=0.42.0",
"statsmodels>=0.14.0",
"arch>=7.0.0",
"hmmlearn>=0.3.0",
"optuna>=3.0",
"transformers>=4.30.0",
]
rl = [
# RL stack — torch is ~2-4GB (CUDA), not needed by graph services
"quantstack[ml]",
"torch>=2.6.0",
"gymnasium>=0.29.0",
"stable-baselines3>=2.2.0",
"shimmy>=1.3.0",
"finrl>=0.3.5",
]
data = [
# Data providers, options pricing, MCP tools
"polygon-api-client>=1.12.0",
"ib_insync>=0.9.86",
"financepy>=0.310",
"py_vollib>=1.0.1",
"py_vollib_vectorized>=0.1.0",
"quantsbin>=1.0.3",
"pysabr>=0.4.0",
"mem0ai>=0.1.0",
"ffn>=1.0.0",
"TA-Lib>=0.4.28",
# Core analysis deps — needed by MCP tool modules (strategy, backtesting, etc.)
"statsmodels>=0.14.0",
"arch>=7.0.0",
"optuna>=3.0",
]
viz = [
# Visualization — not needed in Docker
"plotly>=5.18.0",
"matplotlib>=3.8.0",
"seaborn>=0.13.0",
"Pillow>=10.0.0",
]
api = [
# API server + scheduler
"fastapi>=0.109.0",
"uvicorn[standard]>=0.27.0",
"apscheduler>=3.10.0",
]
scraping = [
# Browser automation for EWF chart fetcher and other member-portal scrapers
"playwright>=1.40.0",
]
langgraph = [
"langgraph>=0.4.0",
"langchain>=0.3.0",
"langchain-core>=0.3.0",
"fastapi>=0.109.0",
"uvicorn[standard]>=0.27.0",
"langchain-anthropic>=0.3.22", # minimum version with defer_loading pass-through support
"langchain-aws>=0.2.0",
"langgraph-checkpoint-postgres>=3.0.0",
"psycopg[binary]>=3.1.0",
"psycopg-pool>=3.1.0",
"pgvector>=0.3.0",
"watchdog>=4.0.0",
"nest-asyncio>=1.6.0",
"ollama>=0.4.0",
]
all = [
"quantstack[dev,langgraph,ml,rl,data,viz,api,scraping]",
]
[project.scripts]
quantstack-supervisor = "quantstack.coordination.supervisor_main:main"
quantstack-api = "quantstack.api.server:app"
quantstack-monitor = "quantstack.flows.intraday_monitor_flow:main"
quantstack-bootstrap = "quantstack.flows.bootstrap:main"
quantstack-log-decision = "quantstack.hooks.log_decision:main"
quantstack-validate-brief = "quantstack.hooks.validate_brief_quality:main"
[project.urls]
Homepage = "https://github.com/kbichave/QuantStack"
Documentation = "https://github.com/kbichave/QuantStack"
Repository = "https://github.com/kbichave/QuantStack.git"
Issues = "https://github.com/kbichave/QuantStack/issues"
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
quantstack = ["config/*.yaml", "crews/*/config/*.yaml", "graphs/*/config/*.yaml"]
[tool.ruff]
target-version = "py311"
line-length = 100
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by formatter)
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
[tool.mypy]
python_version = "3.11"
warn_unused_configs = true
ignore_missing_imports = true
# warn_return_any disabled: third-party libraries (litellm)
# return Any in many places; enabling it generates ~125 false positives.
[[tool.mypy.overrides]]
# eTrade/IBKR broker modules use forward refs that mypy can't resolve without
# the live broker dependencies installed in the type-check environment.
module = [
"quantstack.execution.etrade_broker",
"quantstack.tools.etrade.*",
]
ignore_errors = true
[dependency-groups]
dev = [
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.0.0",
"hypothesis>=6.90.0",
"agentevals>=0.0.9",
"ruff>=0.1.0",
"mypy>=1.7.0",
"types-PyYAML>=6.0.0",
"mcp>=1.0.0",
"pre-commit>=3.5.0",
"coverage>=7.0.0",
]
[tool.uv]
# UV configuration for dependency management
# Use native TLS for better SSL compatibility (Zscaler, corporate proxies)
native-tls = true
# Security-driven lower bounds on transitive deps (Trivy CVE fixes)
constraint-dependencies = [
"jaraco.context>=6.1.0", # CVE-2026-23949
]
[tool.coverage.run]
# Omit modules that are untestable in a unit-test environment:
# - External API/broker adapters (require live credentials)
# - WebSocket streaming (require live connections)
# - GPU-dependent RL (require training data + GPU)
# - Full-system flows (require running MCP + broker stack)
# - External services (Discord, Mem0, knowledge stores)
# - Visualization (require display)
# - Entry-point scripts
# - MCP server (requires MCP client runtime to exercise)
# - LLM agents (require running LLM provider)
omit = [
# External market-data adapters and fetchers (require live API keys)
"src/quantstack/data/adapters/*",
"src/quantstack/data/streaming/*",
"src/quantstack/data/polygon.py",
"src/quantstack/data/earnings.py",
"src/quantstack/data/economic_fetcher.py",
"src/quantstack/data/options_storage.py",
"src/quantstack/data/fetcher.py",
"src/quantstack/data/storage.py",
"src/quantstack/data/_schema.py",
"src/quantstack/data/_ohlcv.py",
"src/quantstack/data/_options_news.py",
"src/quantstack/data/sec_edgar.py",
"src/quantstack/data/validator.py",
"src/quantstack/data/registry.py",
# FinRL modules (require GPU / SB3 training runtime)
"src/quantstack/finrl/trainer.py",
"src/quantstack/finrl/environments.py",
"src/quantstack/finrl/data_adapter.py",
"src/quantstack/finrl/stock_selector.py",
# Specialised regime models (HMM/TFT)
"src/quantstack/core/hierarchy/regime/hmm_model.py",
"src/quantstack/core/hierarchy/regime/tft_regime.py",
# Options-specific modules
"src/quantstack/core/backtesting/options_engine.py",
"src/quantstack/core/features/iv_calculator.py",
"src/quantstack/core/features/options_features.py",
"src/quantstack/core/risk/options_risk.py",
"src/quantstack/core/strategy/options_ml.py",
"src/quantstack/core/strategy/options_rules.py",
# Commodity-specific modules
"src/quantstack/core/features/commodity/*",
"src/quantstack/core/features/commodity_factory.py",
# Academic paper replications
"src/quantstack/core/research/paper_replications/*",
# Visualization
"src/quantstack/core/visualization/options_plots.py",
"src/quantstack/core/visualization/trade_animation.py",
"src/quantstack/core/visualization/plots.py",
"src/quantstack/core/analysis/reporting.py",
# Microstructure low-level
"src/quantstack/core/microstructure/events.py",
"src/quantstack/core/microstructure/filters.py",
"src/quantstack/core/microstructure/volume_profile.py",
# Entry points
"src/quantstack/core/main.py",
# Live-execution modules
"src/quantstack/core/execution/paper_trading.py",
"src/quantstack/execution/etrade_broker.py",
"src/quantstack/execution/microstructure_pipeline.py",
# eTrade tools
"src/quantstack/tools/etrade/client.py",
"src/quantstack/tools/etrade/auth.py",
# FastAPI server
"src/quantstack/api/server.py",
# Full-system flows
"src/quantstack/flows/*",
# External services
"src/quantstack/tools/discord/*",
"src/quantstack/tools/alphavantage_tools.py",
"src/quantstack/memory/mem0_client.py",
"src/quantstack/knowledge/store.py",
"src/quantstack/knowledge/_schema.py",
"src/quantstack/knowledge/_trades.py",
"src/quantstack/knowledge/_waves_regime.py",
"src/quantstack/knowledge/_messages.py",
"src/quantstack/knowledge/_performance.py",
"src/quantstack/knowledge/_learning.py",
"src/quantstack/knowledge/policy_store.py",
# Live WebSocket adapters
"src/quantstack/data/adapters/*",
# LLM agents
"src/quantstack/agents/microstructure_signal_agent.py",
"src/quantstack/agents/portfolio_optimizer_agent.py",
"src/quantstack/agents/regime_detector.py",
# Runtime state/orchestration
"src/quantstack/mtf_context.py",
"src/quantstack/holding_period.py",
"src/quantstack/crews/regime_config.py",
"src/quantstack/learning/calibration.py",
]
[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests", "src/quantstack/core/tests"]
asyncio_mode = "auto"
markers = [
"integration: requires real DB and external mocks",
"regression: locks specific behavioral contracts",
]
filterwarnings = [
"ignore::DeprecationWarning",
]