Skip to main content

Dukascopy Downloader

Download free historical market data from Dukascopy — forex, metals, commodities, indices, bonds, stocks, ETFs and crypto (~1,500 instruments) — and save it as clean Parquet files ready for backtesting.

  • Timeframes: ticks, 1-minute, 1-hour and daily candles (BID and/or ASK)
  • Resumable: stop any time with Ctrl+C; the next run continues where it left off
  • Safe for the server: rate limited, slows down automatically when throttled, retries failed requests
  • Organised: files are sorted into folders by timeframe and category (m1/Forex/Majors/EUR-USD/...)
  • Easy to use: one command to download, one to update, one to export to CSV/Parquet

Installation

You need Python 3.10 or newer. Then:

pip install dukascopy-downloader

This gives you the duka command. Check that it works:

duka --version

To update to the latest version later:

pip install --upgrade dukascopy-downloader

Tip: if you only want the command-line tool, pipx or uv installs it into its own isolated environment: pipx install dukascopy-downloader or uv tool install dukascopy-downloader.

The latest development version can be installed straight from GitHub: pip install git+https://github.com/tomas-charvat/Dukascopy_downloader.git

Quick start

# 1. Find the instrument you want
duka instruments --search gold

# 2. Download 1-minute candles since 2020 (saved into ./data)
duka download EURUSD XAUUSD BTCUSD --from 2020

# 3. Later: fetch only what's new
duka update

# 4. Export to a single CSV file (here resampled to 15-minute candles)
duka export EURUSD --from 2020 --resample 15min -o eurusd_15m.csv

Symbols can be written as EURUSD, eurusd, EUR/USD or EUR-USD.

Commands

Command What it does
duka groups List instrument categories (FX_MAJORS, CMD_ENERGY, VCCY, ...)
duka instruments List or search instruments (--search gold, --group FX_MAJORS)
duka info EURUSD Instrument details and how far back its history goes
duka download ... Download data (see options below)
duka update Bring everything you've already downloaded up to date
duka status Show what's downloaded: rows, date range, size
duka export ... Write one symbol to a single CSV / CSV.GZ / Parquet file
duka selftest Live check: downloads a little data for 2 symbols from every category

Run duka <command> --help for all options.

Downloading

duka download EURUSD                                # full 1-minute history (BID)
duka download EURUSD GBPUSD --from 2015 --side both # BID and ASK since 2015
duka download --group FX_MAJORS --from 2018         # a whole category
duka download EURUSD --tf h1                        # hourly candles
duka download EURUSD --tf d1                        # daily candles
duka download BTCUSD --tf tick --from 2024-03-01 --to 2024-03-31
Option Meaning Default
--tf tick, m1, h1 or d1 m1
--from / --to 2020, 2020-05 or 2020-05-01 (--to is inclusive) whole history / now
--side BID, ASK or BOTH BID
--group download every instrument in a category (repeatable)
--data-dir where to store the data (or set DUKA_DATA_DIR) ./data
--rate max requests per second 8
--force download again even if already stored

How long does it take? One request = one day of 1-minute data, so ~5 years of m1 for one symbol is ~1,800 requests ≈ 4–8 minutes. Tick data is one request per hour and is much slower — download it for short periods only.

Exporting

duka export EURUSD --from 2020 --to 2024 -o eurusd_m1.csv
duka export EURUSD --resample 1h --tz Europe/London -o eurusd_h1.parquet
duka export XAUUSD --side mid --resample 4h -o xauusd_h4.csv

--resample accepts any pandas rule (5min, 15min, 1h, 4h, 1D, ...), --side can also be MID (average of bid and ask) or BOTH, and --drop-flat removes zero-volume candles.

Where the data goes

Everything is stored under ./data (change with --data-dir), sorted by timeframe, then category, then symbol:

data/
├── m1/
│   ├── Forex/Majors/EUR-USD/BID/2024-01.parquet    one file per month
│   ├── Commodities/Energy/LIGHT.CMD-USD/BID/...
│   └── Crypto/BTC-USD/BID/...
├── h1/Indices/America/USA500.IDX-USD/BID/2024.parquet    one file per year
├── d1/Stocks/US/NVDA.US-USD/BID/all.parquet              one file
├── tick/Forex/Metals/XAU-USD/2024-01-02.parquet          one file per day
├── _meta/    instrument list cache
└── _logs/    duka.log

Categories: Forex (Majors, Crosses, Metals), Commodities (Energy, Metals, Agricultural), Indices (America, Europe, Asia_Pacific, Africa), Bonds, Stocks/<country>, ETF/<country>, Crypto.

