A platform may now state its own stop slippage share (PlatformClient.stopSlippageFraction); the daily-loss reserve is the larger of 10% of the limit and that share of the position. Vest's 9 measured stop-outs filled 0.9 points past the trigger on average and 2.25 at worst, against the ~30 points 0.1% held back. On a $1,400 day with ~$495k of NDX the stop goes from ~$880 to ~$1,230, and the leg sizes up for the same hold. Sizing, the placed stop, the dashboard's next stop and the reset guard all use it; other platforms keep 0.1%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
/**
|
|
* The hold this machine sizes DXtrade and Vest legs for. Every person's
|
|
* machine would otherwise size a like account in a like state to the same
|
|
* position as everyone else's; each person's own draw (personHoldHours) puts
|
|
* their sizes within ±PERSON_SIZE_SPREAD of the plan instead, the same for
|
|
* all of their accounts and new each trade date.
|
|
*/
|
|
|
|
import { getSetting } from './db';
|
|
import { currentTradeDateCT, personHoldHours, DEFAULT_TARGET_HOLD_HOURS } from './trading-logic';
|
|
|
|
/** Who this machine trades for: the master's uuid for the person, else the
|
|
* instance name it reports under. */
|
|
function personKey(): string {
|
|
return getSetting('instance_id') || getSetting('instance_name') || '';
|
|
}
|
|
|
|
/** The hold a DXtrade or Vest firm's legs are sized for on this machine today. */
|
|
export function sizingHoldHours(
|
|
firm: { targetHoldHours?: number } | null | undefined,
|
|
tradeDate: string = currentTradeDateCT(),
|
|
): number {
|
|
return personHoldHours(firm?.targetHoldHours || DEFAULT_TARGET_HOLD_HOURS, personKey(), tradeDate);
|
|
}
|