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.1.0 to 12.1.1

11

dist/mappers/ftx.d.ts

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

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

@@ -38,2 +38,10 @@ export declare class FTXTradesMapper implements Mapper<'ftx' | 'ftx-us', Trade> {

}
export declare class FTXLiquidationsMapper implements Mapper<'ftx', Liquidation> {
canHandle(message: FtxTrades | FtxOrderBook): boolean;
getFilters(symbols?: string[]): {
readonly channel: "trades";
readonly symbols: string[] | undefined;
}[];
map(ftxTrades: FtxTrades, localTimestamp: Date): IterableIterator<Liquidation>;
}
declare type FtxTrades = {

@@ -49,2 +57,3 @@ channel: 'trades';

time: string;
liquidation?: boolean;
}[];

@@ -51,0 +60,0 @@ };

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FTXDerivativeTickerMapper = exports.FTXBookChangeMapper = exports.mapBookLevel = exports.FTXTradesMapper = void 0;
exports.FTXLiquidationsMapper = exports.FTXDerivativeTickerMapper = exports.FTXBookChangeMapper = exports.mapBookLevel = exports.FTXTradesMapper = void 0;
const handy_1 = require("../handy");

@@ -124,2 +124,38 @@ const mapper_1 = require("./mapper");

exports.FTXDerivativeTickerMapper = FTXDerivativeTickerMapper;
class FTXLiquidationsMapper {
canHandle(message) {
if (message.data == undefined) {
return false;
}
return message.channel === 'trades';
}
getFilters(symbols) {
return [
{
channel: 'trades',
symbols
}
];
}
*map(ftxTrades, localTimestamp) {
for (const ftxTrade of ftxTrades.data) {
if (ftxTrade.liquidation) {
const timestamp = new Date(ftxTrade.time);
timestamp.μs = handy_1.parseμs(ftxTrade.time);
yield {
type: 'liquidation',
symbol: ftxTrades.market,
exchange: 'ftx',
id: ftxTrade.id !== null ? String(ftxTrade.id) : undefined,
price: ftxTrade.price,
amount: ftxTrade.size,
side: ftxTrade.side,
timestamp,
localTimestamp
};
}
}
}
}
exports.FTXLiquidationsMapper = FTXLiquidationsMapper;
//# sourceMappingURL=ftx.js.map

3

dist/mappers/index.d.ts

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

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

@@ -8,2 +8,3 @@ export * from './mapper';

export declare const normalizeOptionsSummary: <T extends "deribit" | "okex-options">(exchange: T, _localTimestamp: Date) => Mapper<T, OptionSummary>;
export declare const normalizeLiquidations: <T extends "ftx">(exchange: T, _localTimestamp: Date) => Mapper<T, Liquidation>;
//# sourceMappingURL=index.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeOptionsSummary = exports.normalizeDerivativeTickers = exports.normalizeBookChanges = exports.normalizeTrades = void 0;
exports.normalizeLiquidations = exports.normalizeOptionsSummary = exports.normalizeDerivativeTickers = exports.normalizeBookChanges = exports.normalizeTrades = void 0;
const handy_1 = require("../handy");

@@ -24,2 +24,3 @@ const binance_1 = require("./binance");

const coinbase_1 = require("./coinbase");
const coinflex_1 = require("./coinflex");
const cryptofacilities_1 = require("./cryptofacilities");

@@ -29,2 +30,4 @@ const delta_1 = require("./delta");

const ftx_1 = require("./ftx");
const gateio_1 = require("./gateio");
const gateiofutures_1 = require("./gateiofutures");
const gemini_1 = require("./gemini");

@@ -36,6 +39,3 @@ const hitbtc_1 = require("./hitbtc");

const phemex_1 = require("./phemex");
const gateio_1 = require("./gateio");
const gateiofutures_1 = require("./gateiofutures");
const poloniex_1 = require("./poloniex");
const coinflex_1 = require("./coinflex");
__exportStar(require("./mapper"), exports);

@@ -145,2 +145,5 @@ const THREE_MINUTES_IN_MS = 3 * 60 * handy_1.ONE_SEC_IN_MS;

};
const liquidationsMappers = {
ftx: () => new ftx_1.FTXLiquidationsMapper()
};
exports.normalizeTrades = (exchange, _localTimestamp) => {

@@ -174,2 +177,9 @@ const createTradesMapper = tradesMappers[exchange];

};
exports.normalizeLiquidations = (exchange, _localTimestamp) => {
const createLiquidationsMapper = liquidationsMappers[exchange];
if (createLiquidationsMapper === undefined) {
throw new Error(`normalizeLiquidations: ${exchange} not supported`);
}
return createLiquidationsMapper();
};
//# sourceMappingURL=index.js.map

