fix(ibkr-bot): entry-from-zero uses 0.5% floor, not full 3% hysteresis
The 3% hysteresis blocked the IBIT crypto sleeve (target 2.3% < 3%) from ever entering. Hysteresis is for damping rebalances of existing positions; first entry from zero should use a small floor. Now all 6 instruments deploy. Verified live against the cluster ib-gateway paper account ($1M NLV): all 6 orders present (SPY/IEF/GLD/PDBC/DBMF/IBIT). Connected via kubectl port-forward svc/ib-gateway 4002. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -82,7 +82,9 @@ def main():
|
||||
tgt_sh = nlv * w / px[t]
|
||||
cur = pos.get(t, 0.0)
|
||||
delta = tgt_sh - cur
|
||||
if abs(delta * px[t]) > HYST * nlv:
|
||||
# entry from zero uses a small floor (0.5% NLV); rebalancing an existing position uses full hysteresis
|
||||
thresh = (0.005 if cur == 0 else HYST) * nlv
|
||||
if abs(delta * px[t]) > thresh:
|
||||
orders.append((t, "BUY" if delta > 0 else "SELL", round(abs(delta), 4)))
|
||||
print(f"\nintended orders (hysteresis {int(HYST*100)}% of NLV):")
|
||||
for t, side, qty in orders:
|
||||
|
||||
Reference in New Issue
Block a user