Compare commits
2 Commits
8a1fb823dc
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a80c17f2bc | |||
| 097e764f6a |
@@ -1204,6 +1204,70 @@ def option_chain_trigger(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@option_chain.command(name="research-trigger")
|
||||||
|
@click.option(
|
||||||
|
"--strategy",
|
||||||
|
"strategy_path",
|
||||||
|
type=click.Path(exists=True, dir_okay=False, path_type=Path),
|
||||||
|
default=_DEFAULT_STRATEGY_PATH,
|
||||||
|
show_default=True,
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--db",
|
||||||
|
"db_path",
|
||||||
|
type=click.Path(dir_okay=False, path_type=Path),
|
||||||
|
default=_DEFAULT_DB_PATH,
|
||||||
|
show_default=True,
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--audit",
|
||||||
|
"audit_path",
|
||||||
|
type=click.Path(dir_okay=False, path_type=Path),
|
||||||
|
default=_DEFAULT_AUDIT_PATH,
|
||||||
|
show_default=True,
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--token",
|
||||||
|
type=str,
|
||||||
|
default=None,
|
||||||
|
help="MCP bearer token (override su CERBERO_BITE_MCP_TOKEN).",
|
||||||
|
)
|
||||||
|
@click.option("--asset", default="ETH", show_default=True)
|
||||||
|
def option_chain_research_trigger(
|
||||||
|
strategy_path: Path,
|
||||||
|
db_path: Path,
|
||||||
|
audit_path: Path,
|
||||||
|
token: str | None,
|
||||||
|
asset: str,
|
||||||
|
) -> None:
|
||||||
|
"""Esegue UNA volta il collector research full-chain (source='research').
|
||||||
|
|
||||||
|
Cattura tutte le scadenze ed entrambe le ali con book_depth_top3
|
||||||
|
popolato. ``force=True``: gira anche se ``research_collector.enabled``
|
||||||
|
è false, utile per testare prima di accendere il cron orario.
|
||||||
|
"""
|
||||||
|
from cerbero_bite.runtime.dependencies import build_runtime # noqa: PLC0415
|
||||||
|
from cerbero_bite.runtime.option_chain_research_cycle import ( # noqa: PLC0415
|
||||||
|
collect_option_chain_research,
|
||||||
|
)
|
||||||
|
|
||||||
|
cfg = load_strategy(strategy_path).config
|
||||||
|
ctx = build_runtime(
|
||||||
|
cfg=cfg,
|
||||||
|
endpoints=load_endpoints(),
|
||||||
|
token=load_token(value=token),
|
||||||
|
db_path=db_path,
|
||||||
|
audit_path=audit_path,
|
||||||
|
bot_tag=load_bot_tag(),
|
||||||
|
)
|
||||||
|
n = asyncio.run(collect_option_chain_research(ctx, asset=asset, force=True))
|
||||||
|
console.print(
|
||||||
|
f"[green]Persisted {n} research quote(s) for {asset}[/green]"
|
||||||
|
if n > 0
|
||||||
|
else "[yellow]No quotes persisted (chain empty or fetch failed)[/yellow]"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@option_chain.command(name="analyze")
|
@option_chain.command(name="analyze")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--strategy",
|
"--strategy",
|
||||||
|
|||||||
@@ -70,12 +70,16 @@ async def collect_option_chain_research(
|
|||||||
asset: str = "ETH",
|
asset: str = "ETH",
|
||||||
now: datetime | None = None,
|
now: datetime | None = None,
|
||||||
batch_size: int = DEFAULT_BATCH_SIZE,
|
batch_size: int = DEFAULT_BATCH_SIZE,
|
||||||
|
force: bool = False,
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Collect + persist un singolo snapshot full-chain ``research`` per
|
"""Collect + persist un singolo snapshot full-chain ``research`` per
|
||||||
``asset``. Ritorna il numero di quote persistiti (0 su fallimento
|
``asset``. Ritorna il numero di quote persistiti (0 su fallimento
|
||||||
best-effort o se il collettore è disabilitato)."""
|
best-effort o se il collettore è disabilitato).
|
||||||
|
|
||||||
|
``force=True`` bypassa il gate ``enabled`` (usato dal trigger CLI per
|
||||||
|
testare la raccolta prima di accendere il cron schedulato)."""
|
||||||
rc = getattr(ctx.cfg, "research_collector", None)
|
rc = getattr(ctx.cfg, "research_collector", None)
|
||||||
if rc is None or not rc.enabled:
|
if rc is None or (not rc.enabled and not force):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
when = (now or datetime.now(UTC)).astimezone(UTC)
|
when = (now or datetime.now(UTC)).astimezone(UTC)
|
||||||
|
|||||||
+3
-3
@@ -6,8 +6,8 @@
|
|||||||
# config hash), and lands as a separate commit with the motivation in
|
# config hash), and lands as a separate commit with the motivation in
|
||||||
# the commit message.
|
# the commit message.
|
||||||
|
|
||||||
config_version: "1.7.0"
|
config_version: "1.7.1"
|
||||||
config_hash: "1171380de6d3334be1f6eed04797cebe15e5b8ec2124e130b582c2e2097bde37"
|
config_hash: "720a202e9dde4ccff7f79a8bc9521de62dc30115f11f486c55ad6f3986858dcb"
|
||||||
last_review: "2026-06-09"
|
last_review: "2026-06-09"
|
||||||
last_reviewer: "Adriano"
|
last_reviewer: "Adriano"
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ entry:
|
|||||||
# ali, popolando book_depth_top3 → backtest opzioni per-trade e
|
# ali, popolando book_depth_top3 → backtest opzioni per-trade e
|
||||||
# standing put + slippage reale. Disabilitato di default (costo API).
|
# standing put + slippage reale. Disabilitato di default (costo API).
|
||||||
research_collector:
|
research_collector:
|
||||||
enabled: false
|
enabled: true
|
||||||
cron: "0 * * * *" # orario
|
cron: "0 * * * *" # orario
|
||||||
expiry_max_days: 95 # 1g..3mesi
|
expiry_max_days: 95 # 1g..3mesi
|
||||||
moneyness_band_pct: null # null = catena completa (entrambe le ali)
|
moneyness_band_pct: null # null = catena completa (entrambe le ali)
|
||||||
|
|||||||
Reference in New Issue
Block a user