Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tardis-dev

Package Overview
Dependencies
Maintainers
1
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tardis-dev - npm Package Compare versions

Comparing version 10.0.20 to 10.0.21

2

dist/consts.d.ts

@@ -19,3 +19,3 @@ export declare const EXCHANGES: readonly ["bitmex", "deribit", "binance-futures", "binance", "ftx", "okex-futures", "okex-options", "okex-swap", "okex", "huobi-dm", "huobi-dm-swap", "huobi", "bitfinex-derivatives", "bitfinex", "bitfinex-alts", "bitflyer", "cryptofacilities", "kraken", "bitstamp", "coinbase", "gemini", "coinflex", "bybit", "phemex", "okcoin", "hitbtc", "binance-jersey", "binance-us", "binance-dex"];

'bitfinex-alts': readonly ["trades", "book"];
ftx: readonly ["orderbook", "trades"];
ftx: readonly ["orderbook", "trades", "instrument"];
gemini: readonly ["trade", "l2_updates", "auction_open", "auction_indicative", "auction_result"];

@@ -22,0 +22,0 @@ bitflyer: readonly ["lightning_executions", "lightning_board_snapshot", "lightning_board", "lightning_ticker"];

@@ -116,6 +116,16 @@ "use strict";

const CRYPTOFACILITIES_CHANNELS = ['trade', 'trade_snapshot', 'book', 'book_snapshot', 'ticker', 'heartbeat'];
const FTX_CHANNELS = ['orderbook', 'trades'];
const FTX_CHANNELS = ['orderbook', 'trades', 'instrument'];
const GEMINI_CHANNELS = ['trade', 'l2_updates', 'auction_open', 'auction_indicative', 'auction_result'];
const BITFLYER_CHANNELS = ['lightning_executions', 'lightning_board_snapshot', 'lightning_board', 'lightning_ticker'];
const BINANCE_FUTURES_CHANNELS = ['trade', 'aggTrade', 'ticker', 'depth', 'markPrice', 'depthSnapshot', 'bookTicker', 'forceOrder'];
const BINANCE_FUTURES_CHANNELS = [
'trade',
'aggTrade',
'ticker',
'depth',
'markPrice',
'depthSnapshot',
'bookTicker',
'forceOrder',
'openInterest'
];
const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'status'];

@@ -122,0 +132,0 @@ const HUOBI_CHANNELS = ['depth', 'detail', 'trade', 'bbo'];

@@ -54,3 +54,3 @@ import { BookChange, DerivativeTicker, Exchange, FilterForExchange, Trade } from '../types';

getFilters(symbols?: string[]): FilterForExchange['binance-futures'][];
map(message: BinanceResponse<BinanceFuturesMarkPriceData | BinanceFuturesTickerData>, localTimestamp: Date): IterableIterator<DerivativeTicker>;
map(message: BinanceResponse<BinanceFuturesMarkPriceData | BinanceFuturesTickerData | BinanceFuturesOpenInterestData>, localTimestamp: Date): IterableIterator<DerivativeTicker>;
}

@@ -106,3 +106,7 @@ declare type BinanceResponse<T> = {

};
declare type BinanceFuturesOpenInterestData = {
symbol: string;
openInterest: string;
};
export {};
//# sourceMappingURL=binance.d.ts.map

@@ -247,3 +247,3 @@ "use strict";

}
return message.stream.includes('@markPrice') || message.stream.endsWith('@ticker');
return message.stream.includes('@markPrice') || message.stream.endsWith('@ticker') || message.stream.endsWith('@openInterest');
}

@@ -260,2 +260,6 @@ getFilters(symbols) {

symbols
},
{
channel: 'openInterest',
symbols
}

@@ -265,3 +269,3 @@ ];

