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 12.3.0 to 12.4.0

4

dist/consts.js

@@ -182,3 +182,5 @@ "use strict";

'product_updates',
'announcements'
'announcements',
'all_trades',
'v2/ticker'
];

@@ -185,0 +187,0 @@ const GATE_IO_CHANNELS = ['trades', 'depth', 'ticker'];

import { Mapper } from './mapper';
import { Trade, BookChange, DerivativeTicker } from '../types';
export declare const deltaTradesMapper: Mapper<'delta', Trade>;
export declare class DeltaTradesMapper implements Mapper<'delta', Trade> {
private _useV2Channels;
constructor(_useV2Channels: boolean);
canHandle(message: DeltaTrade): boolean;
getFilters(symbols?: string[]): {
readonly channel: "recent_trade" | "all_trades";
readonly symbols: string[] | undefined;
}[];
map(message: DeltaTrade, localTimestamp: Date): IterableIterator<Trade>;
}
export declare const deltaBookChangeMapper: Mapper<'delta', BookChange>;
export declare class DeltaDerivativeTickerMapper implements Mapper<'delta', DerivativeTicker> {
private _useV2Channels;
constructor(_useV2Channels: boolean);
private readonly pendingTickerInfoHelper;
canHandle(message: DeltaTrade | DeltaMarkPrice | DeltaFundingRate): boolean;
getFilters(symbols?: string[]): ({
readonly channel: "recent_trade";
readonly channel: "recent_trade" | "all_trades";
readonly symbols: string[] | undefined;

@@ -26,3 +37,3 @@ } | {

timestamp: number;
type: 'recent_trade';
type: 'recent_trade' | 'all_trades';
};

@@ -29,0 +40,0 @@ declare type DeltaMarkPrice = {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeltaDerivativeTickerMapper = exports.deltaBookChangeMapper = exports.deltaTradesMapper = void 0;
exports.DeltaDerivativeTickerMapper = exports.deltaBookChangeMapper = exports.DeltaTradesMapper = void 0;
const mapper_1 = require("./mapper");

@@ -10,14 +10,17 @@ const fromMicroSecondsToDate = (micros) => {

};
exports.deltaTradesMapper = {
class DeltaTradesMapper {
constructor(_useV2Channels) {
this._useV2Channels = _useV2Channels;
}
canHandle(message) {
return message.type === 'recent_trade';
},
return message.type === (this._useV2Channels ? 'all_trades' : 'recent_trade');
}
getFilters(symbols) {
return [
{
channel: 'recent_trade',
channel: this._useV2Channels ? 'all_trades' : 'recent_trade',
symbols
}
];
},
}
*map(message, localTimestamp) {

@@ -36,3 +39,4 @@ yield {

}
};
}
exports.DeltaTradesMapper = DeltaTradesMapper;
const mapBookLevel = (level) => {

@@ -70,7 +74,10 @@ return {

class DeltaDerivativeTickerMapper {
constructor() {
constructor(_useV2Channels) {
this._useV2Channels = _useV2Channels;
this.pendingTickerInfoHelper = new mapper_1.PendingTickerInfoHelper();
}
canHandle(message) {
return message.type === 'recent_trade' || message.type === 'funding_rate' || message.type === 'mark_price';
return (message.type === (this._useV2Channels ? 'all_trades' : 'recent_trade') ||
message.type === 'funding_rate' ||
message.type === 'mark_price');
}

@@ -80,3 +87,3 @@ getFilters(symbols) {

{
channel: 'recent_trade',
channel: this._useV2Channels ? 'all_trades' : 'recent_trade',
symbols

@@ -96,3 +103,3 @@ },

const pendingTickerInfo = this.pendingTickerInfoHelper.getPendingTickerInfo(message.symbol.replace('MARK:', ''), 'delta');
if (message.type === 'recent_trade') {
if (message.type === 'recent_trade' || message.type === 'all_trades') {
pendingTickerInfo.updateLastPrice(Number(message.price));

@@ -99,0 +106,0 @@ }

import { BookChange, DerivativeTicker, Liquidation, OptionSummary, Trade } from '../types';
import { Mapper } from './mapper';
export * from './mapper';
export declare const normalizeTrades: <T extends "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "binance" | "ftx" | "okex-futures" | "okex-options" | "okex-swap" | "okex" | "huobi-dm" | "huobi-dm-swap" | "huobi" | "bitfinex-derivatives" | "bitfinex" | "coinbase" | "cryptofacilities" | "kraken" | "bitstamp" | "gemini" | "poloniex" | "bybit" | "phemex" | "delta" | "ftx-us" | "binance-us" | "gate-io-futures" | "gate-io" | "okcoin" | "bitflyer" | "hitbtc" | "coinflex" | "binance-jersey" | "binance-dex">(exchange: T, _localTimestamp: Date) => Mapper<T, Trade>;
export declare const normalizeTrades: <T extends "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "binance" | "ftx" | "okex-futures" | "okex-options" | "okex-swap" | "okex" | "huobi-dm" | "huobi-dm-swap" | "huobi" | "bitfinex-derivatives" | "bitfinex" | "coinbase" | "cryptofacilities" | "kraken" | "bitstamp" | "gemini" | "poloniex" | "bybit" | "phemex" | "delta" | "ftx-us" | "binance-us" | "gate-io-futures" | "gate-io" | "okcoin" | "bitflyer" | "hitbtc" | "coinflex" | "binance-jersey" | "binance-dex">(exchange: T, localTimestamp: Date) => Mapper<T, Trade>;
export declare const normalizeBookChanges: <T extends "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "binance" | "ftx" | "okex-futures" | "okex-options" | "okex-swap" | "okex" | "huobi-dm" | "huobi-dm-swap" | "huobi" | "bitfinex-derivatives" | "bitfinex" | "coinbase" | "cryptofacilities" | "kraken" | "bitstamp" | "gemini" | "poloniex" | "bybit" | "phemex" | "delta" | "ftx-us" | "binance-us" | "gate-io-futures" | "gate-io" | "okcoin" | "bitflyer" | "hitbtc" | "coinflex" | "binance-jersey" | "binance-dex">(exchange: T, localTimestamp: Date) => Mapper<T, BookChange>;
export declare const normalizeDerivativeTickers: <T extends "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "ftx" | "okex-futures" | "okex-swap" | "huobi-dm" | "huobi-dm-swap" | "bitfinex-derivatives" | "cryptofacilities" | "bybit" | "phemex" | "delta" | "gate-io-futures" | "coinflex">(exchange: T, _localTimestamp: Date) => Mapper<T, DerivativeTicker>;
export declare const normalizeDerivativeTickers: <T extends "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "ftx" | "okex-futures" | "okex-swap" | "huobi-dm" | "huobi-dm-swap" | "bitfinex-derivatives" | "cryptofacilities" | "bybit" | "phemex" | "delta" | "gate-io-futures" | "coinflex">(exchange: T, localTimestamp: Date) => Mapper<T, DerivativeTicker>;
export declare const normalizeOptionsSummary: <T extends "deribit" | "okex-options">(exchange: T, _localTimestamp: Date) => Mapper<T, OptionSummary>;
export declare const normalizeLiquidations: <T extends "bitmex" | "deribit" | "binance-futures" | "binance-delivery" | "ftx" | "huobi-dm" | "huobi-dm-swap" | "bitfinex-derivatives" | "cryptofacilities">(exchange: T, _localTimestamp: Date) => Mapper<T, Liquidation>;
//# sourceMappingURL=index.d.ts.map

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

phemex: () => phemex_1.phemexTradesMapper,
delta: () => delta_1.deltaTradesMapper,
delta: (localTimestamp) => new delta_1.DeltaTradesMapper(localTimestamp.valueOf() >= new Date('2020-10-14').valueOf()),
'gate-io': () => new gateio_1.GateIOTradesMapper('gate-io'),

@@ -132,3 +132,3 @@ 'gate-io-futures': () => new gateiofutures_1.GateIOFuturesTradesMapper('gate-io-futures'),

ftx: () => new ftx_1.FTXDerivativeTickerMapper('ftx'),
delta: () => new delta_1.DeltaDerivativeTickerMapper(),
delta: (localTimestamp) => new delta_1.DeltaDerivativeTickerMapper(localTimestamp.valueOf() >= new Date('2020-10-14').valueOf()),
'huobi-dm': () => new huobi_1.HuobiDerivativeTickerMapper('huobi-dm'),

@@ -154,3 +154,3 @@ 'huobi-dm-swap': () => new huobi_1.HuobiDerivativeTickerMapper('huobi-dm-swap'),

};
exports.normalizeTrades = (exchange, _localTimestamp) => {
exports.normalizeTrades = (exchange, localTimestamp) => {
const createTradesMapper = tradesMappers[exchange];

@@ -160,3 +160,3 @@ if (createTradesMapper === undefined) {

}
return createTradesMapper();
return createTradesMapper(localTimestamp);
};

@@ -170,3 +170,3 @@ exports.normalizeBookChanges = (exchange, localTimestamp) => {

};
exports.normalizeDerivativeTickers = (exchange, _localTimestamp) => {
exports.normalizeDerivativeTickers = (exchange, localTimestamp) => {
const createDerivativeTickerMapper = derivativeTickersMappers[exchange];

@@ -176,3 +176,3 @@ if (createDerivativeTickerMapper === undefined) {

}
return createDerivativeTickerMapper();
return createDerivativeTickerMapper(localTimestamp);
};

@@ -179,0 +179,0 @@ exports.normalizeOptionsSummary = (exchange, _localTimestamp) => {

{
"name": "tardis-dev",
"version": "12.3.0",
"version": "12.4.0",
"engines": {

@@ -62,8 +62,8 @@ "node": ">=12"

"@types/debug": "^4.1.5",
"@types/fs-extra": "^9.0.1",
"@types/fs-extra": "^9.0.2",
"@types/jest": "^26.0.14",
"@types/node": "^14.11.2",
"@types/node": "^14.11.8",
"cross-var": "^1.1.0",
"husky": "^4.3.0",
"jest": "^26.4.2",
"jest": "^26.5.3",
"lint-staged": "^10.4.0",

@@ -70,0 +70,0 @@ "prettier": "^2.1.2",

@@ -206,3 +206,5 @@ export const EXCHANGES = [

'product_updates',
'announcements'
'announcements',
'all_trades',
'v2/ticker'
]

@@ -209,0 +211,0 @@

@@ -11,6 +11,8 @@ import { Mapper, PendingTickerInfoHelper } from './mapper'

export const deltaTradesMapper: Mapper<'delta', Trade> = {
export class DeltaTradesMapper implements Mapper<'delta', Trade> {
constructor(private _useV2Channels: boolean) {}
canHandle(message: DeltaTrade) {
return message.type === 'recent_trade'
},
return message.type === (this._useV2Channels ? 'all_trades' : 'recent_trade')
}

@@ -20,7 +22,7 @@ getFilters(symbols?: string[]) {

{
channel: 'recent_trade',
channel: this._useV2Channels ? 'all_trades' : 'recent_trade',
symbols
} as const
]
},
}

@@ -78,6 +80,12 @@ *map(message: DeltaTrade, localTimestamp: Date): IterableIterator<Trade> {

export class DeltaDerivativeTickerMapper implements Mapper<'delta', DerivativeTicker> {
constructor(private _useV2Channels: boolean) {}
private readonly pendingTickerInfoHelper = new PendingTickerInfoHelper()
canHandle(message: DeltaTrade | DeltaMarkPrice | DeltaFundingRate) {
return message.type === 'recent_trade' || message.type === 'funding_rate' || message.type === 'mark_price'
return (
message.type === (this._useV2Channels ? 'all_trades' : 'recent_trade') ||
message.type === 'funding_rate' ||
message.type === 'mark_price'
)
}

@@ -88,3 +96,3 @@

{
channel: 'recent_trade',
channel: this._useV2Channels ? 'all_trades' : 'recent_trade',
symbols

@@ -106,3 +114,3 @@ } as const,

if (message.type === 'recent_trade') {
if (message.type === 'recent_trade' || message.type === 'all_trades') {
pendingTickerInfo.updateLastPrice(Number(message.price))

@@ -142,3 +150,3 @@ }

timestamp: number
type: 'recent_trade'
type: 'recent_trade' | 'all_trades'
}

@@ -145,0 +153,0 @@

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

} from './cryptofacilities'
import { deltaBookChangeMapper, DeltaDerivativeTickerMapper, deltaTradesMapper } from './delta'
import { deltaBookChangeMapper, DeltaDerivativeTickerMapper, DeltaTradesMapper } from './delta'
import {

@@ -92,3 +92,3 @@ deribitBookChangeMapper,

phemex: () => phemexTradesMapper,
delta: () => deltaTradesMapper,
delta: (localTimestamp: Date) => new DeltaTradesMapper(localTimestamp.valueOf() >= new Date('2020-10-14').valueOf()),
'gate-io': () => new GateIOTradesMapper('gate-io'),

@@ -159,3 +159,3 @@ 'gate-io-futures': () => new GateIOFuturesTradesMapper('gate-io-futures'),

ftx: () => new FTXDerivativeTickerMapper('ftx'),
delta: () => new DeltaDerivativeTickerMapper(),
delta: (localTimestamp: Date) => new DeltaDerivativeTickerMapper(localTimestamp.valueOf() >= new Date('2020-10-14').valueOf()),
'huobi-dm': () => new HuobiDerivativeTickerMapper('huobi-dm'),

@@ -184,3 +184,3 @@ 'huobi-dm-swap': () => new HuobiDerivativeTickerMapper('huobi-dm-swap'),

export const normalizeTrades = <T extends keyof typeof tradesMappers>(exchange: T, _localTimestamp: Date): Mapper<T, Trade> => {
export const normalizeTrades = <T extends keyof typeof tradesMappers>(exchange: T, localTimestamp: Date): Mapper<T, Trade> => {
const createTradesMapper = tradesMappers[exchange]

@@ -192,3 +192,3 @@

return createTradesMapper() as Mapper<T, Trade>
return createTradesMapper(localTimestamp) as Mapper<T, Trade>
}

@@ -211,3 +211,3 @@

exchange: T,
_localTimestamp: Date
localTimestamp: Date
): Mapper<T, DerivativeTicker> => {

@@ -220,3 +220,3 @@ const createDerivativeTickerMapper = derivativeTickersMappers[exchange]

return createDerivativeTickerMapper() as any
return createDerivativeTickerMapper(localTimestamp) as any
}

@@ -223,0 +223,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

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