tardis-dev
Version:
Convenient access to tick-level historical and real-time cryptocurrency market data via Node.js
476 lines • 14.9 kB
TypeScript
import { BookChange, BookTicker, DerivativeTicker, Exchange, Liquidation, OptionSummary, Trade } from '../types';
import { Mapper } from './mapper';
export declare class OkexV5TradesMapper implements Mapper<OKEX_EXCHANGES, Trade> {
private readonly _exchange;
private readonly _useTradesAll;
constructor(_exchange: Exchange, _useTradesAll: boolean);
canHandle(message: any): boolean;
getFilters(symbols?: string[]): {
channel: "trades-all";
symbols: string[] | undefined;
}[] | {
channel: "trades";
symbols: string[] | undefined;
}[];
map(okexTradesMessage: OkexV5TradeMessage | OkexV5TradesAllMessage, localTimestamp: Date): IterableIterator<Trade>;
}
export declare class OkexV5BookChangeMapper implements Mapper<OKEX_EXCHANGES, BookChange> {
private readonly _exchange;
private _channelName;
constructor(_exchange: Exchange, usePublicBooksChannel: boolean);
canHandle(message: any): boolean;
private _hasCredentials;
private _hasVip5Access;
private _hasColoAccess;
private _getBooksChannelName;
getFilters(symbols?: string[]): {
channel: any;
symbols: string[] | undefined;
}[];
map(okexDepthDataMessage: OkexV5BookMessage, localTimestamp: Date): IterableIterator<BookChange>;
}
export declare class OkexV5BookTickerMapper implements Mapper<OKEX_EXCHANGES, BookTicker> {
private readonly _exchange;
private readonly _useTbtTickerChannel;
constructor(_exchange: Exchange, _useTbtTickerChannel: boolean);
canHandle(message: any): boolean;
getFilters(symbols?: string[]): {
channel: "bbo-tbt";
symbols: string[] | undefined;
}[] | {
channel: "tickers";
symbols: string[] | undefined;
}[];
map(message: OkexV5TickerMessage | OkexBBOTbtData, localTimestamp: Date): IterableIterator<BookTicker>;
private _mapFromTbtTicker;
private _mapFromTicker;
}
export declare class OkexV5DerivativeTickerMapper implements Mapper<'okex-futures' | 'okex-swap', DerivativeTicker> {
private readonly _exchange;
private readonly pendingTickerInfoHelper;
private readonly _indexPrices;
private _futuresChannels;
private _swapChannels;
constructor(_exchange: Exchange);
canHandle(message: any): boolean;
getFilters(symbols?: string[]): ({
channel: "index-tickers";
symbols: string[] | undefined;
} | {
channel: "tickers" | "open-interest" | "mark-price" | "funding-rate";
symbols: string[] | undefined;
})[];
map(message: OkexV5TickerMessage | OkexV5OpenInterestMessage | OkexV5MarkPriceMessage | OkexV5IndexTickerMessage | OkexV5FundingRateMessage, localTimestamp: Date): IterableIterator<DerivativeTicker>;
}
export declare class OkexV5LiquidationsMapper implements Mapper<OKEX_EXCHANGES, Liquidation> {
private readonly _exchange;
private _isFirstMessage;
constructor(_exchange: Exchange);
canHandle(message: any): boolean;
getFilters(symbols?: string[]): any[];
map(okexLiquidationMessage: OkexV5LiquidationMessage | OkexV5LiquidationOrderMessage, localTimestamp: Date): IterableIterator<Liquidation>;
}
export declare class OkexV5OptionSummaryMapper implements Mapper<'okex-options', OptionSummary> {
private readonly _indexPrices;
private readonly _openInterests;
private readonly _markPrices;
private readonly _tickers;
private readonly expiration_regex;
canHandle(message: any): boolean;
getFilters(symbols?: string[]): ({
readonly channel: "opt-summary";
readonly symbols: string[];
} | {
readonly channel: "index-tickers";
readonly symbols: string[] | undefined;
} | {
readonly channel: "tickers";
readonly symbols: string[] | undefined;
} | {
readonly channel: "open-interest";
readonly symbols: string[] | undefined;
} | {
readonly channel: "mark-price";
readonly symbols: string[] | undefined;
})[];
map(message: OkexV5SummaryMessage | OkexV5IndexTickerMessage | OkexV5TickerMessage | OkexV5OpenInterestMessage | OkexV5MarkPriceMessage, localTimestamp: Date): IterableIterator<OptionSummary> | undefined;
}
type OkexV5TradeMessage = {
arg: {
channel: 'trades';
instId: 'CRV-USDT';
};
data: [{
instId: 'CRV-USDT';
tradeId: '21300150';
px: '3.973';
sz: '13.491146';
side: 'buy';
ts: '1639999319938';
}];
};
type OkexV5TradesAllMessage = {
arg: {
channel: 'trades-all';
instId: string;
};
data: [{
instId: 'WAXP-USDT';
tradeId: '2251300';
px: '0.05566';
sz: '838.714488';
side: 'sell';
ts: '1697760000083';
}];
};
type OkexV5BookLevel = [string, string, string, string];
type OkexV5BookMessage = {
arg: {
channel: 'books-l2-tbt';
instId: string;
};
action: 'snapshot';
data: [
{
asks: OkexV5BookLevel[];
bids: OkexV5BookLevel[];
ts: string;
}
];
} | {
arg: {
channel: 'books-l2-tbt';
instId: string;
};
action: 'update';
data: [{
asks: OkexV5BookLevel[];
bids: OkexV5BookLevel[];
ts: string;
}];
};
type OkexV5TickerMessage = {
arg: {
channel: 'tickers';
instId: string;
};
data: [
{
instType: 'SPOT';
instId: 'ACT-USDT';
last: '0.00718';
lastSz: '8052.117146';
askPx: '0.0072';
askSz: '54969.407534';
bidPx: '0.00713';
bidSz: '4092.326';
open24h: '0.00717';
high24h: '0.00722';
low24h: '0.00696';
sodUtc0: '0.00714';
sodUtc8: '0.00721';
volCcy24h: '278377.765301';
vol24h: '39168761.49997';
ts: '1639999318686';
}
];
};
type OkexV5OpenInterestMessage = {
arg: {
channel: 'open-interest';
instId: string;
};
data: [{
instId: 'FIL-USDT-220325';
instType: 'FUTURES';
oi: '236870';
oiCcy: '23687';
ts: '1640131202886';
}];
};
type OkexV5MarkPriceMessage = {
arg: {
channel: 'mark-price';
instId: string;
};
data: [{
instId: 'FIL-USDT-220325';
instType: 'FUTURES';
markPx: '36.232';
ts: '1640131204676';
}];
};
type OkexV5IndexTickerMessage = {
arg: {
channel: 'index-tickers';
instId: string;
};
data: [
{
instId: 'FIL-USDT';
idxPx: '35.583';
open24h: '34.558';
high24h: '35.862';
low24h: '34.529';
sodUtc0: '35.309';
sodUtc8: '34.83';
ts: '1640140200581';
}
];
};
type OkexV5FundingRateMessage = {
arg: {
channel: 'funding-rate';
instId: string;
};
data: [{
fundingRate: '0.00048105' | undefined;
fundingTime: '1640131200000';
instId: string;
instType: 'SWAP';
nextFundingRate: '';
}];
};
type OkexV5LiquidationMessage = {
arg: {
channel: 'liquidations';
instId: 'BTC-USDT-211231';
generated: true;
};
data: [{
bkLoss: '0';
bkPx: '49674.2';
ccy: '';
posSide: 'short';
side: 'buy';
sz: '40';
ts: '1640140211925';
}];
};
type OkexV5LiquidationOrderMessage = {
arg: {
channel: 'liquidation-orders';
instType: 'FUTURES';
};
data: [
{
details: [{
bkLoss: '0';
bkPx: '0.55205';
ccy: '';
posSide: 'short';
side: 'buy';
sz: '39';
ts: '1680173247614';
}];
instFamily: 'XRP-USD';
instId: 'XRP-USD-230929';
instType: 'FUTURES';
uly: 'XRP-USD';
}
];
};
type OkexV5SummaryMessage = {
arg: {
channel: 'opt-summary';
uly: 'ETH-USD';
};
data: [
{
instType: 'OPTION';
instId: 'ETH-USD-211222-4000-C';
uly: 'ETH-USD';
delta: '0.1975745164';
gamma: '4.7290833601';
vega: '0.0002005415';
theta: '-0.004262964';
lever: '162.472613953';
markVol: '0.7794507758';
bidVol: '0.7421960156';
askVol: '0.8203208593';
realVol: '';
deltaBS: '0.2038286081';
gammaBS: '0.0013437829';
thetaBS: '-16.4798150221';
vegaBS: '0.7647227087';
ts: '1640001659301';
}
];
};
export declare class OkexTradesMapper implements Mapper<OKEX_EXCHANGES, Trade> {
private readonly _exchange;
private readonly _market;
constructor(_exchange: Exchange, _market: OKEX_MARKETS);
canHandle(message: OkexDataMessage): boolean;
getFilters(symbols?: string[]): {
channel: "spot/trade" | "futures/trade" | "swap/trade" | "option/trade";
symbols: string[] | undefined;
}[];
map(okexTradesMessage: OKexTradesDataMessage, localTimestamp: Date): IterableIterator<Trade>;
}
export declare class OkexBookChangeMapper implements Mapper<OKEX_EXCHANGES, BookChange> {
private readonly _exchange;
private readonly _market;
private readonly _canUseTickByTickChannel;
constructor(_exchange: Exchange, _market: OKEX_MARKETS, _canUseTickByTickChannel: boolean);
canHandle(message: OkexDataMessage): boolean;
getFilters(symbols?: string[]): ({
readonly channel: "spot/depth_l2_tbt" | "futures/depth_l2_tbt" | "swap/depth_l2_tbt" | "option/depth_l2_tbt";
readonly symbols: string[] | undefined;
} | {
readonly channel: "spot/depth" | "futures/depth" | "swap/depth" | "option/depth";
readonly symbols: string[] | undefined;
})[];
map(okexDepthDataMessage: OkexDepthDataMessage, localTimestamp: Date): IterableIterator<BookChange>;
}
export declare class OkexDerivativeTickerMapper implements Mapper<'okex-futures' | 'okex-swap', DerivativeTicker> {
private readonly _exchange;
private readonly pendingTickerInfoHelper;
private _futuresChannels;
private _swapChannels;
constructor(_exchange: Exchange);
canHandle(message: OkexDataMessage): boolean;
getFilters(symbols?: string[]): any[];
map(message: OkexTickersMessage | OkexFundingRateMessage | OkexMarkPriceMessage, localTimestamp: Date): IterableIterator<DerivativeTicker>;
}
export declare class OkexOptionSummaryMapper implements Mapper<'okex-options', OptionSummary> {
private readonly _indexPrices;
private readonly expiration_regex;
canHandle(message: OkexDataMessage): boolean;
getFilters(symbols?: string[]): ({
readonly channel: "option/summary";
readonly symbols: string[] | undefined;
} | {
readonly channel: "index/ticker";
readonly symbols: string[] | undefined;
})[];
map(message: OkexOptionSummaryData | OkexIndexData, localTimestamp: Date): IterableIterator<OptionSummary> | undefined;
}
export declare class OkexLiquidationsMapper implements Mapper<OKEX_EXCHANGES, Liquidation> {
private readonly _exchange;
private readonly _market;
constructor(_exchange: Exchange, _market: OKEX_MARKETS);
canHandle(message: OkexDataMessage): boolean;
getFilters(symbols?: string[]): any[];
map(okexLiquidationDataMessage: OkexLiqudationDataMessage, localTimestamp: Date): IterableIterator<Liquidation>;
}
export declare class OkexBookTickerMapper implements Mapper<OKEX_EXCHANGES, BookTicker> {
private readonly _exchange;
private readonly _market;
constructor(_exchange: Exchange, _market: OKEX_MARKETS);
canHandle(message: OkexDataMessage): boolean;
getFilters(symbols?: string[]): any[];
map(message: OkexTickersMessage, localTimestamp: Date): IterableIterator<BookTicker>;
}
type OkexDataMessage = {
table: string;
};
type OKexTradesDataMessage = {
data: {
side: 'buy' | 'sell';
trade_id: string | number;
price: string | number;
qty?: string | number;
size?: string | number;
instrument_id: string;
timestamp: string;
}[];
};
type OkexLiqudationDataMessage = {
data: {
loss: string;
size: string;
price: string;
created_at: string;
type: string;
instrument_id: string;
}[];
};
type OkexTickersMessage = {
data: {
last: string | number;
best_bid: string | number;
best_ask: string | number;
open_interest: string | undefined;
instrument_id: string;
timestamp: string;
best_bid_size: string | undefined;
best_ask_size: string | undefined;
}[];
};
type OkexFundingRateMessage = {
data: {
funding_rate: string;
funding_time: string;
estimated_rate?: string;
instrument_id: string;
timestamp: undefined;
}[];
};
type OkexMarkPriceMessage = {
data: {
instrument_id: string;
mark_price: string;
timestamp: string;
}[];
};
type OkexDepthDataMessage = {
action: 'partial' | 'update';
data: {
instrument_id: string;
asks: OkexBookLevel[];
bids: OkexBookLevel[];
timestamp: string;
}[];
};
type OkexBookLevel = [number | string, number | string, number | string, number | string];
type OKEX_EXCHANGES = 'okex' | 'okcoin' | 'okex-futures' | 'okex-swap' | 'okex-options';
type OKEX_MARKETS = 'spot' | 'swap' | 'futures' | 'option';
type OkexIndexData = {
table: 'index/ticker';
data: [
{
last: number;
instrument_id: string;
}
];
};
type OkexOptionSummaryData = {
table: 'option/summary';
data: [
{
instrument_id: string;
underlying: string;
best_ask: string;
best_bid: string;
best_ask_size: string;
best_bid_size: string;
change_rate: string;
delta: string;
gamma: string;
bid_vol: string;
ask_vol: string;
mark_vol: string;
last: string;
leverage: string;
mark_price: string;
theta: string;
vega: string;
open_interest: string;
timestamp: string;
}
];
};
type OkexBBOTbtData = {
arg: {
channel: 'bbo-tbt';
instId: 'WAVES-USDT-SWAP';
};
data: [{
asks: [['16.083', '65', '0', '1']];
bids: [['16.082', '143', '0', '4']];
ts: '1651750920000';
}];
};
export {};
//# sourceMappingURL=okex.d.ts.map