All times are UTC. The _manifest.json files record what's been downloaded — don't delete them unless you want to download everything again.

Using it from Python

from dukascopy_downloader import Downloader, load

# download
dl = Downloader("data")
dl.download(["EURUSD", "XAUUSD"], tf="m1", start="2020-01-01", sides="both")

# load stored data as a pandas DataFrame (works offline)
df = load("data", "EUR-USD", "m1", start="2020", end="2024")
h1 = load("data", "EUR-USD", "m1", side="MID", resample="1h", tz="Europe/London")

load() takes the Dukascopy code with a dash (EUR-USD, XAU-USD, BTC-USD); use dl.load("EURUSD", ...) if you want symbol names resolved for you.

You can also read the files with plain pandas: pd.read_parquet("data/m1/Forex/Majors/EUR-USD/BID").

Columns

  • candles: time, open, high, low, close, volume
  • ticks: time, bid, ask, bid_volume, ask_volume

time is a timezone-aware UTC timestamp. For older periods Dukascopy fills inactive minutes with flat zero-volume candles; drop them with drop_flat=True / --drop-flat.

Good to know

  • Latest data: Dukascopy publishes only finished periods. The current month (h1) and year (d1) are built from smaller timeframes and replaced with official data once the period closes. Run duka update whenever you want fresh data.
  • Rate limits: the server starts refusing requests at around 10 per second. The default of 8/s is safe; if you see Server is throttling messages, lower it with --rate 5.
  • Logs: details of every run are written to data/_logs/duka.log.

Development

git clone https://github.com/tomas-charvat/Dukascopy_downloader.git
cd Dukascopy_downloader
pip install -e .
python -m unittest discover -s tests -v   # offline tests, no network needed
duka selftest                             # live test against the Dukascopy API

Releasing a new version: bump version in pyproject.toml (and __version__ in dukascopy_downloader/__init__.py), push, then create a GitHub release with the tag v<version> (e.g. v1.2.0). The publish workflow builds the package and uploads it to PyPI.

API notes (for maintainers)

Data comes from https://jetta.dukascopy.com:

timeframe endpoint one request =
tick /v1/ticks/{CODE}/{Y}/{M}/{D}/{H} 1 hour
m1 /v1/candles/minute/{CODE}/{BID|ASK}/{Y}/{M}/{D} 1 day
h1 /v1/candles/hour/{CODE}/{BID|ASK}/{Y}/{M} 1 month
d1 /v1/candles/day/{CODE}/{BID|ASK}/{Y} 1 year

Instrument list: /v1/instruments, details: /v1/instruments/{CODE}. Values are delta-encoded: time = timestamp + cumsum(times) * shift, open = (round(open / multiplier) + cumsum(opens)) * multiplier (same for high/low/close and tick bid/ask); volumes are plain. A period that hasn't closed yet returns 400 From time is too late.

License

MIT — free to use, modify and share.

This project is not affiliated with Dukascopy Bank SA. Data is provided by Dukascopy under their terms of use; please use it responsibly.

Metadata

Release files for dukascopy-downloader 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dukascopy-downloader 1.1.0
File Size Uploaded Provenance Actions
dukascopy_downloader-1.1.0.tar.gz 37.9 kB With provenance Details for dukascopy_downloader-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dukascopy-downloader 1.1.0
File Interpreter ABI Platform Actions
dukascopy_downloader-1.1.0-py3-none-any.whl Python 3 none any Details for dukascopy_downloader-1.1.0-py3-none-any.whl

Total release size: 74.0 kB

Release files / dukascopy_downloader-1.1.0.tar.gz

Download URL dukascopy_downloader-1.1.0.tar.gz
Size 37.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5edd38448c514e40bb52c8070e4b260455d57a7cba6ae873e80da05b869a741f
BLAKE2b-256 checksum
How to use checksums
45853f84d9e7db31c9dbc97ed9d9ba287a7ab7c2212f0556dffa59e1622a4487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / dukascopy_downloader-1.1.0-py3-none-any.whl

Download URL dukascopy_downloader-1.1.0-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76a1963b5391488d47c39f4adc63494a875cabb42654d8ea74bf3067af64bef6
BLAKE2b-256 checksum
How to use checksums
d60339af1fc3bec1da540487e17c4b45cd9419a4659ec1a51ea69dc0f217ae8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Security for dukascopy-downloader 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dukascopy_downloader-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page