Skip to content

Downloading tick data

Leonid Pyrlia edited this page Oct 22, 2022 · 11 revisions

dukascopy-node allows you to download tick data on top of all other offered timeframes.

Since tick timeframe represents a raw price change, the output will NOT contain OHLC data (open, high, low, close prices).

const { getHistoricalRates } = require('dukascopy-node');

(async () => {
  try {
    const data = await getHistoricalRates({
      instrument: 'eurusd',
      dates: {
        from: new Date('2021-03-30'),
        to: new Date('2021-03-31'),
      },
      timeframe: 'tick'
    });

    console.log(data);
  } catch (error) {
    console.log('error', error);
  }
})();

or via CLI:

npx dukascopy-node -i eurusd -from 2021-03-30 -to 2021-03-31 -t tick -f json

Output shape:

[
    {
    "timestamp": 1585526400104,
    "askPrice": 1.11369,
    "bidPrice": 1.11361,
    "askVolume": 0.75,
    "bidVolume": 0.75
  },
]

Full example output: with-tick-data.output.json

❗Keep in mind❗

When downloading tick data for long time ranges, expect the size of the output files to be very big (gigabytes of data).

On top of that expect slow loading times and big output, and consider adjusting batchSize and pauseBetweenBatchesMs parameters. More info: With custom batching