Skip to main content

oxr

oxr is a type-safe Python client with synchronous and asynchronous support for the Open Exchange Rates API. Allowing you to easily fetch exchange rates and convert between currencies.

Installation

pip install oxr

If you want to use the asynchronous client, you can install the package with the following command:

pip install oxr[async]

Usage

Synchronous Client

import oxr

import datetime as dt

# Base default to USD
client = oxr.Client(app_id='your_app_id')

# Fetch the latest exchange rates
rates = client.latest(symbols=['EUR', 'JPY'])

# Convert 100 USD to EUR
converted = client.convert(100, 'USD', 'EUR')

# Get time series data
timeseries = client.timeseries(start_date=dt.date(2020, 1, 1), end_date=dt.date(2020, 1, 31), symbols=['EUR', 'JPY'])

# Get open, high, low, close data
ohlc = client.ohlc(start_time=dt.datetime(2020, 1, 1), period="1m", symbols=['EUR', 'JPY'])

Asynchronous Client

The asynchronous client is built on top of aiohttp, and can be used in an async context.

import oxr.asynchronous
import asyncio
import datetime as dt

async def main():
    async with oxr.asynchronous.Client(app_id='your_app_id') as client:        
        # Fetch the latest exchange rates asynchronously
        rates = await client.latest(symbols=['EUR', 'JPY'])

        # Asynchronously convert 100 USD to EUR
        converted = await client.convert(100, 'USD', 'EUR')

        # Get time series data asynchronously
        timeseries = await client.timeseries(start_date=dt.date(2020, 1, 1), end_date=dt.date(2020, 1, 31), symbols=['EUR', 'JPY'])

        # Get OHLC data asynchronously
        ohlc = await client.ohlc(start_time=dt.datetime(2020, 1, 1), period="1m", symbols=['EUR', 'JPY'])

asyncio.run(main())

License

MIT

Metadata

Release files for oxr 0.1.1

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

Source distribution (sdist)

Source distribution for oxr 0.1.1
File Size Uploaded Provenance
oxr-0.1.1.tar.gz 86.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for oxr 0.1.1
File Interpreter ABI Platform
oxr-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 101.3 kB

Release files / oxr-0.1.1.tar.gz

Download URL oxr-0.1.1.tar.gz
Size 86.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d62cd55398e1b095bc7ac090da25a30209530faac4c02a58d6c80c3357ddf676
BLAKE2b-256 checksum
How to use checksums
87d7d21e5d8313d8f5e7a4130c1270bdeb4cc6c4cb94b0941bff3e9cda413e6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.7

Release files / oxr-0.1.1-py3-none-any.whl

Download URL oxr-0.1.1-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
694396b5b8c17c6bcd7039489f52c1a32a9d7aae1bb84ad030e63177a4ca8abd
BLAKE2b-256 checksum
How to use checksums
c578995e019ef476e8ce4639615c32b1fa4ba7e17bfa71dd8a0f10d8c31e02d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.7

Security for oxr 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.1.1 This release

2 release files No 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