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

Processed "months" of data were offset by 1 #190

Closed neilwongtinpo closed 1 month ago

neilwongtinpo commented 1 month ago

In the test case, months are from 1 to 12 https://github.com/Leo4815162342/dukascopy-node/blob/1ce9a7e7c37f1ccfa1eb2ddc071d04c63350907c/src/utils/date.test.ts

But in below script: https://github.com/Leo4815162342/dukascopy-node/blob/1ce9a7e7c37f1ccfa1eb2ddc071d04c63350907c/src/utils/date.ts#L63

line 63: const utcDate = new Date(Date.UTC(year, month, day || 1, hour));

should be changed to const utcDate = new Date(Date.UTC(year, month-1, day || 1, hour));

because the month in Date constructor are of range from 0 to 11

neilwongtinpo commented 1 month ago

my bad, seems the server url used 0..11 for month too