dukascopy-fx
Library-first Rust crate for Dukascopy historical market data (FX, metals, indices, equities).
30-Second Quickstart
[]
= "0.5.0"
= { = "1", = ["macros", "rt-multi-thread"] }
use ;
async
Why teams choose this crate
- yfinance-like ergonomics (
Ticker,history,rate_at) - unified request model (
RateRequest) for pair/symbol flows - strict + explicit parse modes (
RequestParseMode) - typed period API (
Period) and tuned batch concurrency - checkpoint-driven incremental updates
- CLI fetcher for repeatable data jobs
- dataframe-friendly interop helpers (
flatten_rows,FlatExchangeRow)
Copy-Paste Workflows
1) Live fetch (library)
2) Incremental sync with checkpoints (library)
3) CSV/Parquet pipeline
# CSV (default features)
# Parquet sink enabled
Feature Matrix
| Capability | Default build | --features sinks-parquet |
|---|---|---|
Library fetch API (Ticker, get_rate*) |
Yes | Yes |
CSV sink (CsvSink) |
Yes | Yes |
Parquet sink (ParquetSink) |
No | Yes |
fx_fetcher backfill/update to CSV |
Yes | Yes |
fx_fetcher backfill/update to Parquet |
No | Yes |
fx_fetcher export CSV -> Parquet |
No | Yes |
CLI Quickstart (fx_fetcher)
# discover/update universe
# initial backfill
# incremental update
# machine-readable output for automation
# config-driven defaults
fx_fetcher global flags:
--config PATH.toml: load command defaults from TOML file--json: emit JSON summary/errors for CI scripts and wrappers
API Highlights
Most-used functions:
get_rate(from, to, timestamp)get_rate_for_request(&RateRequest, timestamp)get_rate_for_input(input, timestamp)get_rate_for_input_with_mode(input, RequestParseMode, timestamp)get_rate_for_symbol(symbol, timestamp)get_rate_in_quote(symbol, quote, timestamp)get_rates_range(from, to, start, end, interval)
Most-used Ticker methods:
Ticker::try_new(from, to)Ticker::parse("EUR/USD")rate(),rate_at(timestamp)history("1w"),history_period(Period::Weeks(1))interval(Duration::minutes(30))fetch_incremental(&store, lookback)
Advanced client configuration:
DukascopyClientBuilder::new()default_quote_currency("USD")pair_resolution_mode(...)conversion_mode(...),bridge_currencies(...)code_alias("AAPL", "AAPLUS")max_in_flight_requests(...),max_download_concurrency(...)max_at_or_before_backtrack_hours(...)
FAQ (common issues)
Missing command / Unknown option
- run
cargo run --bin fx_fetcher -- --help - commands use strict flag validation (unknown flags are errors)
backfill/update fails with output-mode error
- pass exactly one mode:
--out PATH(persist) or--no-output(dry fetch, no checkpoint advance)
Parquet sink requires feature
- build with
--features sinks-parquet
Invalid currency code
- accepted code format is alphanumeric, length
2..12 - prefer checked constructors:
Ticker::try_new,CurrencyPair::try_new
DataNotFound / sparse timestamps
- timestamp may be outside available history
- weekends/market closure can require earlier timestamp
Testing
Default:
Live integration (opt-in):
LIVE_TESTS=1
Project docs
- Changelog (release history):
CHANGELOG.md - API stability policy:
docs/API_STABILITY.md - Benchmark methodology:
docs/BENCHMARKS.md - CLI config reference:
docs/CLI_CONFIG.md - Dataframe integrations:
docs/INTEGRATIONS.md - Roadmap:
ROADMAP.md
License
MIT