@@ -83,2 +83,13 @@ import { EXCHANGES, EXCHANGE_CHANNELS_INFO } from './consts';

};
export declare type Liquidation = {
readonly type: 'liquidation';
readonly symbol: string;
readonly exchange: Exchange;
readonly id: string | undefined;
readonly price: number;
readonly amount: number;
readonly side: 'buy' | 'sell';
readonly timestamp: Date;
readonly localTimestamp: Date;
};
export declare type Disconnect = {

@@ -85,0 +96,0 @@ readonly type: 'disconnect';

{
"name": "tardis-dev",
"version": "12.1.0",
"version": "12.1.1",
"engines": {

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

import { parseμs } from '../handy'
import { BookChange, Trade, DerivativeTicker, Exchange } from '../types'
import { BookChange, Trade, DerivativeTicker, Exchange, Liquidation } from '../types'
import { Mapper, PendingTickerInfoHelper } from './mapper'

@@ -139,2 +139,42 @@

export class FTXLiquidationsMapper implements Mapper<'ftx', Liquidation> {
canHandle(message: FtxTrades | FtxOrderBook) {
if (message.data == undefined) {
return false
}
return message.channel === 'trades'
}
getFilters(symbols?: string[]) {
return [
{
channel: 'trades',
symbols
} as const
]
}
*map(ftxTrades: FtxTrades, localTimestamp: Date): IterableIterator<Liquidation> {
for (const ftxTrade of ftxTrades.data) {
if (ftxTrade.liquidation) {
const timestamp = new Date(ftxTrade.time)
timestamp.μs = parseμs(ftxTrade.time)
yield {
type: 'liquidation',
symbol: ftxTrades.market,
exchange: 'ftx',
id: ftxTrade.id !== null ? String(ftxTrade.id) : undefined,
price: ftxTrade.price,
amount: ftxTrade.size,
side: ftxTrade.side,
timestamp,
localTimestamp
}
}
}
}
}
type FtxTrades = {

@@ -150,2 +190,3 @@ channel: 'trades'

time: string
liquidation?: boolean
}[]

@@ -152,0 +193,0 @@ }

import { ONE_SEC_IN_MS } from '../handy'
import { BookChange, DerivativeTicker, OptionSummary, Trade } from '../types'
import { BookChange, DerivativeTicker, Liquidation, OptionSummary, Trade } from '../types'
import {

@@ -16,9 +16,12 @@ BinanceBookChangeMapper,

import { CoinbaseBookChangMapper, coinbaseTradesMapper } from './coinbase'
import { coinflexBookChangeMapper, CoinflexDerivativeTickerMapper, coinflexTradesMapper } from './coinflex'
import { cryptofacilitiesBookChangeMapper, CryptofacilitiesDerivativeTickerMapper, cryptofacilitiesTradesMapper } from './cryptofacilities'
import { deltaBookChangeMapper, DeltaDerivativeTickerMapper, deltaTradesMapper } from './delta'
import { deribitBookChangeMapper, DeribitDerivativeTickerMapper, DeribitOptionSummaryMapper, deribitTradesMapper } from './deribit'
import { FTXBookChangeMapper, FTXDerivativeTickerMapper, FTXTradesMapper } from './ftx'
import { FTXBookChangeMapper, FTXDerivativeTickerMapper, FTXLiquidationsMapper, FTXTradesMapper } from './ftx'
import { GateIOBookChangeMapper, GateIOTradesMapper } from './gateio'
import { GateIOFuturesBookChangeMapper, GateIOFuturesDerivativeTickerMapper, GateIOFuturesTradesMapper } from './gateiofutures'
import { geminiBookChangeMapper, geminiTradesMapper } from './gemini'
import { hitBtcBookChangeMapper, hitBtcTradesMapper } from './hitbtc'
import { HuobiBookChangeMapper, HuobiTradesMapper, HuobiDerivativeTickerMapper, HuobiMBPBookChangeMapper } from './huobi'
import { HuobiBookChangeMapper, HuobiDerivativeTickerMapper, HuobiMBPBookChangeMapper, HuobiTradesMapper } from './huobi'
import { krakenBookChangeMapper, krakenTradesMapper } from './kraken'

@@ -28,6 +31,3 @@ import { Mapper } from './mapper'

import { phemexBookChangeMapper, PhemexDerivativeTickerMapper, phemexTradesMapper } from './phemex'
import { GateIOBookChangeMapper, GateIOTradesMapper } from './gateio'
import { GateIOFuturesTradesMapper, GateIOFuturesBookChangeMapper, GateIOFuturesDerivativeTickerMapper } from './gateiofutures'
import { PoloniexTradesMapper, PoloniexBookChangeMapper } from './poloniex'
import { coinflexTradesMapper, coinflexBookChangeMapper, CoinflexDerivativeTickerMapper } from './coinflex'
import { PoloniexBookChangeMapper, PoloniexTradesMapper } from './poloniex'

@@ -153,2 +153,6 @@ export * from './mapper'

const liquidationsMappers = {
ftx: () => new FTXLiquidationsMapper()
}
export const normalizeTrades = <T extends keyof typeof tradesMappers>(exchange: T, _localTimestamp: Date): Mapper<T, Trade> => {

@@ -202,1 +206,14 @@ const createTradesMapper = tradesMappers[exchange]

}
export const normalizeLiquidations = <T extends keyof typeof liquidationsMappers>(
exchange: T,
_localTimestamp: Date
): Mapper<T, Liquidation> => {
const createLiquidationsMapper = liquidationsMappers[exchange]
if (createLiquidationsMapper === undefined) {
throw new Error(`normalizeLiquidations: ${exchange} not supported`)
}
return createLiquidationsMapper() as any
}

@@ -99,2 +99,14 @@ import { EXCHANGES, EXCHANGE_CHANNELS_INFO } from './consts'

export type Liquidation = {
readonly type: 'liquidation'
readonly symbol: string
readonly exchange: Exchange
readonly id: string | undefined
readonly price: number
readonly amount: number
readonly side: 'buy' | 'sell'
readonly timestamp: Date
readonly localTimestamp: Date
}
export type Disconnect = {

@@ -101,0 +113,0 @@ readonly type: 'disconnect'

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