Config
Node.js

Config (Node.js)

Config object:


PropertyTypeDefaultDescription
instrumentStringAn id of the trading instrument. Supported values: view list
datesObjectAn object with a date range
dates.from

Date

String

Number

Date representing the start of the time range. Can be of Date type, string (e.g. 2021-03-04 or 2021-03-04T00:00:00.000Z), or timestamp integer (e.g. 1614816000000)
dates.to

Date

String

Number

Date representing the end of the time range Can be of Date type, string (e.g. 2021-03-04 or 2021-03-04T00:00:00.000Z), or timestamp integer (e.g. 1614816000000)
timeframeStringd1Granularity of aggregation of OHLC (open, high, low, close) data.
Supported values:
  • tick (every single tick/price change)
  • s1 (1 second)
  • m1 (1 minute)
  • m5 (5 minutes)
  • m15 (15 minutes)
  • m30 (30 minutes)
  • h1 (1 hour)
  • h4 (4 hours)
  • d1 (1 day)
  • mn1 (1 month)
priceTypeStringbidType of price (offer side). Supported values: bid, ask
formatStringarrayFormat of the generated output. Supported values: array, json, csv. View output examples
utcOffsetNumber0UTC offset in minutes.
volumesBooleantrueA flag indicating whether the output should contain volume data
volumeUnitsStringmillionsVolume units. Supported values: millions,thousands,units.
ignoreFlatsBooleantrueA flag indicating whether the output should contain timeframe entries with 0 (flat) volume. Those mainly come from non-trading days, such as weekends or bank holidays.
batchSizeNumber10Number of requests sent to data storage per batch. We don't want to send bunch of requests at the same time, we want to split them in groups (batches) and fetch them one by one with pause in between (see pauseBetweenBatchesMs). Main purpose - not to fall under rate limiting restrictions.
pauseBetweenBatchesMsNumber1000Pause between downloading batches (in milliseconds).
useCacheBooleanfalseA flag indicating whether a file-system cache is going to be used to store response artifacts for subsequent lookups. When set to true, it significantly speeds up calls when requesting overlapping or similar data
cacheFolderPathString./.dukascopy-cacheFolder path where all cache artifacts (binary data) will be stored
retryCountNumber0Number of retries for a failed artifact download. If 0 no retries will happen even for failed requests.
retryOnEmptyBooleanfalseA flag indicating whether requests with successful but empty (0 Bytes) responses should be retried. If retryCount is 0 this parameter will be ignored
failAfterRetryCountBooleantrueA flag indicating whether the process should fail after all retries have been exhausted. If retryCount is 0 this parameter will be ignored.
pauseBetweenRetriesMsNumber500Pause between retries. If retryCount is 0 this parameter will be ignored

Full config object example:

{
  instrument: 'btcusd',
  dates: {
    from: '2018-01-01', // or 2018-01-01T00:00:00.000Z
    to: '2019-01-01', // or 2019-01-01T00:00:00.000Z
  },
  timeframe: 'd1',
  priceType: 'ask',
  format: 'json',
  utcOffset: 0,
  volumes: true,
  volumeUnits: 'millions',
  ignoreFlats: true,
  batchSize: 10,
  pauseBetweenBatchesMs: 1000,
  useCache: true,
  cacheFolderPath: '.dukascopy-cache',
  retryCount: 5,
  pauseBetweenRetriesMs: 250
}