Vest: report on Vest's day, and close a leg whose open came back unknown
The reporter and the dashboard take each firm's own trade date (tradeDateFor), as the engine does: between 5 PM CT and Vest's 8 PM ET reset the Central date counted the open Vest day as a prior day and as today's P&L both, and could report a pass the master keeps for good. The completion check's settle window now follows the client's own roll. An open whose outcome came back unknown is marked the bot's once a read shows the position it made, so the market-close guard closes it before a long closure; an unmarked leg is no longer logged as a hand trade. A symbol the close gate holds back stays on the candidate board for the dashboard and the report, and fireLeg holds each account's leg to the close at its own size, not just the batch lead's. check-vest-client.mjs drives the guard and the board with every gateway call answered locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ec3e6ea388
commit
ef15200e5e
+5
-1
@@ -13,7 +13,7 @@ import { ensureRulesEvidence, getAccountConfig } from './account-type-resolver';
|
||||
import {
|
||||
combineCmeSessions, computeDayPlan, groupLegFraction, pickLegAmount, resolveEffectiveConfig, tradeDateFor,
|
||||
obfuscationStopDollars, takeProfitPlan, onTick, percentFee, dllRoom, dllStopDollars, dllViable, stopTicks,
|
||||
expectedSwapToWin, planLegSize, maxLossRoom, breachDistance,
|
||||
expectedSwapToWin, planLegSize, maxLossRoom, breachDistance, legCloseNote,
|
||||
isNoTradeTime, isPastSessionClose,
|
||||
BIG_DAY_THRESHOLD, LEG_COMPLETION_EPSILON, MAX_LEGS_PER_DAY,
|
||||
FALLBACK_COMMISSION_PER_CONTRACT, MAX_COMMISSION_PER_CONTRACT, DLL_MIN_STOP,
|
||||
@@ -1491,6 +1491,10 @@ async function fireLeg(
|
||||
if (!plan.sizing) {
|
||||
throw new Error(`no position size for ${legContract.name} — its recent volatility is unknown`);
|
||||
}
|
||||
// The pick held the batch's lead leg to its market's close; this
|
||||
// account's leg can size longer (another stage, a leverage cap).
|
||||
const closeNote = legCloseNote(legContract.closesAt, plan.sizing.predictedHoldHours, Date.now());
|
||||
if (closeNote) throw new Error(`${legContract.name}: ${closeNote} — not entering`);
|
||||
contracts = Math.max(1, Math.round(plan.sizing.notional / stepNotional));
|
||||
if (plan.cap > 0) contracts = Math.min(contracts, Math.max(1, Math.floor(plan.cap / stepNotional)));
|
||||
if ((legContract.maxContracts ?? 0) > 0) contracts = Math.min(contracts, legContract.maxContracts!);
|
||||
|
||||
Reference in New Issue
Block a user