*map(message, localTimestamp) {
const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo(message.data.s, 'binance-futures');
const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo('s' in message.data ? message.data.s : message.data.symbol, 'binance-futures');
if ('r' in message.data) {

@@ -277,2 +281,5 @@ pendingTickerInfo.updateFundingRate(Number(message.data.r));

}
if ('openInterest' in message.data) {
pendingTickerInfo.updateOpenInterest(Number(message.data.openInterest));
}
if (pendingTickerInfo.hasChanged()) {

@@ -279,0 +286,0 @@ yield pendingTickerInfo.getSnapshot(localTimestamp);

@@ -1,2 +0,2 @@

import { BookChange, Trade } from '../types';
import { BookChange, Trade, DerivativeTicker } from '../types';
import { Mapper } from './mapper';

@@ -9,4 +9,30 @@ export declare const ftxTradesMapper: Mapper<'ftx', Trade>;

export declare const ftxBookChangeMapper: Mapper<'ftx', BookChange>;
export declare class FTXDerivativeTickerMapper implements Mapper<'ftx', DerivativeTicker> {
private readonly pendingTickerInfoHelper;
canHandle(message: FTXInstrument): boolean;
getFilters(symbols?: string[]): {
readonly channel: "instrument";
readonly symbols: string[] | undefined;
}[];
map(message: FTXInstrument, localTimestamp: Date): IterableIterator<DerivativeTicker>;
}
declare type FtxBookLevel = [number, number];
declare type FTXInstrument = {
channel: 'instrument';
market: string;
type: 'update';
data: {
stats: {
nextFundingRate?: number;
nextFundingTime?: string;
openInterest: number;
};
info: {
last: number;
mark: number;
index: number;
};
};
};
export {};
//# sourceMappingURL=ftx.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const handy_1 = require("../handy");
const mapper_1 = require("./mapper");
// https://docs.ftx.com/#websocket-api

@@ -73,2 +74,38 @@ exports.ftxTradesMapper = {

};
class FTXDerivativeTickerMapper {
constructor() {
this.pendingTickerInfoHelper = new mapper_1.PendingTickerInfoHelper();
}
canHandle(message) {
if (message.data == undefined) {
return false;
}
return message.channel === 'instrument';
}
getFilters(symbols) {
return [
{
channel: 'instrument',
symbols
}
];
}
*map(message, localTimestamp) {
const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo(message.market, 'ftx');
const { stats, info } = message.data;
if (stats.nextFundingTime !== undefined) {
pendingTickerInfo.updateFundingTimestamp(new Date(stats.nextFundingTime));
pendingTickerInfo.updateFundingRate(stats.nextFundingRate);
}
pendingTickerInfo.updateIndexPrice(info.index);
pendingTickerInfo.updateMarkPrice(info.mark);
pendingTickerInfo.updateLastPrice(info.last);
pendingTickerInfo.updateOpenInterest(stats.openInterest);
pendingTickerInfo.updateTimestamp(localTimestamp);
if (pendingTickerInfo.hasChanged()) {
yield pendingTickerInfo.getSnapshot(localTimestamp);
}
}
}
exports.FTXDerivativeTickerMapper = FTXDerivativeTickerMapper;
//# sourceMappingURL=ftx.js.map

@@ -6,3 +6,3 @@ import { BookChange, DerivativeTicker, Trade } from '../types';

export declare const normalizeBookChanges: <T extends "bitmex" | "deribit" | "binance-futures" | "binance" | "ftx" | "okex-futures" | "okex-options" | "okex-swap" | "okex" | "huobi-dm" | "huobi-dm-swap" | "huobi" | "bitfinex-derivatives" | "bitfinex" | "bitfinex-alts" | "bitflyer" | "cryptofacilities" | "kraken" | "bitstamp" | "coinbase" | "gemini" | "bybit" | "phemex" | "okcoin" | "hitbtc" | "binance-jersey" | "binance-us" | "binance-dex">(exchange: T, localTimestamp: Date) => Mapper<T, BookChange>;
export declare const normalizeDerivativeTickers: <T extends "bitmex" | "deribit" | "binance-futures" | "okex-futures" | "okex-swap" | "bitfinex-derivatives" | "cryptofacilities" | "bybit" | "phemex">(exchange: T, _localTimestamp: Date) => Mapper<T, DerivativeTicker>;
export declare const normalizeDerivativeTickers: <T extends "bitmex" | "deribit" | "binance-futures" | "ftx" | "okex-futures" | "okex-swap" | "bitfinex-derivatives" | "cryptofacilities" | "bybit" | "phemex">(exchange: T, _localTimestamp: Date) => Mapper<T, DerivativeTicker>;
//# sourceMappingURL=index.d.ts.map

@@ -98,3 +98,4 @@ "use strict";

bybit: () => new bybit_1.BybitDerivativeTickerMapper(),
phemex: () => new phemex_1.PhemexDerivativeTickerMapper()
phemex: () => new phemex_1.PhemexDerivativeTickerMapper(),
ftx: () => new ftx_1.FTXDerivativeTickerMapper()
};

@@ -101,0 +102,0 @@ exports.normalizeTrades = (exchange, _localTimestamp) => {

{
"name": "tardis-dev",
"version": "10.0.20",
"version": "10.0.21",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=12"

@@ -128,3 +128,3 @@ export const EXCHANGES = [

const FTX_CHANNELS = ['orderbook', 'trades'] as const
const FTX_CHANNELS = ['orderbook', 'trades', 'instrument'] as const

@@ -135,3 +135,13 @@ const GEMINI_CHANNELS = ['trade', 'l2_updates', 'auction_open', 'auction_indicative', 'auction_result'] as const

const BINANCE_FUTURES_CHANNELS = ['trade', 'aggTrade', 'ticker', 'depth', 'markPrice', 'depthSnapshot', 'bookTicker', 'forceOrder']
const BINANCE_FUTURES_CHANNELS = [
'trade',
'aggTrade',
'ticker',
'depth',
'markPrice',
'depthSnapshot',
'bookTicker',
'forceOrder',
'openInterest'
]

@@ -138,0 +148,0 @@ const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'status'] as const

@@ -83,3 +83,5 @@ import { debug } from '../debug'

export class BinanceBookChangeMapper implements Mapper<'binance' | 'binance-jersey' | 'binance-us' | 'binance-futures', BookChange> {
protected readonly symbolToDepthInfoMapping: { [key: string]: LocalDepthInfo } = {}
protected readonly symbolToDepthInfoMapping: {
[key: string]: LocalDepthInfo
} = {}

@@ -280,3 +282,3 @@ constructor(protected readonly exchange: Exchange, protected readonly ignoreBookSnapshotOverlapError: boolean) {}

return message.stream.includes('@markPrice') || message.stream.endsWith('@ticker')
return message.stream.includes('@markPrice') || message.stream.endsWith('@ticker') || message.stream.endsWith('@openInterest')
}

@@ -295,2 +297,6 @@

symbols
},
{
channel: 'openInterest',
symbols
}

@@ -301,6 +307,9 @@ ]

*map(
message: BinanceResponse<BinanceFuturesMarkPriceData | BinanceFuturesTickerData>,
message: BinanceResponse<BinanceFuturesMarkPriceData | BinanceFuturesTickerData | BinanceFuturesOpenInterestData>,
localTimestamp: Date
): IterableIterator<DerivativeTicker> {
const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo(message.data.s, 'binance-futures')
const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo(
's' in message.data ? message.data.s : message.data.symbol,
'binance-futures'
)

@@ -319,2 +328,6 @@ if ('r' in message.data) {

if ('openInterest' in message.data) {
pendingTickerInfo.updateOpenInterest(Number(message.data.openInterest))
}
if (pendingTickerInfo.hasChanged()) {

@@ -391,1 +404,6 @@ yield pendingTickerInfo.getSnapshot(localTimestamp)

}
type BinanceFuturesOpenInterestData = {
symbol: string
openInterest: string
}
import { parseμs } from '../handy'
import { BookChange, Trade } from '../types'
import { Mapper } from './mapper'
import { BookChange, Trade, DerivativeTicker } from '../types'
import { Mapper, PendingTickerInfoHelper } from './mapper'

@@ -87,2 +87,43 @@ // https://docs.ftx.com/#websocket-api

export class FTXDerivativeTickerMapper implements Mapper<'ftx', DerivativeTicker> {
private readonly pendingTickerInfoHelper = new PendingTickerInfoHelper()
canHandle(message: FTXInstrument) {
if (message.data == undefined) {
return false
}
return message.channel === 'instrument'
}
getFilters(symbols?: string[]) {
return [
{
channel: 'instrument',
symbols
} as const
]
}
*map(message: FTXInstrument, localTimestamp: Date): IterableIterator<DerivativeTicker> {
const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo(message.market, 'ftx')
const { stats, info } = message.data
if (stats.nextFundingTime !== undefined) {
pendingTickerInfo.updateFundingTimestamp(new Date(stats.nextFundingTime))
pendingTickerInfo.updateFundingRate(stats.nextFundingRate)
}
pendingTickerInfo.updateIndexPrice(info.index)
pendingTickerInfo.updateMarkPrice(info.mark)
pendingTickerInfo.updateLastPrice(info.last)
pendingTickerInfo.updateOpenInterest(stats.openInterest)
pendingTickerInfo.updateTimestamp(localTimestamp)
if (pendingTickerInfo.hasChanged()) {
yield pendingTickerInfo.getSnapshot(localTimestamp)
}
}
}
type FtxTrades = {

@@ -109,1 +150,19 @@ channel: 'trades'

}
type FTXInstrument = {
channel: 'instrument'
market: string
type: 'update'
data: {
stats: {
nextFundingRate?: number
nextFundingTime?: string
openInterest: number
}
info: {
last: number
mark: number
index: number
}
}
}

@@ -18,3 +18,3 @@ import { ONE_SEC_IN_MS } from '../handy'

import { deribitBookChangeMapper, DeribitDerivativeTickerMapper, deribitTradesMapper } from './deribit'
import { ftxBookChangeMapper, ftxTradesMapper } from './ftx'
import { ftxBookChangeMapper, ftxTradesMapper, FTXDerivativeTickerMapper } from './ftx'
import { geminiBookChangeMapper, geminiTradesMapper } from './gemini'

@@ -112,3 +112,4 @@ import { hitBtcBookChangeMapper, hitBtcTradesMapper } from './hitbtc'

bybit: () => new BybitDerivativeTickerMapper(),
phemex: () => new PhemexDerivativeTickerMapper()
phemex: () => new PhemexDerivativeTickerMapper(),
ftx: () => new FTXDerivativeTickerMapper()
}

@@ -115,0 +116,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc