466e63dc19
Wrapper async tipizzati sui sei servizi MCP HTTP che Cerbero Bite consuma in autonomia. 277 test pass, copertura clients 93%, mypy strict pulito, ruff clean. Base layer: - clients/_base.py: HttpToolClient con httpx + tenacity (retry esponenziale 3x, timeout 8s, mapping HTTP→eccezioni tipizzate). - clients/_exceptions.py: McpAuthError, McpServerError, McpToolError, McpDataAnomalyError, McpNotFoundError, McpTimeoutError. - config/mcp_endpoints.py: risoluzione URL via Docker DNS (mcp-deribit:9011, ...) con override per servizio via env var; caricamento bearer token da secrets/core.token o CERBERO_BITE_CORE_TOKEN_FILE. Wrapper: - clients/macro.py: next_high_severity_within() per filtro entry §2.5. - clients/sentiment.py: funding_cross_median_annualized() con annualizzazione per period nativo per exchange (Binance/Bybit/OKX 1095, Hyperliquid 8760). - clients/hyperliquid.py: funding_rate_annualized() per filtro §2.6. - clients/portfolio.py: total_equity_eur(), asset_pct_of_portfolio() per sizing engine + filtro §2.7. - clients/telegram.py: notify-only (no callback queue, no conferme — Bite auto-execute). - clients/deribit.py: environment_info, index_price_eth, latest_dvol, options_chain, get_tickers, orderbook_depth_top3, get_account_summary, get_positions, place_combo_order (combo atomico), cancel_order. CLI: - cerbero-bite ping: health-check parallelo di tutti gli MCP con tabella rich (OK/FAIL/SKIPPED). Docker: - Dockerfile multi-stage Python 3.13 + uv, user non-root. - docker-compose.yml con rete external "cerbero-suite", secret core_token montato a /run/secrets/core_token, env per ogni MCP. - secrets/README.md documenta il setup del token. Documentazione di intervento: - docs/12-mcp-deribit-changes.md: spec delle modifiche apportate al server mcp-deribit (place_combo_order + override testnet via DERIBIT_TESTNET). Dipendenze: - aggiunto pytest-httpx per i test HTTP. - rimosso mcp>=1.0 (non usiamo l'SDK MCP, parliamo via HTTP REST). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
144 lines
3.2 KiB
TOML
144 lines
3.2 KiB
TOML
[project]
|
||
name = "cerbero-bite"
|
||
version = "0.0.1"
|
||
description = "Rule-based deterministic engine for Cerberus Bite credit spread strategy on ETH options"
|
||
readme = "README.md"
|
||
requires-python = ">=3.12"
|
||
authors = [{ name = "Adriano Dal Pastro", email = "adrianodalpastro@tielogic.com" }]
|
||
license = { text = "Proprietary" }
|
||
|
||
dependencies = [
|
||
"pydantic>=2.9",
|
||
"pydantic-settings>=2.5",
|
||
"click>=8.1",
|
||
"rich>=13.9",
|
||
"structlog>=24.4",
|
||
"apscheduler>=3.10",
|
||
"sqlalchemy>=2.0",
|
||
"aiosqlite>=0.20",
|
||
"pyyaml>=6.0",
|
||
"httpx>=0.27",
|
||
"tenacity>=9.0",
|
||
"python-dateutil>=2.9",
|
||
]
|
||
|
||
[project.optional-dependencies]
|
||
gui = [
|
||
"streamlit>=1.40",
|
||
"plotly>=5.24",
|
||
"pandas>=2.2",
|
||
"numpy>=2.0",
|
||
]
|
||
backtest = [
|
||
"scipy>=1.14",
|
||
"matplotlib>=3.9",
|
||
"pandas>=2.2",
|
||
"numpy>=2.0",
|
||
]
|
||
|
||
[project.scripts]
|
||
cerbero-bite = "cerbero_bite.cli:main"
|
||
|
||
[dependency-groups]
|
||
dev = [
|
||
"pytest>=8.3",
|
||
"pytest-asyncio>=0.24",
|
||
"pytest-cov>=5.0",
|
||
"pytest-httpx>=0.33",
|
||
"hypothesis>=6.115",
|
||
"mypy>=1.13",
|
||
"ruff>=0.7",
|
||
"pre-commit>=4.0",
|
||
"types-PyYAML>=6.0",
|
||
"types-python-dateutil>=2.9",
|
||
]
|
||
|
||
[build-system]
|
||
requires = ["hatchling"]
|
||
build-backend = "hatchling.build"
|
||
|
||
[tool.hatch.build.targets.wheel]
|
||
packages = ["src/cerbero_bite"]
|
||
|
||
[tool.ruff]
|
||
line-length = 100
|
||
target-version = "py312"
|
||
src = ["src", "tests"]
|
||
|
||
[tool.ruff.lint]
|
||
select = [
|
||
"E", # pycodestyle errors
|
||
"W", # pycodestyle warnings
|
||
"F", # pyflakes
|
||
"I", # isort
|
||
"B", # flake8-bugbear
|
||
"C4", # flake8-comprehensions
|
||
"UP", # pyupgrade
|
||
"N", # pep8-naming
|
||
"SIM", # flake8-simplify
|
||
"RET", # flake8-return
|
||
"ARG", # flake8-unused-arguments
|
||
"PTH", # flake8-use-pathlib
|
||
"ERA", # eradicate
|
||
"PL", # pylint
|
||
"RUF", # ruff-specific
|
||
]
|
||
ignore = [
|
||
"PLR0913", # too many arguments (we accept config-heavy functions)
|
||
"PLR2004", # magic value (we have many domain constants in tests)
|
||
"PLR0911", # too many return statements (rule engines have many early returns)
|
||
"RUF001", # ambiguous unicode in strings (we use math symbols × ≤ ≥)
|
||
"RUF002", # ambiguous unicode in docstrings
|
||
"RUF003", # ambiguous unicode in comments
|
||
]
|
||
|
||
[tool.ruff.lint.per-file-ignores]
|
||
"tests/**" = ["PLR2004", "ARG", "S101", "ERA001", "B017"]
|
||
|
||
[tool.ruff.format]
|
||
quote-style = "double"
|
||
indent-style = "space"
|
||
|
||
[tool.mypy]
|
||
python_version = "3.12"
|
||
strict = true
|
||
warn_unreachable = true
|
||
warn_redundant_casts = true
|
||
warn_unused_ignores = true
|
||
disallow_any_generics = true
|
||
disallow_untyped_defs = true
|
||
no_implicit_reexport = true
|
||
files = ["src/cerbero_bite"]
|
||
|
||
[[tool.mypy.overrides]]
|
||
module = ["apscheduler.*"]
|
||
ignore_missing_imports = true
|
||
|
||
[tool.pytest.ini_options]
|
||
testpaths = ["tests"]
|
||
asyncio_mode = "auto"
|
||
addopts = [
|
||
"-ra",
|
||
"--strict-markers",
|
||
"--strict-config",
|
||
]
|
||
markers = [
|
||
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
||
"integration: integration tests with fake MCP",
|
||
"golden: golden scenario tests",
|
||
]
|
||
|
||
[tool.coverage.run]
|
||
source = ["src/cerbero_bite"]
|
||
branch = true
|
||
|
||
[tool.coverage.report]
|
||
exclude_lines = [
|
||
"pragma: no cover",
|
||
"raise NotImplementedError",
|
||
"if TYPE_CHECKING:",
|
||
"if __name__ == .__main__.:",
|
||
]
|
||
show_missing = true
|
||
skip_covered = false
|