Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
214 lines (189 loc) · 6.05 KB
/
Copy pathpyproject.toml
File metadata and controls
214 lines (189 loc) · 6.05 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
[project]
name = "apex-risk"
version = "0.1.16"
description = "Live Risk Management System for options and derivatives trading"
authors = [
{name = "Chenxi Li", email = "chenxi.li08@outlook.com"}
]
readme = "README.md"
requires-python = ">=3.13"
license = {text = "MIT"}
dependencies = [
# Core dependencies
"ib-async>=2.0.1", # Interactive Brokers API client (maintained fork of ib_insync)
"pyyaml>=6.0.1", # YAML configuration parsing
"pytz>=2024.1", # Timezone handling for market hours
"yfinance>=0.2.36", # Yahoo Finance for fallback market data and beta values
# Database
"asyncpg>=0.31.0", # PostgreSQL async driver for persistence
"tenacity>=8.2.0", # Retry logic for database operations
# Data science stack
"numpy>=2.3.0,<2.5", # Numerical computing library (capped for numba/vectorbt compat)
"pandas>=2.3.3", # Data manipulation and analysis
"pyarrow>=15.0.0", # Parquet file support for historical data storage
"scikit-learn>=1.8.0", # Machine learning library
"scipy>=1.11.0", # Scientific computing (for DSR calculations)
# Trading calendars and backtesting validation
"pandas-market-calendars>=4.3.0", # Trading calendar support (NYSE, etc.)
#"pypbo @ git+https://github.com/esvhd/pypbo.git", # Probability of Backtest Overfit (CSCV method)
"duckdb>=0.10.0", # Embedded analytics database for backtest storage
"pydantic>=2.5.0", # Data validation for backtest specs
# Trading and backtesting
"backtrader>=1.9.78.123", # Backtesting framework
"TA-Lib>=0.6.8", # Technical analysis indicators
"vectorbt>=0.28.2", # Vectorized backtesting and analysis
"plotly>=6.0,<7", # vectorbt registers a template using the mapbox traces plotly 7 removed
# Optimization
"optuna>=4.6.0", # Hyperparameter optimization framework
# Verification
"jsonschema>=4.20.0", # JSON Schema validation for contract verification
]
[project.optional-dependencies]
pead = [
"pytrends>=4.9.0", # Google Trends for PEAD attention filter
]
dev = [
"pytest>=7.4.0", # Testing framework
"pytest-cov>=4.1.0", # Coverage reporting
"pytest-asyncio>=0.21.0", # Async test support
"hypothesis>=6.100.0", # Property-based testing
"mypy>=1.7.0", # Static type checking
"types-requests>=2.31.0", # Type stubs for requests
"types-pytz>=2024.1", # Type stubs for pytz
"types-jsonschema>=4.20.0", # Type stubs for jsonschema (used by payload/validate.py)
"black>=23.12.0", # Code formatting
"isort>=5.13.0", # Import sorting
"flake8>=6.1.0", # Linting
"bandit>=1.7.0", # Security linting
"safety>=2.3.0", # Dependency vulnerability checking
"pre-commit>=3.6.0", # Git pre-commit hooks
# Code quality analysis
"vulture>=2.11", # Dead code detection
"radon>=6.0.1", # Complexity metrics (cyclomatic, maintainability)
]
observability = [
"opentelemetry-api>=1.20.0", # OpenTelemetry API
]
api = [
"fastapi>=0.115.0", # REST API framework
"uvicorn[standard]>=0.30.0", # ASGI server
"httpx>=0.27.0", # Async HTTP client (for tests)
"websockets>=16.0", # WS client for the xenon live tick feed (Phase 4)
"mcp>=2.2,<3",
]
# Full installation includes observability
full = [
"apex-risk[dev,observability]",
]
[project.scripts]
apex-risk = "main:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src", "config"]
# Explicitly include directories that might be filtered by .gitignore patterns
[tool.hatch.build.targets.wheel.force-include]
"src/domain/signals/data" = "src/domain/signals/data"
[tool.pytest.ini_options]
minversion = "7.0"
# Put the repo root on sys.path so shared test helpers (e.g. `tests.support.*`)
# import under bare `pytest` (CI), not just `python -m pytest` which adds cwd.
pythonpath = ["."]
addopts = [
"--cov=src",
"--cov-report=html",
"--cov-report=term-missing",
"--cov-fail-under=40", # Reduced from 85 to match current codebase state (TUI & adapters low coverage)
]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
[tool.black]
line-length = 100
target-version = ['py313']
include = '\.pyi?$'
extend-exclude = '''
/(
# Default excludes
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| legacy
)/
'''
[tool.isort]
profile = "black"
line_length = 100
skip = ["legacy"]
[tool.mypy]
python_version = "3.13"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
explicit_package_bases = true
exclude = [
"legacy/",
"tests/partial/test_mock_market_data.py",
"tests/partial/test_health_initialization.py",
"tests/partial/test_health_components_full.py",
]
[[tool.mypy.overrides]]
module = "ib_async.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
"pandas.*",
"asyncpg.*",
"yfinance.*",
"pandas_market_calendars.*",
"lightgbm.*",
"sklearn.*",
"scipy.*",
"pyarrow.*",
"vectorbt.*",
"optuna.*",
"talib.*",
"backtrader.*",
"generate_validation_universe",
"yaml.*",
"pytz.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
warn_return_any = false
disable_error_code = [
"arg-type",
"union-attr",
"var-annotated",
"index",
"misc",
"assignment",
"operator",
"method-assign",
"call-arg",
"attr-defined",
]
[tool.coverage.run]
source = ["src"]
omit = ["tests/*", "legacy/*", "src/verification/*"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if __name__ == .__main__.:",
"raise AssertionError",
"raise NotImplementedError",
"if TYPE_CHECKING:",
]