Skip to main content

perexchange

perexchange is an asynchronous Python library that fetches live PEN/USD exchange rates from Peruvian exchange houses. It queries the houses concurrently and returns the rates that arrived. It needs no API key and requires Python 3.12 or later.

Install

python -m pip install perexchange

Fetch rates

import asyncio

import perexchange


async def main() -> None:
    report = await perexchange.fetch_rates_report()

    for failure in report.failures:
        print(f"{failure.source} failed: {failure.message}")

    if report.rates:
        cheapest = min(report.rates, key=lambda rate: rate.sell_price)
        print(f"{cheapest.source} charges S/{cheapest.sell_price} for a dollar")


asyncio.run(main())

Each ExchangeRate has a buy_price, what the house pays you for a dollar, and a sell_price, what it charges you. A source that fails is listed in report.failures and does not stop the others.

Learn more

API reference covers source selection, fetch settings, retries, failures and the data classes. The repository has the issue tracker and the contributing guide.

Metadata

Release files for perexchange 2.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 perexchange 2.1.0
File Size Uploaded Provenance Actions
perexchange-2.1.0.tar.gz 21.4 kB With provenance Details for perexchange-2.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 56.8 kB

Release files / perexchange-2.1.0.tar.gz

Download URL perexchange-2.1.0.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
20f9d28e6b072d76a9021618bd16dbde515c21f389fcfa83439f93999bbca956
BLAKE2b-256 checksum
How to use checksums
a90c5ade3cea7806de266fff15f1e5ab26dde83c8fdcd241fd9220ca99d82879
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 21, 2026.

Transparency log

Release files / perexchange-2.1.0-py3-none-any.whl

Download URL perexchange-2.1.0-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f34e9f85ff8755a176cbb26508625f606d7c75f1d2fb06cf6bd2b99befb0ec19
BLAKE2b-256 checksum
How to use checksums
7c6597ebbbc86ea5a7ec855d8e10afad4b6bd3c956fa9a623eb27e55c7e153e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 21, 2026.

Transparency log

Security for perexchange 2.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 perexchange-2.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 21, 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.

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