fix(positioning): cap testnet exec-sizing path (4th uncapped money-path found by exhaustive sweep)
An exhaustive grep of every build_bybit_paper_book / combined_symbol_weights* / latest_raw_sleeve_weights caller found bybit_testnet_run.py sized the executed testnet positions UNCAPPED (latest_raw_sleeve_weights + combined_symbol_weights called without positioning_coin_gross_cap). The cron is suspended (no creds) but it is a real order-placing path — the moment it arms it would size concentrated positions. Thread POSITIONING_COIN_GROSS_CAP the same as every other exec path. 35 testnet tests green, import + lint clean (no circular import). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ from typing import Any
|
||||
|
||||
# `latest_raw_sleeve_weights` / `combined_symbol_weights` are imported at MODULE level (not locally like the
|
||||
# other body deps) so tests can `monkeypatch.setattr(run_mod, "latest_raw_sleeve_weights", ...)`.
|
||||
from fxhnt.application.bybit_forward_track import POSITIONING_COIN_GROSS_CAP
|
||||
from fxhnt.application.bybit_paper_book import combined_symbol_weights, latest_raw_sleeve_weights
|
||||
|
||||
|
||||
@@ -112,9 +113,14 @@ def run_bybit_testnet(settings: Any, *, paper_envelope: float, execute: bool,
|
||||
try:
|
||||
universe = _testnet_universe(store)
|
||||
unlock_events = _testnet_unlock_events(s)
|
||||
weights = latest_raw_sleeve_weights(store, universe=universe, unlock_events=unlock_events)
|
||||
# Cap the executed testnet positions the SAME way the modeled/forward/paper-book paths do, so a single
|
||||
# over-short coin can't take an outsized real position (the reconciled return is capped; the executed
|
||||
# position must match). POSITIONING_COIN_GROSS_CAP is the ex-ante per-coin weight cap (0.07).
|
||||
weights = latest_raw_sleeve_weights(store, universe=universe, unlock_events=unlock_events,
|
||||
positioning_coin_gross_cap=POSITIONING_COIN_GROSS_CAP)
|
||||
_combined, as_of_day = combined_symbol_weights(
|
||||
store, universe=universe, unlock_events=unlock_events)
|
||||
store, universe=universe, unlock_events=unlock_events,
|
||||
positioning_coin_gross_cap=POSITIONING_COIN_GROSS_CAP)
|
||||
marks = _testnet_marks(store, universe=universe)
|
||||
finally:
|
||||
store.close()
|
||||
|
||||
Reference in New Issue
Block a user