CLI reference
Every dukascopy-node command-line option, with its alias, default value and the matching Node.js property.
npx dukascopy-node -i <instrument> -from <date> [-to <date>] [options]-i and -from are required. Without -to, data is downloaded up to now. Run npx dukascopy-node --help to print every option.
Examples
Section titled “Examples”# Daily EUR/USD candles for 2023 as CSV, with volumesnpx dukascopy-node -i eurusd -from 2023-01-01 -to 2024-01-01 -t d1 -f csv -v
# One hour of Bitcoin ticks into ./data/btc-ticks.jsonnpx dukascopy-node -i btcusd -from 2024-03-01T12:00Z -to 2024-03-01T13:00Z -t tick -dir ./data -fn btc-ticks
# A year of 1-minute gold candles: cached, retried and pacednpx dukascopy-node -i xauusd -from 2023-01-01 -to 2024-01-01 -t m1 -f csv --cache --retries 3 --batch-pause 2000
# Readable dates in New York timenpx dukascopy-node -i aaplususd -from 2024-06-03 -to 2024-06-04 -t m5 -f csv -df "YYYY-MM-DD HH:mm" -tz America/New_YorkInstrument id, for example eurusd, btcusd or aaplususd. Find ids on the instruments page.
Start of the range (inclusive), for example 2021-03-04 or 2021-03-04T10:30:00Z. Dates before the instrument’s earliest available data are moved forward to it.
End of the range (exclusive), or now. Future dates are clamped to the current time.
-t, --timeframe <value>
Link to -t, --timeframe <value> Aggregation of the data: tick, s1, m1, m5, m15, m30, h1, h4, d1 or mn1. See timeframes.
-p, --price-type <value>
Link to -p, --price-type <value> Side of the market used for candles: bid or ask. Ignored for tick, which always includes both.
-utc, --utc-offset <value>
Link to -utc, --utc-offset <value> Shifts both ends of the requested range by this many minutes. Output timestamps stay in UTC; to convert them, see time zones.
Output
Section titled “Output” -f, --format <value>
Link to -f, --format <value> Output format: array, json or csv. See output formats.
-v, --volumes
Link to -v, --volumes Include volume columns in the output.
-vu, --volume-units <value>
Link to -vu, --volume-units <value> Unit of volume values: millions, thousands or units.
-fl, --flats
Link to -fl, --flats Include candles with zero volume (flats), typically weekends and market holidays.
Files and dates
Section titled “Files and dates” -dir, --directory <value>
Link to -dir, --directory <value> Folder the output file is written to. It is created if it does not exist.
-fn, --file-name <value>
Link to -fn, --file-name <value> Custom file name, without extension. The default is built from the request, e.g. eurusd-d1-bid-2021-02-01-2021-03-01.csv.
-in, --inline
Link to -in, --inline Write json and array output without line breaks, for smaller files.
-df, --date-format <value>
Link to -df, --date-format <value> Format timestamps with a Day.js format such as "YYYY-MM-DD HH:mm:ss", or iso. See date formats.
-tz, --time-zone <value>
Link to -tz, --time-zone <value> IANA time zone for formatted dates, such as Europe/London. Requires --date-format.
Batching and rate limits
Section titled “Batching and rate limits” -bs, --batch-size <value>
Link to -bs, --batch-size <value> Number of requests sent concurrently in one batch.
-bp, --batch-pause <value>
Link to -bp, --batch-pause <value> Pause between batches, in milliseconds. Skipped when a whole batch is served from the cache.
--request-interval <ms>
Link to --request-interval <ms> Minimum time between individual requests, in milliseconds. 0 keeps the requests of a batch concurrent.
--rate-limit-retries <count>
Link to --rate-limit-retries <count> Retries after HTTP 429 (Too Many Requests), separate from regular retries. Waits back off exponentially and honour Retry-After.
Retries
Section titled “Retries” -r, --retries <value>
Link to -r, --retries <value> Number of retries for a failed request. 0 disables retries. Refused requests (HTTP 403) are never retried.
-rp, --retry-pause <value>
Link to -rp, --retry-pause <value> Pause between retries, in milliseconds.
-re, --retry-on-empty
Link to -re, --retry-on-empty Treat successful responses with an empty dataset as failed attempts, so they are retried.
-fr, --no-fail-after-retries
Link to -fr, --no-fail-after-retries Skip periods that still fail after all attempts and continue, also when --retries is 0.
Cache
Section titled “Cache” -ch, --cache
Link to -ch, --cache Store completed periods on disk and read them from there on later runs. Periods that are still changing, such as the current hour or day, are always fetched.
-chpath, --cache-path <value>
Link to -chpath, --cache-path <value> Folder for cached data.
Other
Section titled “Other” -s, --silent
Link to -s, --silent Hide the download summary printed before the progress bar.
-d, --debug
Link to -d, --debug Print detailed logs instead of the progress bar. See debugging.
-h, --help
Link to -h, --help Show all options.