Report per-account-type days-traded histograms to the master
Adds daysHist ({daysTraded: accountCount}) to AccountTypeStats, computed
from the same combined-day view the trade path uses and covering every
live account including ones mid-trade. Feeds the master's payout
calendar; an older master simply ignores the field.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
0d01539338
commit
6c501d00ed
@@ -22,6 +22,10 @@ export interface AccountTypeStats {
|
|||||||
targetHit?: number;
|
targetHit?: number;
|
||||||
partial?: number;
|
partial?: number;
|
||||||
loss?: number;
|
loss?: number;
|
||||||
|
/** Live accounts by trading days completed toward the current target:
|
||||||
|
* {daysTraded: accountCount}. Feeds the master's payout calendar.
|
||||||
|
* Optional so an older master simply ignores it. */
|
||||||
|
daysHist?: Record<number, number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FirmStats {
|
export interface FirmStats {
|
||||||
|
|||||||
+13
-6
@@ -80,6 +80,18 @@ function collectFirmStats() {
|
|||||||
totalAccounts++;
|
totalAccounts++;
|
||||||
slice.totalAccounts++;
|
slice.totalAccounts++;
|
||||||
|
|
||||||
|
// Same combined-day view as the trade path: for a combining firm,
|
||||||
|
// "today" spans the holiday stretch. Computed for every live
|
||||||
|
// account — including ones mid-trade — so the days-traded
|
||||||
|
// histogram below covers the whole slice.
|
||||||
|
const combined = cfg ? combineCmeSessions(
|
||||||
|
cfg.combineCmeHolidays, client.dailyPnL[acc.id] ?? [], currentTradeDateCT(), cash.realizedPnL,
|
||||||
|
) : null;
|
||||||
|
if (combined) {
|
||||||
|
const hist = (slice.daysHist ??= {});
|
||||||
|
hist[combined.daysTraded] = (hist[combined.daysTraded] ?? 0) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (client.positions[acc.id]) {
|
if (client.positions[acc.id]) {
|
||||||
inTrade++;
|
inTrade++;
|
||||||
accountsTraded++;
|
accountsTraded++;
|
||||||
@@ -100,12 +112,7 @@ function collectFirmStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if target was hit today
|
// Check if target was hit today
|
||||||
if (cfg) {
|
if (cfg && combined) {
|
||||||
// Same combined-day view as the trade path: for a combining
|
|
||||||
// firm, "today" spans the holiday stretch.
|
|
||||||
const combined = combineCmeSessions(
|
|
||||||
cfg.combineCmeHolidays, client.dailyPnL[acc.id] ?? [], currentTradeDateCT(), cash.realizedPnL,
|
|
||||||
);
|
|
||||||
const equityProfit = cash.amount - cfg.accountSize;
|
const equityProfit = cash.amount - cfg.accountSize;
|
||||||
const plan = computeDayPlan(
|
const plan = computeDayPlan(
|
||||||
acc.id, combined.tradeDate, cfg.profitTarget, cfg.consistency,
|
acc.id, combined.tradeDate, cfg.profitTarget, cfg.consistency,
|
||||||
|
|||||||
Reference in New Issue
Block a user