import type { PositionSummary, TradeRow, TokenPnl, RealizedPnlResult } from './types.js'; export interface WatchlistSummaryEntry { wallet: string; label: string; position_count: number; total_pnl: number; total_value: number; last_active: number | null; } export interface WalletDashboard { wallet: string; positions: PositionSummary[]; total_positions: number; total_trades: number; total_pnl: number; total_value: number; win_count: number; loss_count: number; recent_trades: TradeRow[]; realized_pnl: number; pnl_confidence: 'full' | 'partial'; token_pnl: TokenPnl[]; } export interface LeaderboardEntry { wallet: string; label: string; value: number; rank: number; } export type LeaderboardMetric = 'total_pnl' | 'total_value' | 'trade_count' | 'win_rate' | 'roi' | 'realized_pnl' | 'volume' | 'avg_trade_size' | 'largest_win' | 'largest_loss' | 'market_count'; export interface LeaderboardRow { wallet: string; label: string; rank: number; metrics: Record; } export interface LeaderboardQuery { metrics: LeaderboardMetric[]; sortBy: LeaderboardMetric; sortDir: 'ASC' | 'DESC'; conditionIds?: string[]; slugPatterns?: string[]; wallets?: string[]; since?: number; until?: number; limit?: number; } export interface LeaderboardCategory { name: string; slugs: string[]; } export interface MarketOverview { condition_id: string; market_title: string; positions: PositionSummary[]; total_volume: number; unique_wallets: number; } export interface ViewBackend { watchlistSummaryRows(): Array<{ wallet: string; label: string; position_count: number; total_pnl: number; total_value: number; last_active: number | null; }>; walletDashboardData(wallet: string): { positions: PositionSummary[]; recent_trades: TradeRow[]; }; walletPositions(wallet: string): PositionSummary[]; walletTokenIds(wallet: string): string[]; walletTokenTrades(wallet: string, tokenId: string): TradeRow[]; getBackfillState(entityType: string, entityId: string): { status: string; } | null; leaderboardRows(metric: LeaderboardMetric): Array<{ wallet: string; label: string; value: number; }>; marketOverviewData(conditionId: string): { market_title: string; positions: PositionSummary[]; total_volume: number; unique_wallets: number; }; composableLeaderboard(query: LeaderboardQuery): Array<{ wallet: string; label: string; metrics: Record; }>; } export declare function buildWatchlistSummary(backend: ViewBackend): WatchlistSummaryEntry[]; export declare function buildWalletDashboard(backend: ViewBackend, wallet: string): WalletDashboard; /** * Compute realized P&L from cached trade history and position data. * * Two sources of realized P&L: * 1. Trade-based: when trades include both buys and sells, compute via weighted avg cost basis * 2. Position-based: use Polymarket's precomputed `realized_pnl` from cached positions * (covers redemptions and resolved markets where no sell trade exists) * * For each token, we use trade-based P&L if sells exist, otherwise fall back to * the position's `realized_pnl` field. */ export declare function computeRealizedPnl(backend: ViewBackend, wallet: string): RealizedPnlResult; export declare function buildLeaderboard(backend: ViewBackend, metric: LeaderboardMetric): LeaderboardEntry[]; export declare function buildMarketOverview(backend: ViewBackend, conditionId: string): MarketOverview; //# sourceMappingURL=views.d.ts.map