Open WW-build opened 6 years ago
I usually get this error when an exchange's API is down or offline. If it is operational then poloniex probably has a new endpoint.
I have the same issue. It seems Poloniex has a security check (One More Step) which returns a HTML instead a string in JSON format.
{
marketName: 'poloniex',
URL: 'https://poloniex.com/public?command=returnTicker',
toBTCURL: false,
pairURL : '',
last: function (data, coin_prices) { //Where to find the last price of coin in JSON data
return new Promise(function (res, rej) {
try {
for (var obj in data) {
if(obj.includes('BTC_')&&obj!=="BTC_EMC2") {
let coinName = obj.replace("BTC_", '');
if (!coin_prices[coinName]) coin_prices[coinName] = {};
coin_prices[coinName].poloniex = data[obj].last;
}
}
res(coin_prices);
}
catch (err) {
console.log(err);
rej(err);
}
})
},
},
Hi, after starting parser it can't get data from Poloniex:
Error getting JSON response from https://poloniex.com/public?command=returnTicker SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse ()
at Request._callback (/opt/arbitrage/main.js:41:33)
at Request.self.callback (/opt/arbitrage/node_modules/request/request.js:186:22)
at Request.emit (events.js:159:13)
at Request. (/opt/arbitrage/node_modules/request/request.js:1163:10)
at Request.emit (events.js:159:13)
at IncomingMessage. (/opt/arbitrage/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:254:19)
at IncomingMessage.emit (events.js:164:20)
at endReadableNT (_stream_readable.js:1054:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Getting data from other markets working fine.