DXtrade: count closed-trade P&L, week-long volatility, broker leverage caps, swap in the take-profit

- Transfers: a close books its SETTLEMENT and COMMISSION under one
  transaction code, and keying by the code alone let the commission
  overwrite the P&L. Keys now carry the type, so the day-start balance,
  daily-loss room, realized P&L, daily history and books check all see
  closed-trade profit and loss.
- Volatility from a week of hourly closes (was 48 h), still measured once
  per trade date, so one quiet weekend can't triple a hold estimate.
- Each symbol's margin rate from the account's instrument details caps
  the position at available funds / rate (Tradeify: 5:1 crypto, 2:1
  stocks); the account type's max notional stays as an optional ceiling.
- Firms with overnight financing add the swap a winning leg is expected
  to pay (the winners' mean hold, (A²+2AB)/3σ²) to its take-profit, and
  the sizing and hold estimate count it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-09-26 18:11:42 -05:00
co-authored by Claude Opus 5.5
parent 675b4c89f8
commit a2d9df5ba4
10 changed files with 309 additions and 81 deletions
+11 -5
View File
@@ -116,14 +116,20 @@ per-contract fees and the CME calendar.
- **Symbol map** — which DXtrade symbols each CME root may trade as. A `*` row
covers every root (drain and extra-day legs trade `MNQ`, so map it or use
`*`). When a root lists several, the cheapest tradable one right now wins:
spread plus both commissions, divided by its recent hourly volatility.
- **Target hold hours** — each leg's notional is sized from the instrument's
recent volatility so its expected hold is about this long (blank = 12 h),
and **financing %/day** if the firm charges swap.
spread plus both commissions, divided by its volatility (hourly closes over
the past week, measured once a day).
- **Target hold hours** — each leg's notional is sized from that volatility so
its expected hold is about this long (blank = 12 h). The position never
exceeds what the account's available funds can margin at the broker's
rate for the symbol (Tradeify: 5:1 crypto, 2:1 stocks), so a quiet market or
a big leg can hold longer than the target.
- **Financing %/day** if the firm charges swap (Tradeify 1-Step: `0.033`).
Each take-profit then also carries the swap a winning leg is expected to pay
before it fills, so a win still clears the full leg.
Per account type: **Daily loss limit** (Tradeify: 3% of size — every leg then
carries a stop that keeps the firm's day inside it, less a 10% reserve and
fees) and **Max notional**.
fees) and **Max notional**, an optional ceiling on top of the broker's margin.
Before the scheduler trades a DXtrade firm, run the smoke test against a real
login (with this instance's client for the firm disconnected):