tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
412 lines • 14.8 kB
TypeScript
import { BookChange, BookTicker, DerivativeTicker, Exchange, Liquidation, OptionSummary, Trade } from '../types';
import { Mapper } from './mapper';
export declare class BybitV5TradesMapper implements Mapper<'bybit' | 'bybit-spot' | 'bybit-options', Trade> {
private readonly _exchange;
constructor(_exchange: Exchange);
canHandle(message: BybitV5Trade): boolean;
getFilters(symbols?: string[]): {
readonly channel: "publicTrade";
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5Trade, localTimestamp: Date): IterableIterator<Trade>;
}
export declare class BybitV5BookChangeMapper implements Mapper<'bybit' | 'bybit-spot' | 'bybit-options', BookChange> {
protected readonly _exchange: Exchange;
private readonly _depth;
constructor(_exchange: Exchange, _depth: number);
canHandle(message: BybitV5OrderBookMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: `orderbook.${number}`;
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5OrderBookMessage, localTimestamp: Date): Generator<{
readonly type: "book_change";
readonly symbol: string;
readonly exchange: "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "binance-options" | "binance-european-options" | "binance" | "ftx" | "okex-futures" | "okex-options" | "okex-swap" | "okex" | "okex-spreads" | "huobi-dm" | "huobi-dm-swap" | "huobi-dm-linear-swap" | "huobi" | "bitfinex-derivatives" | "bitfinex" | "coinbase" | "coinbase-international" | "cryptofacilities" | "kraken" | "bitstamp" | "gemini" | "poloniex" | "bybit" | "bybit-spot" | "bybit-options" | "phemex" | "delta" | "ftx-us" | "binance-us" | "gate-io-futures" | "gate-io" | "okcoin" | "bitflyer" | "hitbtc" | "coinflex" | "binance-jersey" | "binance-dex" | "upbit" | "ascendex" | "dydx" | "dydx-v4" | "serum" | "mango" | "huobi-dm-options" | "star-atlas" | "crypto-com" | "crypto-com-derivatives" | "kucoin" | "kucoin-futures" | "bitnomial" | "woo-x" | "blockchain-com" | "bitget" | "bitget-futures" | "hyperliquid";
readonly isSnapshot: boolean;
readonly bids: {
price: number;
amount: number;
}[];
readonly asks: {
price: number;
amount: number;
}[];
readonly timestamp: Date;
readonly localTimestamp: Date;
}, void, unknown>;
private _mapBookLevel;
}
export declare class BybitV5BookTickerMapper implements Mapper<'bybit' | 'bybit-spot', BookTicker> {
protected readonly _exchange: Exchange;
private _snapshots;
constructor(_exchange: Exchange);
canHandle(message: BybitV5OrderBookMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "orderbook.1";
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5OrderBookMessage, localTimestamp: Date): Generator<BookTicker, void, unknown>;
}
export declare class BybitV5DerivativeTickerMapper implements Mapper<'bybit', DerivativeTicker> {
private readonly pendingTickerInfoHelper;
canHandle(message: BybitV5DerivTickerMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "tickers";
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5DerivTickerMessage, localTimestamp: Date): IterableIterator<DerivativeTicker>;
}
export declare class BybitV5LiquidationsMapper implements Mapper<'bybit', Liquidation> {
private readonly _exchange;
constructor(_exchange: Exchange);
canHandle(message: BybitV5LiquidationMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "liquidation";
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5LiquidationMessage, localTimestamp: Date): IterableIterator<Liquidation>;
}
export declare class BybitV5AllLiquidationsMapper implements Mapper<'bybit', Liquidation> {
private readonly _exchange;
constructor(_exchange: Exchange);
canHandle(message: BybitV5AllLiquidationMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "allLiquidation";
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5AllLiquidationMessage, localTimestamp: Date): IterableIterator<Liquidation>;
}
export declare class BybitV5OptionSummaryMapper implements Mapper<'bybit-options', OptionSummary> {
canHandle(message: BybitV5OptionTickerMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "tickers";
readonly symbols: string[] | undefined;
}[];
map(message: BybitV5OptionTickerMessage, localTimestamp: Date): Generator<OptionSummary, void, unknown>;
}
export declare class BybitTradesMapper implements Mapper<'bybit', Trade> {
private readonly _exchange;
constructor(_exchange: Exchange);
canHandle(message: BybitDataMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "trade";
readonly symbols: string[] | undefined;
}[];
map(message: BybitTradeDataMessage, localTimestamp: Date): IterableIterator<Trade>;
}
export declare class BybitBookChangeMapper implements Mapper<'bybit', BookChange> {
protected readonly _exchange: Exchange;
private readonly _canUseBook200Channel;
constructor(_exchange: Exchange, _canUseBook200Channel: boolean);
canHandle(message: BybitDataMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "orderBook_200";
readonly symbols: string[] | undefined;
}[] | {
readonly channel: "orderBookL2_25";
readonly symbols: string[] | undefined;
}[];
map(message: BybitBookSnapshotDataMessage | BybitBookSnapshotUpdateMessage, localTimestamp: Date): Generator<{
readonly type: "book_change";
readonly symbol: string;
readonly exchange: "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "binance-options" | "binance-european-options" | "binance" | "ftx" | "okex-futures" | "okex-options" | "okex-swap" | "okex" | "okex-spreads" | "huobi-dm" | "huobi-dm-swap" | "huobi-dm-linear-swap" | "huobi" | "bitfinex-derivatives" | "bitfinex" | "coinbase" | "coinbase-international" | "cryptofacilities" | "kraken" | "bitstamp" | "gemini" | "poloniex" | "bybit" | "bybit-spot" | "bybit-options" | "phemex" | "delta" | "ftx-us" | "binance-us" | "gate-io-futures" | "gate-io" | "okcoin" | "bitflyer" | "hitbtc" | "coinflex" | "binance-jersey" | "binance-dex" | "upbit" | "ascendex" | "dydx" | "dydx-v4" | "serum" | "mango" | "huobi-dm-options" | "star-atlas" | "crypto-com" | "crypto-com-derivatives" | "kucoin" | "kucoin-futures" | "bitnomial" | "woo-x" | "blockchain-com" | "bitget" | "bitget-futures" | "hyperliquid";
readonly isSnapshot: boolean;
readonly bids: {
price: number;
amount: number;
}[];
readonly asks: {
price: number;
amount: number;
}[];
readonly timestamp: Date;
readonly localTimestamp: Date;
}, void, unknown>;
private _mapBookLevel;
}
export declare class BybitDerivativeTickerMapper implements Mapper<'bybit', DerivativeTicker> {
private readonly pendingTickerInfoHelper;
canHandle(message: BybitDataMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "instrument_info";
readonly symbols: string[] | undefined;
}[];
map(message: BybitInstrumentDataMessage, localTimestamp: Date): IterableIterator<DerivativeTicker>;
}
export declare class BybitLiquidationsMapper implements Mapper<'bybit', Liquidation> {
private readonly _exchange;
constructor(_exchange: Exchange);
canHandle(message: BybitDataMessage): boolean;
getFilters(symbols?: string[]): {
readonly channel: "liquidation";
readonly symbols: string[] | undefined;
}[];
map(message: BybitLiquidationMessage | BybitLiquidationNativeMessage, localTimestamp: Date): IterableIterator<Liquidation>;
}
type BybitV5Trade = {
topic: 'publicTrade.LTCUSDT';
type: 'snapshot';
ts: 1680688979985;
data: [
{
T: 1680688979983;
s: 'LTCUSDT';
S: 'Buy';
v: '0.4';
p: '94.53';
L: 'ZeroMinusTick';
i: '4c7b6bdc-b4a3-5716-9c7b-bbe01dc7072f';
BT: false;
}
];
} | {
topic: 'publicTrade.BTCUSDC';
ts: 1680688980000;
type: 'snapshot';
data: [{
i: '2240000000041223438';
T: 1680688979998;
p: '28528.98';
v: '0.00433';
S: 'Buy';
s: 'BTCUSDC';
BT: false;
}];
} | {
id: 'publicTrade.BTC-3414637898-1680652922102';
topic: 'publicTrade.BTC';
ts: 1680652922102;
data: [
{
p: '985';
v: '0.01';
i: '0404c393-8419-5bac-95c3-5fea28404754';
T: 1680652922081;
BT: false;
s: 'BTC-28APR23-29500-C';
S: 'Sell';
}
];
type: 'snapshot';
};
type BybitV5OrderBookMessage = {
topic: 'orderbook.50.LTCUSD';
type: 'snapshot' | 'delta';
ts: 1680673822478;
data: {
s: string;
b: [string, string][];
a: [string, string][];
u: 11802648;
seq: 941860281;
};
};
type BybitV5DerivTickerMessage = {
topic: 'tickers.BTCUSD';
type: 'snapshot' | 'delta';
data: {
symbol: string;
lastPrice?: string;
markPrice?: string;
indexPrice?: string;
openInterest?: string;
openInterestValue?: string;
nextFundingTime?: string;
fundingRate?: string;
bid1Price?: string;
bid1Size?: string;
ask1Price?: string;
ask1Size?: string;
};
cs: 20856433578;
ts: 1680673822577;
};
type BybitV5LiquidationMessage = {
data: {
price: '0.03803';
side: 'Buy';
size: '1637';
symbol: 'GALAUSDT';
updatedTime: 1673251091822;
};
topic: 'liquidation.GALAUSDT';
ts: 1673251091822;
type: 'snapshot';
};
type BybitV5AllLiquidationMessage = {
topic: 'allLiquidation.KAITOUSDT';
type: 'snapshot';
ts: 1740480190078;
data: [{
T: 1740480189987;
s: 'KAITOUSDT';
S: 'Buy';
v: '43';
p: '1.7531';
}];
};
type BybitV5OptionTickerMessage = {
id: 'tickers.ETH-30JUN23-200-P-3164908233-1680652859919';
topic: 'tickers.ETH-30JUN23-200-P';
ts: 1680652859919;
data: {
symbol: 'ETH-30JUN23-200-P';
bidPrice: '0.1';
bidSize: '5';
bidIv: '1.4744';
askPrice: '0';
askSize: '0';
askIv: '0';
lastPrice: '1';
highPrice24h: '0';
lowPrice24h: '0';
markPrice: '0.2548522';
indexPrice: '1871.27';
markPriceIv: '1.5991';
underlyingPrice: '1886.16';
openInterest: '231.5';
turnover24h: '0';
volume24h: '0';
totalVolume: '232';
totalTurnover: '362305';
delta: '-0.00052953';
gamma: '0.00000128';
vega: '0.01719155';
theta: '-0.0159208';
predictedDeliveryPrice: '0';
change24h: '0';
};
type: 'snapshot';
};
type BybitDataMessage = {
topic: string;
};
type BybitTradeDataMessage = (BybitDataMessage & {
data: {
timestamp: string;
trade_time_ms?: number | string;
symbol: string;
side: 'Buy' | 'Sell';
size: number;
price: number | string;
trade_id: string;
}[];
}) | {
topic: 'trade.BTCPERP';
data: [
{
symbol: 'BTCPERP';
tickDirection: 'PlusTick';
price: '21213.00';
size: 0.007;
timestamp: '2022-06-21T09:36:58.000Z';
tradeTimeMs: '1655804218524';
side: 'Sell';
tradeId: '7aad7741-f763-5f78-bf43-c38b29a40f67';
}
];
};
type BybitBookLevel = {
price: string;
side: 'Buy' | 'Sell';
size?: number;
};
type BybitBookSnapshotDataMessage = BybitDataMessage & {
type: 'snapshot';
data: BybitBookLevel[] | {
order_book: BybitBookLevel[];
} | {
orderBook: BybitBookLevel[];
};
timestamp_e6: number | string;
timestampE6: number | string;
};
type BybitBookSnapshotUpdateMessage = BybitDataMessage & {
type: 'delta';
data: {
delete: BybitBookLevel[];
update: BybitBookLevel[];
insert: BybitBookLevel[];
};
timestamp_e6: number | string;
timestampE6: number | string;
};
type BybitInstrumentUpdate = {
symbol: string;
mark_price_e4?: number;
mark_price?: string;
index_price_e4?: string;
index_price?: string;
open_interest?: number;
open_interest_e8?: number;
funding_rate_e6?: string;
predicted_funding_rate_e6?: number;
next_funding_time?: string;
last_price_e4?: string;
last_price?: string;
updated_at: string;
lastPriceE4: '212130000';
lastPrice: '21213.00';
lastTickDirection: 'PlusTick';
prevPrice24hE4: '207180000';
prevPrice24h: '20718.00';
price24hPcntE6: '23892';
highPrice24hE4: '214085000';
highPrice24h: '21408.50';
lowPrice24hE4: '198005000';
lowPrice24h: '19800.50';
prevPrice1hE4: '213315000';
prevPrice1h: '21331.50';
price1hPcntE6: '-5555';
markPriceE4: '212094700';
markPrice: '21209.47';
indexPriceE4: '212247200';
indexPrice: '21224.72';
openInterestE8: '18317600000';
totalTurnoverE8: '94568739311650000';
turnover24hE8: '1375880657550000';
totalVolumeE8: '2734659400000';
volume24hE8: '66536799999';
fundingRateE6: '-900';
predictedFundingRateE6: '-614';
crossSeq: '385207672';
createdAt: '1970-01-01T00:00:00.000Z';
updatedAt: '2022-06-21T09:36:58.000Z';
nextFundingTime: '2022-06-21T16:00:00Z';
countDownHour: '7';
bid1PriceE4: '212130000';
bid1Price: '21213.00';
ask1PriceE4: '212135000';
ask1Price: '21213.50';
};
type BybitInstrumentDataMessage = BybitDataMessage & {
timestamp_e6: string;
timestampE6: string;
data: BybitInstrumentUpdate | {
update: [BybitInstrumentUpdate];
};
};
type BybitLiquidationMessage = BybitDataMessage & {
generated: true;
data: {
id: number;
qty: number;
side: 'Sell' | 'Buy';
time: number;
symbol: string;
price: number;
}[];
};
type BybitLiquidationNativeMessage = BybitDataMessage & {
generated: undefined;
data: {
symbol: string;
side: 'Sell' | 'Buy';
price: string;
qty: string;
time: number;
};
};
export {};
//# sourceMappingURL=bybit.d.ts.map