just binance can get data back ?
oss-jtyd opened this issue · 1 comments
oss-jtyd commented
hi all,can some one help,the code below, just binance can get data :
const ccxws = require("../index.js");
var map = {
binance: new ccxws.Binance(),
huobi: new ccxws.Huobi(),
OKEx: new ccxws.OKEx()
}
const fs = require('fs');
const path="./exchanges_config.json";
fs.readFile(path, function(err, data){
if(err){
console.log(err);
}else{
let exchangeStr=data.toString();
exchangeJson=JSON.parse(exchangeStr);
console.log(exchangeJson.length);
for (let i=0; i < exchangeJson.length; i++) {
const key = exchangeJson[i].exchange;
console.log(key);
const instance = map[key];
const market = {
id: "BTCUSDT", // remote_id used by the exchange
base: "BTC", // standardized base symbol for Bitcoin
quote: "USDT", // standardized quote symbol for Tether
};
// handle trade events
instance.on("trade", trade => {
console.log(trade)
});
// subscribe to trades
binance.subscribeTrades(market);
}
}
});
bmancini55 commented
Thanks for submitting the issue! In your loop you only call subscribeTrades
using the binance client binance.subscribeTrades(market);
. Also beware that markets (especially the id
property are different between exchanges.