export interface Candle {
    timestamp: number;
    open: number;
    high: number;
    low: number;
    close: number;
    volume: number;
}

export interface AccountSnapshot {
    profileId?: string;
    userId?: string;
    buying_power: number;
    cash: number;
    currency: string;
    timestamp: number;
}

export interface ExchangeCapabilities {
    fetchOpenOrders?: boolean;
    fetchClosedOrders?: boolean;
    shorting?: boolean;
    margin?: boolean;
    leverage?: boolean;
    tradingWindow?: boolean;
}

export interface ExchangeOrderCorrelation {
    subTag?: string;
    profileId?: string;
    tradeId?: string;
    intent?: 'ENTRY' | 'EXIT' | 'UNKNOWN';
}

export interface IExchangeConnector {
    getCapabilities(): ExchangeCapabilities;
    fetchOHLCV(symbol: string, timeframe: string, limit?: number): Promise<Candle[]>;
    placeOrder(
        symbol: string,
        side: 'buy' | 'sell',
        qty: number,
        type: 'market' | 'limit',
        price?: number,
        stopLoss?: number,
        takeProfit?: number,
        clientOrderId?: string,
        correlation?: ExchangeOrderCorrelation
    ): Promise<any>;
    getPosition(symbol: string): Promise<any>;
    getOrder?(orderId: string, symbol?: string): Promise<any>;
    fetchOpenOrders?(symbols?: string[]): Promise<any[]>;
    fetchClosedOrders?(
        symbols?: string[],
        options?: {
            after?: Date;
            limit?: number;
            maxPages?: number;
        }
    ): Promise<any[]>;
    cancelOrder?(orderId: string, symbol?: string): Promise<boolean>;
    fetchAccountSnapshot?(): Promise<AccountSnapshot | null>;
}
