- Persist fund transactions to SQLite (fund_transactions table) so they survive beyond Tradovate's 28-day report window - Calendar: highlight W/D dates in amber with the amount shown below the day - Equity curve: reduce running equity at withdrawal dates and show a vertical dashed amber line labelled W/D - New Cash History table below calendar listing all trades and W/D events sorted newest-first Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
export interface AccountConfig {
|
|
prefix: string;
|
|
profitTarget: number;
|
|
consistency: number;
|
|
minDayPnL: number;
|
|
minTradingDays: number;
|
|
accountSize: number;
|
|
maxLoss: number; // 0 = no limit; positive = account is "Dead" when loss exceeds this
|
|
maxPositionSize: number; // 0 = no limit; positive = max contracts per trade
|
|
}
|
|
|
|
export interface FirmConfig {
|
|
id: number;
|
|
firm: string;
|
|
username: string;
|
|
password: string;
|
|
bannedSymbols: string[];
|
|
accounts: AccountConfig[];
|
|
}
|
|
|
|
export interface AccountState {
|
|
id: number;
|
|
name: string;
|
|
active: boolean;
|
|
amount: number;
|
|
realizedPnL: number;
|
|
daysTraded: number;
|
|
hasPosition: boolean;
|
|
/** Balance floor from Tradovate's auto-liquidation profile (0 = not set) */
|
|
autoLiqThreshold: number;
|
|
/** Sum of all historical daily P&L entries */
|
|
totalProfit: number;
|
|
/** True when today's realizedPnL has met or exceeded the computed daily target */
|
|
targetHit: boolean;
|
|
/** Next trading day's target, computed server-side. null when account is dead or config is missing. */
|
|
dailyTarget: { amount: number; path: 'first_day' | 'normal_day' | 'reduced_day' } | null;
|
|
/** FIFO daily P&L history — used by the equity curve and calendar. */
|
|
dailyPnL: { date: string; pnl: number }[];
|
|
/** Fund transactions (deposits/withdrawals) — used by the calendar and equity curve. */
|
|
fundTransactions: { date: string; amount: number }[];
|
|
}
|
|
|
|
export interface FirmState {
|
|
firm: string;
|
|
connected: boolean;
|
|
accounts: AccountState[];
|
|
}
|