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.1.2 to 10.1.3

8

dist/consts.d.ts

@@ -17,9 +17,9 @@ 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"];

'binance-us': readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker"];
bitfinex: readonly ["trades", "book"];
'bitfinex-alts': readonly ["trades", "book"];
ftx: readonly ["orderbook", "trades", "instrument"];
bitfinex: readonly ["trades", "book", "raw_book"];
'bitfinex-alts': readonly ["trades", "book", "raw_book"];
ftx: readonly ["orderbook", "trades", "instrument", "markets"];
gemini: readonly ["trade", "l2_updates", "auction_open", "auction_indicative", "auction_result"];
bitflyer: readonly ["lightning_executions", "lightning_board_snapshot", "lightning_board", "lightning_ticker"];
'binance-futures': string[];
'bitfinex-derivatives': readonly ["trades", "book", "status"];
'bitfinex-derivatives': readonly ["trades", "book", "raw_book", "status", "liquidations"];
huobi: readonly ["depth", "detail", "trade", "bbo"];

@@ -26,0 +26,0 @@ 'huobi-dm': readonly ["depth", "detail", "trade"];

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

const BINANCE_DEX_CHANNELS = ['trades', 'marketDiff', 'depthSnapshot'];
const BITFINEX_CHANNELS = ['trades', 'book'];
const BITFINEX_CHANNELS = ['trades', 'book', 'raw_book'];
const BITMEX_CHANNELS = [

@@ -117,3 +117,3 @@ 'trade',

const CRYPTOFACILITIES_CHANNELS = ['trade', 'trade_snapshot', 'book', 'book_snapshot', 'ticker', 'heartbeat'];
const FTX_CHANNELS = ['orderbook', 'trades', 'instrument'];
const FTX_CHANNELS = ['orderbook', 'trades', 'instrument', 'markets'];
const GEMINI_CHANNELS = ['trade', 'l2_updates', 'auction_open', 'auction_indicative', 'auction_result'];

@@ -133,3 +133,3 @@ const BITFLYER_CHANNELS = ['lightning_executions', 'lightning_board_snapshot', 'lightning_board', 'lightning_ticker'];

];
const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'status'];
const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'raw_book', 'status', 'liquidations'];
const HUOBI_CHANNELS = ['depth', 'detail', 'trade', 'bbo'];

@@ -136,0 +136,0 @@ const HUOBI_DM_CHANNELS = ['depth', 'detail', 'trade'];

@@ -13,3 +13,8 @@ "use strict";

if (Array.isArray(message)) {
// we need to have matching symbol for channel id
// first test if message itself provides channel name and if so if it's trades
const channelName = message[message.length - 2];
if (typeof channelName === 'string') {
return channelName === 'trades';
}
// otherwise use channel to id mapping
return this._channelIdToSymbolMap.get(message[0]) !== undefined;

@@ -35,3 +40,4 @@ }

