Account-aware sizing: size off REAL equity + buying-power & liquidity caps
For going live on a SMALL real account ($300). The sizer assumed a $100k default -> at $300 it would size $1,000 positions and get rejected. Now: - _current_equity() reads actual broker equity (cached get_account) and sizes off it, so a $300 account sizes for $300. - max_position_value caps each position to ~1/3 of equity (TRADING_MAX_POSITION_PCT) so N positions fit buying power. - max_shares liquidity cap (TRADING_LIQUIDITY_MAX_VOLUME_PCT * day volume) wired through the trigger book -> submit_breakout_now; off at small size, for scaling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
e4075557b3
commit
638843ca3a
5 files changed
+98
-13
No files matched your search
+3
-1
@@ -484,6 +484,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
"trigger": hi,
|
||||
"stop": stop,
|
||||
"range_pct": ((hi - lo) / hi) if (hi and lo and hi > 0) else 0.0,
|
||||
"cum_volume": g.cumulative_volume,
|
||||
"complete": complete,
|
||||
})
|
||||
# pre-open / before any gappers form: surface the queued watchlist so the
|
||||
@@ -536,7 +537,8 @@ def main(argv: list[str] | None = None) -> int:
|
||||
pass
|
||||
for t in book.fires():
|
||||
res = rt["execution"].submit_breakout_now(
|
||||
t.symbol, t.trigger, t.stop, last_price=t.price
|
||||
t.symbol, t.trigger, t.stop, last_price=t.price,
|
||||
cum_volume=t.cum_volume,
|
||||
)
|
||||
if res.get("ok"):
|
||||
book.mark_fired(t.symbol)
|
||||
|
||||
Reference in new issue
Block a user