UNPKG

betfair-node

Version:

A comprehensive Node.js TypeScript library for the Betfair Exchange API, providing both JSON-RPC API integration and real-time Exchange Stream API support for automated betting and trading applications.

73 lines 2.5 kB
import { ConnectionMessage, CurrencyRate, MarketCache, MarketChangeMessage, StatusMessage, OrderChangeMessage, OrderAccountCache } from './betfair-exchange-stream-api-types'; export interface StreamDecoderState { marketCache: { [key: string]: MarketCache; }; orderCache: { [key: string]: OrderAccountCache; }; currencyRate: CurrencyRate; deltas: string[]; orderDeltas: string[]; subscribedMarkets: string[]; segmentBuffer: { marketSegments: { [requestId: string]: Partial<MarketChangeMessage>[]; }; orderSegments: { [requestId: string]: Partial<OrderChangeMessage>[]; }; }; } export interface StreamDecoderCallbacks { onMarketChange: (marketCache: { [key: string]: MarketCache; }, deltas: string[]) => void; onOrderChange?: (orderCache: { [key: string]: OrderAccountCache; }, deltas: string[]) => void; onStatus: (statusMessage: StatusMessage) => void; onConnection: (connectionMessage: ConnectionMessage) => void; onHeartbeat: () => void; } /** * Creates initial stream decoder state */ export declare const createStreamDecoderState: (currencyRate: CurrencyRate, subscribedMarkets?: string[]) => StreamDecoderState; /** * Processes received data packet */ export declare const processDataPacket: (state: StreamDecoderState, callbacks: StreamDecoderCallbacks, packet: string) => StreamDecoderState; /** * Clears the market cache */ export declare const clearMarketCache: (state: StreamDecoderState) => StreamDecoderState; /** * Updates the currency rate */ export declare const updateCurrencyRate: (state: StreamDecoderState, currencyRate: CurrencyRate) => StreamDecoderState; /** * Updates subscribed markets */ export declare const updateSubscribedMarkets: (state: StreamDecoderState, markets: string[]) => StreamDecoderState; /** * Gets the current market cache */ export declare const getMarketCache: (state: StreamDecoderState) => { [key: string]: MarketCache; }; /** * Resets the stream decoder state */ export declare const resetStreamDecoder: (state: StreamDecoderState) => StreamDecoderState; /** * Gets the current order cache */ export declare const getOrderCache: (state: StreamDecoderState) => { [key: string]: OrderAccountCache; }; /** * Clears the order cache */ export declare const clearOrderCache: (state: StreamDecoderState) => StreamDecoderState; //# sourceMappingURL=betfair-stream-decoder.d.ts.map