tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
125 lines • 4.22 kB
TypeScript
import { CircularBuffer } from '../handy';
import { BookChange, Exchange, BookTicker, Trade } from '../types';
import { Mapper } from './mapper';
export declare class KucoinTradesMapper implements Mapper<'kucoin', Trade> {
private readonly _exchange;
constructor(_exchange: Exchange);
canHandle(message: KucoinTradeMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "market/match";
readonly symbols: string[] | undefined;
}[];
map(message: KucoinTradeMessage, localTimestamp: Date): IterableIterator<Trade>;
}
export declare class KucoinBookChangeMapper implements Mapper<'kucoin', BookChange> {
protected readonly _exchange: Exchange;
private readonly ignoreBookSnapshotOverlapError;
protected readonly symbolToDepthInfoMapping: {
[key: string]: LocalDepthInfo;
};
constructor(_exchange: Exchange, ignoreBookSnapshotOverlapError: boolean);
canHandle(message: KucoinLevel2SnapshotMessage | KucoinLevel2UpdateMessage): boolean;
getFilters(symbols?: string[]): ({
readonly channel: "market/level2";
readonly symbols: string[] | undefined;
} | {
readonly channel: "market/level2Snapshot";
readonly symbols: string[] | undefined;
})[];
map(message: KucoinLevel2SnapshotMessage | KucoinLevel2UpdateMessage, localTimestamp: Date): Generator<BookChange, void, unknown>;
protected mapBookDepthUpdate(l2UpdateMessage: KucoinLevel2UpdateMessage, localTimestamp: Date): BookChange | undefined;
private mapBookLevel;
private nonZeroLevels;
}
export declare class KucoinBookTickerMapper implements Mapper<'kucoin', BookTicker> {
protected readonly _exchange: Exchange;
constructor(_exchange: Exchange);
canHandle(message: KucoinTickerMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "market/ticker";
readonly symbols: string[] | undefined;
}[];
map(message: KucoinTickerMessage, localTimestamp: Date): Generator<BookTicker, void, unknown>;
}
type KucoinTickerMessage = {
type: 'message';
topic: '/market/ticker:ADA-USDT';
subject: 'trade.ticker';
data: {
bestAsk: '0.549931';
bestAskSize: '966.4756';
bestBid: '0.549824';
bestBidSize: '1050';
price: '0.549825';
sequence: '1623526404099';
size: '1';
time: 1660608019871;
};
};
type KucoinTradeMessage = {
type: 'message';
topic: '/market/match:BTC-USDT';
subject: 'trade.l3match';
data: {
symbol: 'BTC-USDT';
side: 'sell';
type: 'match';
makerOrderId: '62fadde41add68000167fb58';
sequence: '1636276321894';
size: '0.00001255';
price: '24093.9';
takerOrderId: '62faddfff0476c0001c86c71';
time: '1660608000026914990';
tradeId: '62fade002e113d292303a18b';
};
};
type LocalDepthInfo = {
bufferedUpdates: CircularBuffer<KucoinLevel2UpdateMessage>;
snapshotProcessed?: boolean;
lastUpdateId?: number;
validatedFirstUpdate?: boolean;
};
type KucoinLevel2SnapshotMessage = {
type: 'message';
generated: true;
topic: '/market/level2Snapshot:BTC-USDT';
subject: 'trade.l2Snapshot';
code: '200000';
data: {
time: 1660608003710;
sequence: '1636276324355';
bids: [string, string][] | null;
asks: [string, string][] | null;
};
};
type KucoinLevel2UpdateMessage = {
type: 'message';
topic: '/market/level2:BTC-USDT';
subject: 'trade.l2update';
data: {
sequenceStart: 1636276324710;
symbol: 'BTC-USDT';
changes: {
asks: [string, string, string][];
bids: [string, string, string][];
};
sequenceEnd: 1636276324710;
time: undefined;
};
} | {
type: 'message';
topic: '/market/level2:BTC-USDT';
subject: 'trade.l2update';
data: {
changes: {
asks: [];
bids: [['27309.8', '0.35127929', '8005280396']];
};
sequenceEnd: 8005280396;
sequenceStart: 8005280396;
symbol: 'BTC-USDT';
time: 1685578980002;
};
};
export {};
//# sourceMappingURL=kucoin.d.ts.map