book_execute: integrazione U1+U2 — un solo Telegram in solo protezione, stato unknown, set_open_cap diretto (#18, #21, #22, #24)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -96,7 +96,9 @@ class DeribitTrader(DeribitRead):
|
||||
if side not in ("buy", "sell"):
|
||||
raise GuardrailError(f"side non valido: {side}")
|
||||
if not reduce_only: # cap SOLO sulle aperture; le chiusure si tentano sempre
|
||||
cap = self._open_cap.get(instrument, MAX_AMOUNT[instrument])
|
||||
# getattr, non self._open_cap diretto: un DeribitTrader creato con object.__new__
|
||||
# (test che saltano __init__) non ha l'attributo, e qui non deve dare AttributeError.
|
||||
cap = getattr(self, "_open_cap", {}).get(instrument, MAX_AMOUNT[instrument])
|
||||
if amount <= 0 or amount > cap:
|
||||
raise GuardrailError(f"size {amount} fuori dal cap apertura (0, {cap}]")
|
||||
if amount <= 0:
|
||||
|
||||
Reference in New Issue
Block a user