One side per machine: no lane opens against a position another lane holds

Each lane chose its batch's side on its own coin flip. So one person's
machine could be long NQ in the futures lane while its Vest accounts sat
short NDX, hedging that person against themselves across firms.

- Every new entry now takes the side of whatever the machine holds in any
  lane (machineSide in trading-logic). That includes another firm's
  positions and hand trades on any of the machine's accounts.
- With positions on both sides already, nothing is added: the batch reports
  positions-open with the reason, and a manual leg is refused.
- A side chosen with nothing held is reserved while its batch places it, so
  a lane deciding meanwhile follows it.
- It works on the side, not the instrument: NQ against an NDX perp is the
  same bet, and the indices and crypto are close enough that one side for
  everything is the only rule that never hedges.
- Unchanged: one direction per batch within a lane, and the DXtrade and Vest
  clients' own guards against opening opposite another of their accounts.
  The fleet still doesn't coordinate sides across people.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-10-26 15:27:18 -05:00
co-authored by Claude Opus 5.5
parent 769d96883f
commit 335af486d4
3 changed files with 88 additions and 7 deletions
+19
View File
@@ -1435,6 +1435,25 @@ export function botStopsActive(cfg: { firstDayStop: boolean; minDayStop: boolean
return cfg.firstDayStop || cfg.minDayStop || (cfg.dailyLossLimit ?? 0) > 0;
}
/**
* The side every new entry on this machine must take, so nothing it opens
* hedges the person against themselves: the side of every position the
* machine's accounts hold, in any lane (another firm's, a hand trade's), else
* the side another lane's batch is placing right now. 'mixed' = it holds both
* sides already (hand trades, or from before this rule), so no side can be
* joined without hedging one of them. null = free to choose.
*
* The side, not the instrument: NQ futures against an NDX perp is the same
* bet, and ES or a crypto index close enough to it that one side for
* everything is the only rule that never hedges.
*/
export function machineSide(netPositions: number[], reserved: 'Buy' | 'Sell' | null): 'Buy' | 'Sell' | 'mixed' | null {
const long = netPositions.some((n) => n > 0) || reserved === 'Buy';
const short = netPositions.some((n) => n < 0) || reserved === 'Sell';
if (long && short) return 'mixed';
return long ? 'Buy' : short ? 'Sell' : null;
}
// ── position size ────────────────────────────────────────────────────────────
/** The hold a leg is sized for when the firm doesn't set one. */