- DB migration: ALTER TABLE account_configs ADD COLUMN max_position_size INTEGER NOT NULL DEFAULT 0 - Added max_position_size to AccountConfigRow, createAccountConfig, updateAccountConfig in lib/db.ts - Added maxPositionSize to AccountConfig type in types.ts (0 = no limit) - GET /api/firms/[id] now returns maxPositionSize per account - POST /api/firms/[id]/accounts and PUT /api/account-configs/[id] accept maxPositionSize - Firm settings page: new Max Contracts column (blank = no limit) - auto-trade: contracts capped at maxPositionSize when > 0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 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;
|
|
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;
|
|
}
|
|
|
|
export interface FirmState {
|
|
firm: string;
|
|
connected: boolean;
|
|
accounts: AccountState[];
|
|
}
|