- lib/db.ts: new firm_banned_symbols table with getBannedSymbols, isSymbolBanned, and setBannedSymbol helpers - app/api/firms/[id]/banned-symbols/route.ts: GET lists banned symbols, PATCH toggles a ban for a given symbol - app/api/firms/route.ts: include bannedSymbols[] in firm list response - app/firms/[id]/settings/page.tsx: Instruments section shows all globally-enabled symbols with a red toggle to ban/unban; banned symbols display a "SYMBOL BANNED" pill next to their name - app/page.tsx: FirmRows shows "ES BANNED" (or current symbol) pill next to the firm name when the selected trade symbol is banned for that firm - lib/auto-trade.ts: skip firms entirely when the trade symbol is banned - types.ts: add bannedSymbols field to FirmConfig Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 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 }[];
|
|
}
|
|
|
|
export interface FirmState {
|
|
firm: string;
|
|
connected: boolean;
|
|
accounts: AccountState[];
|
|
}
|