Tradeify247: each person sizes a little apart from everyone else

Every machine sized a like account in a like state to the same position as
every other person's, so two people's positions could match to the unit.
Each person now draws a size factor in [0.85, 1.15] per trade date, seeded
by the master's uuid for them; all of one person's accounts share it.

The factor moves the hold a DXtrade leg is sized for (hold / factor², since
size goes as 1/√hold), so the instrument pick, the dashboard's next leg and
the Firms page's reach test all see the hold the size was made for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-10-19 20:00:33 -05:00
co-authored by Claude Opus 5.5
parent ed56e306d1
commit 6dd2528fe2
8 changed files with 126 additions and 15 deletions
+24
View File
@@ -0,0 +1,24 @@
/**
* The hold this machine sizes DXtrade 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 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);
}