diff --git a/src/modules/investment/types/investment.types.ts b/src/modules/investment/types/investment.types.ts index 79ac10a..b7b41e4 100644 --- a/src/modules/investment/types/investment.types.ts +++ b/src/modules/investment/types/investment.types.ts @@ -119,3 +119,32 @@ export interface AgentPerformance { sharpe_ratio: number; win_rate: number; } + +// ============================================================================ +// JSONB Field Types (for proper typing of JSONB columns) +// ============================================================================ + +/** + * Type for investment.risk_questionnaire.responses JSONB field + * Structure: [{question_id, answer, score}] + */ +export interface RiskQuestionnaireResponse { + question_id: string; + answer: string; + score: number; +} + +/** + * Type for investment.withdrawal_requests.destination_details JSONB field + */ +export interface WithdrawalDestinationDetails { + bank_name?: string; + account_number?: string; + account_holder?: string; + routing_number?: string; + swift_code?: string; + iban?: string; + crypto_address?: string; + crypto_network?: string; + payment_method: 'bank_transfer' | 'crypto' | 'other'; +} diff --git a/src/modules/portfolio/types/portfolio.types.ts b/src/modules/portfolio/types/portfolio.types.ts index e005e91..4bcfbc2 100644 --- a/src/modules/portfolio/types/portfolio.types.ts +++ b/src/modules/portfolio/types/portfolio.types.ts @@ -126,6 +126,17 @@ export interface RebalanceHistory { createdAt: Date; } +/** + * Type for portfolio_snapshots.allocations JSONB field + * Structure: { [asset: string]: { percent: number, value: number, quantity: number } } + */ +export interface SnapshotAllocationData { + percent: number; + value: number; + quantity: number; + avgCost?: number; +} + export interface PortfolioSnapshot { id: string; portfolioId: string; @@ -136,7 +147,7 @@ export interface PortfolioSnapshot { unrealizedPnlPercent: number; dayChange: number; dayChangePercent: number; - allocations: Record | null; + allocations: Record | null; createdAt: Date; } diff --git a/src/modules/trading/types/order.types.ts b/src/modules/trading/types/order.types.ts index 3114909..b170ec8 100644 --- a/src/modules/trading/types/order.types.ts +++ b/src/modules/trading/types/order.types.ts @@ -176,3 +176,30 @@ export interface OrderListResult { limit: number; offset: number; } + +// ============================================================================ +// JSONB Field Types (for proper typing of JSONB columns) +// ============================================================================ + +/** + * Type for trading.bots.strategy_config JSONB field + * Configuration for trading bot strategies + */ +export interface TradingBotStrategyConfig { + strategy_name?: string; + entry_rules?: Record; + exit_rules?: Record; + risk_management?: { + max_position_size?: number; + stop_loss_percent?: number; + take_profit_percent?: number; + max_daily_loss?: number; + }; + indicators?: Array<{ + name: string; + params: Record; + }>; + timeframes?: Timeframe[]; + symbols?: string[]; + [key: string]: unknown; +}