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
365 stars 68 forks source link

Missing `volume` data when using `date-format` and `time-zone` args #194

Closed diliprk closed 2 months ago

diliprk commented 2 months ago

When I specify the time-zone and date-format args the volume data is not getting downloaded even though it is explicity specified as -v true in the CLI call below:

npx dukascopy-node -i usa500idxusd -p ask -from 2024-01-01 -to 2024-08-31 -t m5 -v true -f csv --date-format "YYYY-MM-DD HH:mm:ss" --time-zone America/New_York

Volume data does get downloaded is I omit the date-format arg though, like this:

npx dukascopy-node -i usa500idxusd -p ask -from 2024-01-01 -to 2024-08-31 -t m5 -v true -f csv --time-zone America/New_York

1.) What is the workaround for getting volume data along with custom date-format? 2.) If I simply pass the time-zone arg will the downloaded data containing UNIX timestamps will be in the correct timezone?

Leo4815162342 commented 2 months ago

@diliprk which version are you using?

After running your first command, the volume data seems to be there - in the last column:

timestamp,open,high,low,close,volume
2024-01-01 18:00:00,4771.384,4774.896,4771.248,4773.248,0.1207
2024-01-01 18:05:00,4773.399,4775.881,4773.134,4775.631,0.0365
2024-01-01 18:10:00,4775.384,4776.64,4775.14,4775.14,0.0211
2024-01-01 18:15:00,4775.396,4775.649,4775.134,4775.134,0.0105
...

perhaps you'd want it to be in different units (by default it's in millions), you can change that by adding --volume-units with respective value millions ,thousands or units

passing just time-zone without date format will not do anything, and dates will be displayed as raw unix timestamps (in ms)

diliprk commented 2 months ago

Thanks for your quick feedback. I am not sure why it did not work earlier but it works now. I am using the latest version 1.40

(base) dilip.rajkumar@NFIN-BLR-LT-438 download % npm info dukascopy-node version
1.40.0
(base) dilip.rajkumar@NFIN-BLR-LT-438 download % ls -la
total 16
drwxr-xr-x   3 dilip.rajkumar  staff    96 Sep  3 09:21 .
drwxr-xr-x  31 dilip.rajkumar  staff   992 Sep  2 14:46 ..
-rw-r--r--@  1 dilip.rajkumar  staff  6148 Sep  2 14:52 .DS_Store
(base) dilip.rajkumar@NFIN-BLR-LT-438 download % cd ..
(base) dilip.rajkumar@NFIN-BLR-LT-438 Dukascopy_Historical_Data % npx dukascopy-node -i usa500idxusd -p ask -from 2024-01-01 -to 2024-08-31 -t m5 -v true -f csv --date-format "YYYY-MM-DD HH:mm:ss" --time-zone America/New_York
----------------------------------------------------
Downloading historical price data for:
----------------------------------------------------
Instrument:     USA 500 Index
Timeframe:      m5
From date:      Jan 1, 2024, 12:00 AM
To date:        Aug 31, 2024, 12:00 AM
Price type:     ask
Volumes:        true
UTC Offset:     0
Include flats:  false
Format:         csv
----------------------------------------------------
|█████████████████████████████████████████████| 100%
----------------------------------------------------
√ File saved: download/usa500idxusd-m5-ask-2024-01-01-2024-08-31.csv (2.72 MB)

Download time: 1m 23s

(base) dilip.rajkumar@NFIN-BLR-LT-438 Dukascopy_Historical_Data % head download/usa500idxusd-m5-ask-2024-01-01-2024-08-31.csv 
timestamp,open,high,low,close,volume
2024-01-01 18:00:00,4771.384,4774.896,4771.248,4773.248,0.1207
2024-01-01 18:05:00,4773.399,4775.881,4773.134,4775.631,0.0365
2024-01-01 18:10:00,4775.384,4776.64,4775.14,4775.14,0.0211
2024-01-01 18:15:00,4775.396,4775.649,4775.134,4775.134,0.0105
2024-01-01 18:20:00,4774.884,4775.884,4774.634,4775.649,0.013
2024-01-01 18:25:00,4775.881,4776.649,4775.628,4776.128,0.0113
2024-01-01 18:30:00,4775.899,4776.393,4775.396,4775.396,0.017
2024-01-01 18:35:00,4775.146,4775.998,4775.083,4775.887,0.0154
2024-01-01 18:40:00,4775.64,4776.134,4774.64,4774.64,0.0164