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.4.2 to 13.4.3

2

dist/realtimefeeds/binance.js

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

super(...arguments);
this.wssURL = 'wss://fstream3.binance.com/stream';
this.wssURL = 'wss://fstream.binance.com/stream';
this.httpURL = 'https://fapi.binance.com/fapi/v1';

@@ -145,0 +145,0 @@ this.suffixes = {

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

private readonly _instruments;
constructor(exchange: string, _httpURL: string, _instruments: string[]);
constructor(exchange: string, _httpURL: string, _instruments: string[], onError?: (error: Error) => void);
protected poolDataToStream(outputStream: Writable): Promise<void>;

@@ -22,0 +22,0 @@ }

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

if (instruments.length > 0) {
yield new FTXInstrumentInfoClient(exchange, this.httpURL, instruments);
yield new FTXInstrumentInfoClient(exchange, this.httpURL, instruments, onError);
}

@@ -48,4 +48,4 @@ }

class FTXInstrumentInfoClient extends realtimefeed_1.PoolingClientBase {
constructor(exchange, _httpURL, _instruments) {
super(exchange, 3);
constructor(exchange, _httpURL, _instruments, onError) {
super(exchange, 5, onError);
this._httpURL = _httpURL;

@@ -60,21 +60,28 @@ this._instruments = _instruments;

}
const responses = await Promise.all([
handy_1.httpClient.get(`${this._httpURL}/futures/${instrument}/stats`, { timeout: 10000 }).json(),
handy_1.httpClient.get(`${this._httpURL}/futures/${instrument}`, { timeout: 10000 }).json()
]);
if (responses.some((r) => r.success === false)) {
return;
try {
const responses = await Promise.all([
handy_1.httpClient.get(`${this._httpURL}/futures/${instrument}/stats`, { timeout: 10000 }).json(),
handy_1.httpClient.get(`${this._httpURL}/futures/${instrument}`, { timeout: 10000 }).json()
]);
if (responses.some((r) => r.success === false)) {
return;
}
const instrumentMessage = {
channel: 'instrument',
generated: true,
market: instrument,
type: 'update',
data: {
stats: responses[0].result,
info: responses[1].result
}
};
if (outputStream.writable) {
outputStream.write(instrumentMessage);
}
}
const instrumentMessage = {
channel: 'instrument',
generated: true,
market: instrument,
type: 'update',
data: {
stats: responses[0].result,
info: responses[1].result
catch (err) {
if (this.onError !== undefined) {
this.onError(err);
}
};
if (outputStream.writable) {
outputStream.write(instrumentMessage);
}

@@ -81,0 +88,0 @@ }));

@@ -51,5 +51,6 @@ /// <reference types="node" />

private readonly _poolingIntervalSeconds;
protected readonly onError?: ((error: Error) => void) | undefined;
protected readonly debug: dbg.Debugger;
private _tid;
constructor(exchange: string, _poolingIntervalSeconds: number);
constructor(exchange: string, _poolingIntervalSeconds: number, onError?: ((error: Error) => void) | undefined);
[Symbol.asyncIterator](): AsyncGenerator<any, void, unknown>;

@@ -56,0 +57,0 @@ protected abstract poolDataToStream(outputStream: Writable): Promise<void>;

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

class PoolingClientBase {
constructor(exchange, _poolingIntervalSeconds) {
constructor(exchange, _poolingIntervalSeconds, onError) {
this._poolingIntervalSeconds = _poolingIntervalSeconds;
this.onError = onError;
this._tid = undefined;

@@ -247,0 +248,0 @@ this.debug = (0, debug_1.default)(`tardis-dev:pooling-client:${exchange}`);

{
"name": "tardis-dev",
"version": "13.4.2",
"version": "13.4.3",
"engines": {

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

@@ -174,3 +174,3 @@ import { Writable } from 'stream'

export class BinanceFuturesRealTimeFeed extends BinanceRealTimeFeedBase {
protected wssURL = 'wss://fstream3.binance.com/stream'
protected wssURL = 'wss://fstream.binance.com/stream'
protected httpURL = 'https://fapi.binance.com/fapi/v1'

@@ -177,0 +177,0 @@

@@ -23,3 +23,3 @@ import { Writable } from 'stream'

if (instruments.length > 0) {
yield new FTXInstrumentInfoClient(exchange, this.httpURL, instruments)
yield new FTXInstrumentInfoClient(exchange, this.httpURL, instruments, onError)
}

@@ -65,4 +65,9 @@ }

class FTXInstrumentInfoClient extends PoolingClientBase {
constructor(exchange: string, private readonly _httpURL: string, private readonly _instruments: string[]) {
super(exchange, 3)
constructor(
exchange: string,
private readonly _httpURL: string,
private readonly _instruments: string[],
onError?: (error: Error) => void
) {
super(exchange, 5, onError)
}

@@ -78,24 +83,30 @@

const responses = await Promise.all([
httpClient.get(`${this._httpURL}/futures/${instrument}/stats`, { timeout: 10000 }).json() as any,
httpClient.get(`${this._httpURL}/futures/${instrument}`, { timeout: 10000 }).json() as any
])
try {
const responses = await Promise.all([
httpClient.get(`${this._httpURL}/futures/${instrument}/stats`, { timeout: 10000 }).json() as any,
httpClient.get(`${this._httpURL}/futures/${instrument}`, { timeout: 10000 }).json() as any
])
if (responses.some((r) => r.success === false)) {
return
}
if (responses.some((r) => r.success === false)) {
return
}
const instrumentMessage = {
channel: 'instrument',
generated: true,
market: instrument,
type: 'update',
data: {
stats: responses[0].result,
info: responses[1].result
const instrumentMessage = {
channel: 'instrument',
generated: true,
market: instrument,
type: 'update',
data: {
stats: responses[0].result,
info: responses[1].result
}
}
}
if (outputStream.writable) {
outputStream.write(instrumentMessage)
if (outputStream.writable) {
outputStream.write(instrumentMessage)
}
} catch (err) {
if (this.onError !== undefined) {
this.onError(err as any)
}
}

@@ -102,0 +113,0 @@ })

@@ -342,3 +342,4 @@ import dbg from 'debug'

private _tid: NodeJS.Timeout | undefined = undefined
constructor(exchange: string, private readonly _poolingIntervalSeconds: number) {
constructor(exchange: string, private readonly _poolingIntervalSeconds: number, protected readonly onError?: (error: Error) => void) {
this.debug = dbg(`tardis-dev:pooling-client:${exchange}`)

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