Skip to content
dukascopy-node

CLI reference

Every dukascopy-node command-line option, with its alias, default value and the matching Node.js property.

Terminal window
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.

Terminal window
# Daily EUR/USD candles for 2023 as CSV, with volumes
npx 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.json
npx 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 paced
npx 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 time
npx 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_York

-i, --instrument <value>

Required Link to -i, --instrument <value>

Instrument id, for example eurusd, btcusd or aaplususd. Find ids on the instruments page.

Node.js
instrument

-from, --date-from <value>

Required Link to -from, --date-from <value>

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.

Node.js
dates.from

-to, --date-to <value>

Required Link to -to, --date-to <value>

End of the range (exclusive), or now. Future dates are clamped to the current time.

Default
now
Node.js
dates.to

-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.

Default
d1
Node.js
timeframe

-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.

Default
bid
Node.js
priceType

-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.

Default
0
Node.js
utcOffset

Output format: array, json or csv. See output formats.

Default
json
Node.js
format

Include volume columns in the output.

Default
false
Node.js
volumes

-vu, --volume-units <value>

Link to -vu, --volume-units <value>

Unit of volume values: millions, thousands or units.

Default
millions

Include candles with zero volume (flats), typically weekends and market holidays.

Default
false

-dir, --directory <value>

Link to -dir, --directory <value>

Folder the output file is written to. It is created if it does not exist.

Default
./download

-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.

Write json and array output without line breaks, for smaller files.

Default
false

-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.

-bs, --batch-size <value>

Link to -bs, --batch-size <value>

Number of requests sent concurrently in one batch.

Default
10
Node.js
batchSize

-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.

Default
1000

--request-interval <ms>

Link to --request-interval <ms>

Minimum time between individual requests, in milliseconds. 0 keeps the requests of a batch concurrent.

Default
0

--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.

Default
3

-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.

Default
0
Node.js
retryCount

-rp, --retry-pause <value>

Link to -rp, --retry-pause <value>

Pause between retries, in milliseconds.

Default
500

-re, --retry-on-empty

Link to -re, --retry-on-empty

Treat successful responses with an empty dataset as failed attempts, so they are retried.

Default
false

-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.

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.

Default
false
Node.js
useCache

-chpath, --cache-path <value>

Link to -chpath, --cache-path <value>

Folder for cached data.

Default
./.dukascopy-cache

Hide the download summary printed before the progress bar.

Default
false

Print detailed logs instead of the progress bar. See debugging.

Default
false

Show all options.