Skip to main content

dlt-unirate

PyPI License: MIT

A dlt source for the UniRate API — load live currency exchange rates, the supported-currency list, and per-country VAT rates into any dlt destination (DuckDB, BigQuery, Snowflake, Postgres, filesystem, …).

UniRate provides 593+ fiat, crypto, and commodity exchange rates. Latest rates, currencies, and VAT rates are available on the free tier; historical rates require a Pro plan.

Why this package

dlt has no built-in FX source, so people hand-roll a requests loop or a rest_api config every time they need exchange rates in a warehouse. This package gives you a typed, tested @dlt.source with three resources you can drop straight into a pipeline.

Install

pip install dlt-unirate

This pulls in dlt and requests. Add a destination extra for your target, e.g. pip install "dlt[duckdb]".

Quick start

import dlt
from dlt_unirate import unirate_source

pipeline = dlt.pipeline(
    pipeline_name="unirate",
    destination="duckdb",
    dataset_name="unirate_data",
)

# api_key resolves from dlt secrets / the UNIRATE_API_KEY env var,
# or pass it explicitly: unirate_source(api_key="...").
load_info = pipeline.run(unirate_source(base_currency="USD"))
print(load_info)

That loads three tables: exchange_rates, currencies, and vat_rates.

Configuring the API key

unirate_source follows dlt's config/secrets convention. Any of these work:

  • Env var: export UNIRATE_API_KEY="..."

  • dlt secrets — .dlt/secrets.toml:

    [sources.unirate]
    api_key = "..."
    
  • Explicit argument: unirate_source(api_key="...")

Get a free key at unirateapi.com.

Resources

Resource Table columns Notes
exchange_rates base_currency, target_currency, rate Every current rate for base_currency. write_disposition="replace".
currencies currency_code All supported currency codes. replace.
vat_rates country_code, country_name, vat_rate Per-country VAT rates. replace.
historical_exchange_rates date, base_currency, target_currency, rate Pro-gated — off by default. merge on (date, base, target).

Source parameters

Parameter Default Description
api_key dlt secret / UNIRATE_API_KEY UniRate API key.
base_currency "USD" Base for exchange_rates (and historical).
base_url https://api.unirateapi.com API base URL.
request_timeout 30 Per-request timeout, seconds.
include_historical False Also yield the Pro-gated historical resource.
historical_dates None YYYY-MM-DD dates to pull historical rates for.

Historical rates (Pro)

source = unirate_source(
    base_currency="EUR",
    include_historical=True,
    historical_dates=["2024-01-01", "2024-02-01"],
)
pipeline.run(source)

Historical endpoints return HTTP 403 on the free tier (surfaced as ProSubscriptionError); a UniRate Pro plan is required.

Selecting a subset of resources

# Only load exchange rates and currencies.
pipeline.run(unirate_source().with_resources("exchange_rates", "currencies"))

Error handling

Errors raised by the underlying client all inherit from UniRateError:

HTTP Exception
401 AuthenticationError
403 ProSubscriptionError
404 InvalidCurrencyError
429 RateLimitError
other non-2xx APIError (carries status_code)
network / transport UniRateError

Related UniRate clients

If you want to call the API directly, there are official clients in Python, Node.js, Go, Rust, Java, Ruby, PHP, .NET, and Swift, plus data-stack integrations for dbt, Airflow, and LangChain.

License

MIT — see LICENSE.

Metadata

Release files for dlt-unirate 0.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 dlt-unirate 0.1.0
File Size Uploaded
dlt_unirate-0.1.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlt-unirate 0.1.0
File Interpreter ABI Platform
dlt_unirate-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / dlt_unirate-0.1.0.tar.gz

Download URL dlt_unirate-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
98474e64567be6364f83b215765a72cd0dccaa3c89d9225147056ae203db95ea
BLAKE2b-256 checksum
How to use checksums
d64c8620b839090cd57b7802faf220708a58d513741c3108f997aa5acb59d792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 27, 2026.

Transparency log

Release files / dlt_unirate-0.1.0-py3-none-any.whl

Download URL dlt_unirate-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cafbbdaca94191c6234e03d7ea2767bf6c6a4c01b9611310648ff39ef9394081
BLAKE2b-256 checksum
How to use checksums
4ba0dd21dbbafbb1f5836398ef64bfbb7a8eb96b0e3ec2ae193f08c35c9cd7fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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