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 13.21.1 to 13.21.2

3

dist/mappers/dydx.d.ts

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

export declare class DydxBookChangeMapper implements Mapper<'dydx', BookChange> {
private _offsets;
private _bidsOffsets;
private _asksOffsets;
canHandle(message: DyDxOrderbookSnapshot | DyDxOrderBookUpdate): boolean;

@@ -15,0 +16,0 @@ getFilters(symbols?: string[]): {

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

constructor() {
this._offsets = {};
this._bidsOffsets = {};
this._asksOffsets = {};
}

@@ -55,3 +56,4 @@ canHandle(message) {

if (message.type === 'subscribed') {
this._offsets[message.id] = {};
this._bidsOffsets[message.id] = {};
this._asksOffsets[message.id] = {};
yield {

@@ -63,3 +65,3 @@ type: 'book_change',

bids: message.contents.bids.map((bid) => {
this._offsets[message.id][bid.price] = Number(bid.offset);
this._bidsOffsets[message.id][bid.price] = Number(bid.offset);
return {

@@ -71,3 +73,3 @@ price: Number(bid.price),

asks: message.contents.asks.map((ask) => {
this._offsets[message.id][ask.price] = Number(ask.offset);
this._asksOffsets[message.id][ask.price] = Number(ask.offset);
return {

@@ -92,3 +94,3 @@ price: Number(ask.price),

.map((bid) => {
const lastPriceLevelOffset = this._offsets[message.id][bid[0]];
const lastPriceLevelOffset = this._bidsOffsets[message.id][bid[0]];
if (lastPriceLevelOffset !== undefined && lastPriceLevelOffset >= updateOffset) {

@@ -105,3 +107,3 @@ return;

.map((ask) => {
const lastPriceLevelOffset = this._offsets[message.id][ask[0]];
const lastPriceLevelOffset = this._asksOffsets[message.id][ask[0]];
if (lastPriceLevelOffset !== undefined && lastPriceLevelOffset >= updateOffset) {

@@ -120,6 +122,6 @@ return;

for (const bid of message.contents.bids) {
this._offsets[message.id][bid[0]] = updateOffset;
this._bidsOffsets[message.id][bid[0]] = updateOffset;
}
for (const ask of message.contents.asks) {
this._offsets[message.id][ask[0]] = updateOffset;
this._asksOffsets[message.id][ask[0]] = updateOffset;
}

@@ -126,0 +128,0 @@ if (bookChange.bids.length > 0 || bookChange.asks.length > 0) {

{
"name": "tardis-dev",
"version": "13.21.1",
"version": "13.21.2",
"engines": {

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

@@ -39,3 +39,4 @@ import { upperCaseSymbols } from '../handy'

export class DydxBookChangeMapper implements Mapper<'dydx', BookChange> {
private _offsets: { [key: string]: { [key: string]: number | undefined } } = {}
private _bidsOffsets: { [key: string]: { [key: string]: number | undefined } } = {}
private _asksOffsets: { [key: string]: { [key: string]: number | undefined } } = {}

@@ -59,3 +60,4 @@ canHandle(message: DyDxOrderbookSnapshot | DyDxOrderBookUpdate) {

if (message.type === 'subscribed') {
this._offsets[message.id] = {}
this._bidsOffsets[message.id] = {}
this._asksOffsets[message.id] = {}

@@ -68,3 +70,3 @@ yield {

bids: message.contents.bids.map((bid) => {
this._offsets[message.id][bid.price] = Number(bid.offset)
this._bidsOffsets[message.id][bid.price] = Number(bid.offset)
return {

@@ -77,3 +79,3 @@ price: Number(bid.price),

asks: message.contents.asks.map((ask) => {
this._offsets[message.id][ask.price] = Number(ask.offset)
this._asksOffsets[message.id][ask.price] = Number(ask.offset)
return {

@@ -99,3 +101,3 @@ price: Number(ask.price),

.map((bid) => {
const lastPriceLevelOffset = this._offsets[message.id][bid[0]]
const lastPriceLevelOffset = this._bidsOffsets[message.id][bid[0]]
if (lastPriceLevelOffset !== undefined && lastPriceLevelOffset >= updateOffset) {

@@ -114,3 +116,3 @@ return

.map((ask) => {
const lastPriceLevelOffset = this._offsets[message.id][ask[0]]
const lastPriceLevelOffset = this._asksOffsets[message.id][ask[0]]
if (lastPriceLevelOffset !== undefined && lastPriceLevelOffset >= updateOffset) {

@@ -132,7 +134,7 @@ return

for (const bid of message.contents.bids) {
this._offsets[message.id][bid[0]] = updateOffset
this._bidsOffsets[message.id][bid[0]] = updateOffset
}
for (const ask of message.contents.asks) {
this._offsets[message.id][ask[0]] = updateOffset
this._asksOffsets[message.id][ask[0]] = updateOffset
}

@@ -139,0 +141,0 @@

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