Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with getting data from Poloniex #37

Open
WW-build opened this issue Jan 7, 2018 · 3 comments
Open

Problems with getting data from Poloniex #37

WW-build opened this issue Jan 7, 2018 · 3 comments

Comments

@WW-build
Copy link

WW-build commented Jan 7, 2018

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.

@manu354
Copy link
Owner

manu354 commented Jan 8, 2018

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.

@gabrieldilly
Copy link

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.

@alexmdcampo
Copy link

{
    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);
            }

        })
    },

},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants