Report each firm's trading mix: open positions and today's entries by instrument
The master knew how many accounts were in a trade, not in what. Each firm's report now carries its open positions by instrument (accounts long and short, contracts held) and today's entries the same way. A position's contract is named by its instrument: DXtrade's carries the symbol; a futures one is looked up among the contracts this machine has entered (recorded at the fill and kept), then the resolver's cache and TopstepX's own. Entries are counted as they fill, per trade date, in a setting, so a restart doesn't lose the day. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ab3132182a
commit
5696f2b036
@@ -25,6 +25,7 @@ import { getSetting, setSetting } from './db';
|
||||
import type { LaneTick, TickReason } from './master-protocol';
|
||||
import { POINT_VALUES, housekeepingRoot, MAX_HOLD_HOURS } from './instrument-specs';
|
||||
import { firmInstruments, drawFuturesInstrument, spreadBlock, type LegShape } from './instruments';
|
||||
import { recordEntry } from './trade-mix';
|
||||
import { errorMessage, isClientReady, isOrderNotPlaced, type PlatformClient, type PlatformContract, type PickContext } from './platform-client';
|
||||
|
||||
// ── process-wide state ───────────────────────────────────────────────────────
|
||||
@@ -1082,6 +1083,7 @@ async function runTradeLocked(
|
||||
if (!mnqContract) throw new Error(`${microRoot} contract not found for extra-day trade`);
|
||||
|
||||
const fill = await client.sendOrder(acc.id, mnqContract.name, 1, resolvedAction, 'Market');
|
||||
recordEntry(item.firmName, microRoot, resolvedAction, 1, mnqContract.id);
|
||||
const exitAction: 'Buy' | 'Sell' = resolvedAction === 'Buy' ? 'Sell' : 'Buy';
|
||||
const exitFill = await client.sendOrder(acc.id, mnqContract.name, 1, exitAction, 'Market');
|
||||
|
||||
@@ -1318,6 +1320,16 @@ async function fireLeg(
|
||||
const { sizing, obfuscation } = plan;
|
||||
|
||||
const fill = await sendEntry(tag, client, acc, legContract.name, contracts, action, tradeDate, legAmount);
|
||||
// For the master's trade mix: a futures leg is its root (the drain
|
||||
// micro on a drain day), a DXtrade one its symbol.
|
||||
const dx = (legContract.stepNotional ?? 0) > 0;
|
||||
recordEntry(
|
||||
item.firmName,
|
||||
dx ? String(legContract.name).split('|')[0] : (item.drain ? housekeepingFor(item.firm) : symbolLabel),
|
||||
action,
|
||||
dx ? contracts * (Number(String(legContract.name).split('|')[1]) || 1) : contracts,
|
||||
(legContract as { id?: unknown }).id,
|
||||
);
|
||||
const exitAction: 'Buy' | 'Sell' = action === 'Buy' ? 'Sell' : 'Buy';
|
||||
|
||||
// The entry fee. Percent firms: straight off the fill. Otherwise wait
|
||||
|
||||
Reference in New Issue
Block a user