Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

Update BitfinexClient.ts #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/exchanges/BitfinexClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,31 +226,31 @@ export class BitfinexClient extends BasicClient {
*/
protected _onHeartbeatMessage(msg: any, channel: any) {
if (channel.channel === "ticker") {
let market = this._tickerSubs.get(channel.pair);
let market = this._tickerSubs.get(channel.pair) || this._tickerSubs.get(channel.symbol);
if (!market) return;
this._onTickerHeartbeat(msg, market);
return;
}

// trades
if (channel.channel === "trades") {
let market = this._tradeSubs.get(channel.pair);
let market = this._tradeSubs.get(channel.pair) || this._tradeSubs.get(channel.symbol);
if (!market) return;
this._onTradeMessageHeartbeat(msg, market);
return;
}

// level3
if (channel.channel === "book" && channel.prec === "R0") {
let market = this._level3UpdateSubs.get(channel.pair);
let market = this._level3UpdateSubs.get(channel.pair) || this._level3UpdateSubs.get(channel.symbol);
if (!market) return;
this._onLevel3UpdateHeartbeat(msg, market);
return;
}

// level2
if (channel.channel === "book") {
let market = this._level2UpdateSubs.get(channel.pair);
let market = this._level2UpdateSubs.get(channel.pair) || this._level2UpdateSubs.get(channel.symbol);
if (!market) return;
this._onLevel2UpdateHeartbeat(msg, market);
return;
Expand Down Expand Up @@ -283,7 +283,7 @@ export class BitfinexClient extends BasicClient {
}

if (channel.channel === "ticker") {
const market = this._tickerSubs.get(channel.pair);
const market = this._tickerSubs.get(channel.pair) || this._tickerSubs.get(channel.symbol);
if (!market) return;

this._onTicker(msg, market);
Expand All @@ -292,7 +292,7 @@ export class BitfinexClient extends BasicClient {

// trades
if (channel.channel === "trades") {
const market = this._tradeSubs.get(channel.pair);
const market = this._tradeSubs.get(channel.pair) || this._tradeSubs.get(channel.symbol);
if (!market) return;

// handle tradeMessageType (constructor param) filtering
Expand All @@ -311,7 +311,7 @@ export class BitfinexClient extends BasicClient {

// level3
if (channel.channel === "book" && channel.prec === "R0") {
const market = this._level3UpdateSubs.get(channel.pair);
const market = this._level3UpdateSubs.get(channel.pair) || this._level3UpdateSubs.get(channel.symbol);
if (!market) return;

if (Array.isArray(msg[1][0])) this._onLevel3Snapshot(msg, market);
Expand All @@ -321,7 +321,7 @@ export class BitfinexClient extends BasicClient {

// level2
if (channel.channel === "book") {
const market = this._level2UpdateSubs.get(channel.pair);
const market = this._level2UpdateSubs.get(channel.pair) || this._level2UpdateSubs.get(channel.symbol);
if (!market) return;
if (Array.isArray(msg[1][0])) this._onLevel2Snapshot(msg, market);
else this._onLevel2Update(msg, market);
Expand Down