/** * @name strategies/trade-journal * @description File-based trade journal for automatic trade tracking. * * Stores trade entries as JSON in ~/.config/mcp-sap/journal/YYYY-MM-DD.json. * Each entry captures: timestamp, type (open/close), market, side, collateral, * leverage, entry/exit price, SL/TP, tx signature, position address, fees, status. * * @module strategies/trade-journal */ /** Trade journal entry. */ export interface TradeJournalEntry { /** ISO 8601 timestamp. */ timestamp: string; /** Trade type: open, close, liquidation, sl_triggered, tp_triggered. */ type: 'open' | 'close' | 'liquidation' | 'sl_triggered' | 'tp_triggered'; /** Market symbol (e.g. BONK-PERP). */ market: string; /** Position side: long or short. */ side: 'long' | 'short'; /** Collateral in USD. */ collateralUsd: number; /** Leverage multiplier. */ leverage: number; /** Entry or exit price in USD. */ priceUsd: number; /** Stop loss price in USD (if set). */ stopLossUsd?: number; /** Take profit price in USD (if set). */ takeProfitUsd?: number; /** Transaction signature. */ txSignature?: string; /** Position PDA address. */ positionAddress?: string; /** Fees paid in USD (x402 + gas). */ feesPaidUsd: number; /** Current status: open, closed, liquidated. */ status: 'open' | 'closed' | 'liquidated'; /** Optional P&L in USD (for close entries). */ pnlUsd?: number; /** Optional notes. */ notes?: string; } /** Query filters for the trade journal. */ export interface JournalQuery { /** Filter by market symbol. */ market?: string; /** Filter by type. */ type?: TradeJournalEntry['type']; /** Filter by status. */ status?: TradeJournalEntry['status']; /** Start date (ISO 8601). */ from?: string; /** End date (ISO 8601). */ to?: string; /** Max number of results. */ limit?: number; } /** Journal query result. */ export interface JournalQueryResult { entries: TradeJournalEntry[]; count: number; totalPnlUsd?: number; } /** * Append a trade entry to the journal. * Entries are stored as JSONL (one JSON object per line) for append-only efficiency. */ export declare function appendTradeEntry(entry: TradeJournalEntry): { success: boolean; path: string; }; /** * Query the trade journal with filters. * Reads all journal files in the date range and filters entries. */ export declare function queryTradeJournal(query: JournalQuery): JournalQueryResult; //# sourceMappingURL=trade-journal.d.ts.map