*map(message, localTimestamp) {
const symbol = this._channelIdToSymbolMap.get(message[0]);
const symbolFromMessage = message[message.length - 1];
const symbol = typeof symbolFromMessage === 'string' ? symbolFromMessage : this._channelIdToSymbolMap.get(message[0]);
// ignore if we don't have matching symbol

@@ -73,3 +79,8 @@ if (symbol === undefined) {

if (Array.isArray(message)) {
// we need to have matching symbol for channel id
// first test if message itself provides channel name and if so if it's a book
const channelName = message[message.length - 2];
if (typeof channelName === 'string') {
return channelName === 'book';
}
// otherwise use channel to id mapping
return this._channelIdToSymbolMap.get(message[0]) !== undefined;

@@ -95,3 +106,4 @@ }

*map(message, localTimestamp) {
const symbol = this._channelIdToSymbolMap.get(message[0]);
const symbolFromMessage = message[message.length - 1];
const symbol = typeof symbolFromMessage === 'string' ? symbolFromMessage : this._channelIdToSymbolMap.get(message[0]);
// ignore if we don't have matching symbol

@@ -136,3 +148,8 @@ if (symbol === undefined) {

if (Array.isArray(message)) {
// we need to have matching symbol for channel id
// first test if message itself provides channel name and if so if it's a status
const channelName = message[message.length - 2];
if (typeof channelName === 'string') {
return channelName === 'status';
}
// otherwise use channel to id mapping
return this._channelIdToSymbolMap.get(message[0]) !== undefined;

@@ -158,3 +175,4 @@ }

*map(message, localTimestamp) {
const symbol = this._channelIdToSymbolMap.get(message[0]);
const symbolFromMessage = message[message.length - 1];
const symbol = typeof symbolFromMessage === 'string' ? symbolFromMessage : this._channelIdToSymbolMap.get(message[0]);
// ignore if we don't have matching symbol

@@ -161,0 +179,0 @@ if (symbol === undefined) {

@@ -19,3 +19,3 @@ /// <reference types="node" />

private _ws?;
private static _connectionId;
private _connectionId;
constructor(exchange: string, _filters: Filter<string>[], _timeoutIntervalMS: number | undefined, _onError?: ((error: Error) => void) | undefined);

@@ -22,0 +22,0 @@ private _stream;

@@ -9,2 +9,3 @@ "use strict";

const handy_1 = require("../handy");
let connectionCounter = 1;
class RealTimeFeedBase {

@@ -18,2 +19,3 @@ constructor(exchange, _filters, _timeoutIntervalMS, _onError) {

this._receivedMessagesCount = 0;
this._connectionId = connectionCounter++;
this._onConnectionEstabilished = async () => {

@@ -33,3 +35,3 @@ try {

}
this.debug('(connection id: %d) estabilished connection', RealTimeFeedBase._connectionId);
this.debug('(connection id: %d) estabilished connection', this._connectionId);
this.onConnected();

@@ -48,3 +50,3 @@ //wait before fetching snapshots until we're sure we've got proper connection estabilished (received some messages)

catch (e) {
this.debug('(connection id: %d) providing manual snapshots error: %o', RealTimeFeedBase._connectionId, e);
this.debug('(connection id: %d) providing manual snapshots error: %o', this._connectionId, e);
this._ws.emit('error', e);

@@ -54,3 +56,3 @@ }

this._onConnectionClosed = () => {
this.debug('(connection id: %d) connection closed', RealTimeFeedBase._connectionId);
this.debug('(connection id: %d) connection closed', this._connectionId);
};

@@ -66,7 +68,6 @@ this.debug = debug_1.default(`tardis-dev:realtime:${exchange}`);

while (true) {
RealTimeFeedBase._connectionId++;
try {
const subscribeMessages = this.mapToSubscribeMessages(this._filters);
this.debug('(connection id: %d) estabilishing connection to %s', RealTimeFeedBase._connectionId, this.wssURL);
this.debug('(connection id: %d) provided filters: %o mapped to subscribe messages: %o', RealTimeFeedBase._connectionId, this._filters, subscribeMessages);
this.debug('(connection id: %d) estabilishing connection to %s', this._connectionId, this.wssURL);
this.debug('(connection id: %d) provided filters: %o mapped to subscribe messages: %o', this._connectionId, this._filters, subscribeMessages);
this._ws = new ws_1.default(this.wssURL, { perMessageDeflate: false, handshakeTimeout: 10 * handy_1.ONE_SEC_IN_MS });

@@ -129,3 +130,3 @@ this._ws.onopen = this._onConnectionEstabilished;

}
this.debug('(connection id: %d) %s real-time feed connection error, retries count: %d, next retry delay: %dms, rate limited: %s error message: %o', RealTimeFeedBase._connectionId, this.exchange, retries, delay, isRateLimited, error);
this.debug('(connection id: %d) %s real-time feed connection error, retries count: %d, next retry delay: %dms, rate limited: %s error message: %o', this._connectionId, this.exchange, retries, delay, isRateLimited, error);
// clear monitoring connection timer and notify about disconnect

@@ -171,3 +172,3 @@ if (timerId !== undefined) {

if (this._receivedMessagesCount === 0) {
this.debug('(connection id: %d) did not received any messages within %d ms timeout, terminating connection...', RealTimeFeedBase._connectionId, this._timeoutIntervalMS);
this.debug('(connection id: %d) did not received any messages within %d ms timeout, terminating connection...', this._connectionId, this._timeoutIntervalMS);
this._ws.terminate();

@@ -180,3 +181,2 @@ }

exports.RealTimeFeedBase = RealTimeFeedBase;
RealTimeFeedBase._connectionId = 0;
//# sourceMappingURL=realtimefeed.js.map

@@ -149,5 +149,4 @@ "use strict";

const createMappers = (localTimestamp) => normalizers.map((m) => m(exchange, localTimestamp));
const nonFilterableExchanges = ['bitfinex', 'bitfinex-alts', 'bitfinex-derivatives'];
const mappers = createMappers(fromDate);
const filters = nonFilterableExchanges.includes(exchange) ? [] : handy_1.getFilters(mappers, symbols);
const filters = handy_1.getFilters(mappers, symbols);
const messages = replay({

@@ -154,0 +153,0 @@ exchange,

{
"name": "tardis-dev",
"version": "10.1.2",
"version": "10.1.3",
"engines": {

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

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

const BINANCE_DEX_CHANNELS = ['trades', 'marketDiff', 'depthSnapshot'] as const
const BITFINEX_CHANNELS = ['trades', 'book'] as const
const BITFINEX_CHANNELS = ['trades', 'book', 'raw_book'] as const

@@ -129,3 +129,3 @@ const BITMEX_CHANNELS = [

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

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

const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'status'] as const
const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'raw_book', 'status', 'liquidations'] as const

@@ -152,0 +152,0 @@ const HUOBI_CHANNELS = ['depth', 'detail', 'trade', 'bbo'] as const

@@ -14,4 +14,9 @@ import { BookChange, DerivativeTicker, Exchange, FilterForExchange, Trade } from '../types'

if (Array.isArray(message)) {
// we need to have matching symbol for channel id
// first test if message itself provides channel name and if so if it's trades
const channelName = message[message.length - 2]
if (typeof channelName === 'string') {
return channelName === 'trades'
}
// otherwise use channel to id mapping
return this._channelIdToSymbolMap.get(message[0]) !== undefined

@@ -41,3 +46,5 @@ }

*map(message: BitfinexTrades, localTimestamp: Date) {
const symbol = this._channelIdToSymbolMap.get(message[0])
const symbolFromMessage = message[message.length - 1]
const symbol = typeof symbolFromMessage === 'string' ? symbolFromMessage : this._channelIdToSymbolMap.get(message[0])
// ignore if we don't have matching symbol

@@ -83,4 +90,9 @@ if (symbol === undefined) {

if (Array.isArray(message)) {
// we need to have matching symbol for channel id
// first test if message itself provides channel name and if so if it's a book
const channelName = message[message.length - 2]
if (typeof channelName === 'string') {
return channelName === 'book'
}
// otherwise use channel to id mapping
return this._channelIdToSymbolMap.get(message[0]) !== undefined

@@ -110,3 +122,5 @@ }

*map(message: BitfinexBooks, localTimestamp: Date) {
const symbol = this._channelIdToSymbolMap.get(message[0])
const symbolFromMessage = message[message.length - 1]
const symbol = typeof symbolFromMessage === 'string' ? symbolFromMessage : this._channelIdToSymbolMap.get(message[0])
// ignore if we don't have matching symbol

@@ -157,4 +171,9 @@ if (symbol === undefined) {

if (Array.isArray(message)) {
// we need to have matching symbol for channel id
// first test if message itself provides channel name and if so if it's a status
const channelName = message[message.length - 2]
if (typeof channelName === 'string') {
return channelName === 'status'
}
// otherwise use channel to id mapping
return this._channelIdToSymbolMap.get(message[0]) !== undefined

@@ -185,3 +204,4 @@ }

*map(message: BitfinexStatusMessage, localTimestamp: Date): IterableIterator<DerivativeTicker> {
const symbol = this._channelIdToSymbolMap.get(message[0])
const symbolFromMessage = message[message.length - 1]
const symbol = typeof symbolFromMessage === 'string' ? symbolFromMessage : this._channelIdToSymbolMap.get(message[0])

@@ -188,0 +208,0 @@ // ignore if we don't have matching symbol

@@ -15,2 +15,4 @@ import dbg from 'debug'

let connectionCounter = 1
export type RealTimeFeedIterable = AsyncIterable<any>

@@ -28,3 +30,3 @@

private _ws?: WebSocket
private static _connectionId = 0
private _connectionId = connectionCounter++

@@ -45,11 +47,10 @@ constructor(

while (true) {
RealTimeFeedBase._connectionId++
try {
const subscribeMessages = this.mapToSubscribeMessages(this._filters)
this.debug('(connection id: %d) estabilishing connection to %s', RealTimeFeedBase._connectionId, this.wssURL)
this.debug('(connection id: %d) estabilishing connection to %s', this._connectionId, this.wssURL)
this.debug(
'(connection id: %d) provided filters: %o mapped to subscribe messages: %o',
RealTimeFeedBase._connectionId,
this._connectionId,
this._filters,

@@ -134,3 +135,3 @@ subscribeMessages

'(connection id: %d) %s real-time feed connection error, retries count: %d, next retry delay: %dms, rate limited: %s error message: %o',
RealTimeFeedBase._connectionId,
this._connectionId,
this.exchange,

@@ -200,3 +201,3 @@ retries,

'(connection id: %d) did not received any messages within %d ms timeout, terminating connection...',
RealTimeFeedBase._connectionId,
this._connectionId,
this._timeoutIntervalMS

@@ -227,3 +228,3 @@ )

this.debug('(connection id: %d) estabilished connection', RealTimeFeedBase._connectionId)
this.debug('(connection id: %d) estabilished connection', this._connectionId)

@@ -245,3 +246,3 @@ this.onConnected()

} catch (e) {
this.debug('(connection id: %d) providing manual snapshots error: %o', RealTimeFeedBase._connectionId, e)
this.debug('(connection id: %d) providing manual snapshots error: %o', this._connectionId, e)
this._ws!.emit('error', e)

@@ -252,4 +253,4 @@ }

private _onConnectionClosed = () => {
this.debug('(connection id: %d) connection closed', RealTimeFeedBase._connectionId)
this.debug('(connection id: %d) connection closed', this._connectionId)
}
}

@@ -226,5 +226,4 @@ import { createReadStream } from 'fs-extra'

const createMappers = (localTimestamp: Date) => normalizers.map((m) => m(exchange, localTimestamp))
const nonFilterableExchanges = ['bitfinex', 'bitfinex-alts', 'bitfinex-derivatives']
const mappers = createMappers(fromDate)
const filters = nonFilterableExchanges.includes(exchange) ? [] : getFilters(mappers, symbols)
const filters = getFilters(mappers, symbols)

@@ -231,0 +230,0 @@ const messages = replay({

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