Leo4815162342 / dukascopy-node

✨ Download historical price tick data for Crypto, Stocks, ETFs, CFDs, Forex via CLI and Node.js ✨
https://dukascopy-node.app
MIT License
350 stars 66 forks source link

Expired Certificate #13

Closed lezwright closed 4 years ago

lezwright commented 4 years ago

Hi Leo, A new issue happening from today. image

Please can you let me know what is going on?

Leo4815162342 commented 4 years ago

@lezwright looks like dukascopy datafeed is not accepting (for some reason) the default user agent params that we send via our fetch request. Can you share the exact request config with which the error is happening?

lezwright commented 4 years ago

Oh, thank you for getting back to me. Here is the detail:

getHistoricRates({ instrument: 'eurcad', dates: { from: '2018-01-01', to: '2020-01-01' }, timeframe: 'h1', format: 'json' }).then(data => { console.log(data); }).catch(error => { console.log('error', error); });

And here is the exact error message:

error { FetchError: request to https://datafeed.dukascopy.com/datafeed/EURCAD/2018/01/BID_candles_hour_1.bi5 failed, reason: certificate has expired at ClientRequest. (/Desktop/Data/tradingview-udf-binance-node/node_modules/node-fetch/lib/index.js:1455:11) at ClientRequest.emit (events.js:180:13) at ClientRequest.emit (domain.js:422:20) at TLSSocket.socketErrorListener (_http_client.js:395:9) at TLSSocket.emit (events.js:180:13) at TLSSocket.emit (domain.js:422:20) at emitErrorNT (internal/streams/destroy.js:64:8) at process._tickCallback (internal/process/next_tick.js:178:19) message: 'request to https://datafeed.dukascopy.com/datafeed/EURCAD/2018/01/BID_candles_hour_1.bi5 failed, reason: certificate has expired', type: 'system', errno: 'CERT_HAS_EXPIRED', code: 'CERT_HAS_EXPIRED' }

Just one more piece of information, I tested it with a different IP address and it worked. But from my server IP address it does not work. Is it possible that Dukascopy server has some limitation? Is it possible to find a way around it? Because I need to have access to the data all the time.

Leo4815162342 commented 4 years ago

@lezwright thanks, in this case it might me something related to the environment from which the call is firing, based on the error its ssl certificate related.

The only difference between successful and unsuccessful calls is the IP? Anything else?

Can you also check the node version? (via node -v).

lezwright commented 4 years ago

Version of node is v9.11.2

lezwright commented 4 years ago

The other node that I get successful call is v12.16.1

lezwright commented 4 years ago

I didn't have any problems until this morning. It suddenly started giving me this message.

lezwright commented 4 years ago

Any suggestion?

Leo4815162342 commented 4 years ago

first you can try updating node

lezwright commented 4 years ago

Oh God, it is working. Thanks. So the problem at this stage was Node version :-) Thank you very much.