Skip to main content

fastexchange

Release Build status Commit activity License

A type stated library, to handle crypto and currency exchange Right now very few currencies and cryptos are supported, but you can help with that with contribution.

Getting started

You can see the examples in examples/ folder, the library is type stated, which helps you alot with code interface. Make sure if you're using the library, your IDE's static type checker is on, otherwise you might get confused and take too much effort into debugging when you don't really need it. This is most advanced use case right now.

import asyncio

from rich import print

from fastexchange.converter.clients import CurrencyMeUkClient
from fastexchange.crypto.usdt import Trc20Gateway
from fastexchange.currency import EURCurrency

SOME_WALLET = ""


async def fn():
    trc_client = Trc20Gateway()
    transactions = await trc_client.check_transaction(SOME_WALLET)
    this_transaction = transactions.token_transfers[1]
    print(this_transaction)  # show you the first transaction in API

    usdt = this_transaction.to_token()
    print(usdt)  # show you the USDT value with type

    usd = this_transaction.to_usd()
    print(usd)  # show you the USD value with type

    exchange_client = CurrencyMeUkClient()
    euro = await exchange_client.exchange(from_=usd, to=EURCurrency)
    print(euro)  # Converted value to EUR with type


if __name__ == "__main__":
    asyncio.run(fn())

Crypto gateways, are gateway used to read from the blockchain. They might also offer support to determain value of a crypto currency. This is not yet implemented, but if you see the code, you'd see figure out how to implement it. DM me if you need help. Exchange clients are the clients used to

Contribution

Right now very few currencies and cryptos are supported, but you can help with that with contribution. Please make sure you're adherencing to the library principle, when contributing. The idea is that codes should be type stated, and you should avoid illegal state by using typing. You can read more about this here

Runtime Errors

Since library is type stated, that means if your IDE/static type checker doesn't complaint about your type, then it's gonna be ran fun. But there's only 1 edge case, which is when you're using converter client. You should explictly check if it's in mapping or not.

exchange_client = CurrencyMeUkClient()
   euro = await exchange_client.exchange(from_=usd, to=NotSupportedCurrency)

Since this is a mapping inside each implementation of client, and each client may not support few currencies, then you'd run into exception ConverterNotMapped. If you find a work-around, for this edge case, I'd happy to learn that from you :)

Metadata

Release files for fastexchange 0.0.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 fastexchange 0.0.1
File Size Uploaded Provenance Actions
fastexchange-0.0.1.tar.gz 9.9 kB Without provenance Details for fastexchange-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 21.8 kB

Release files / fastexchange-0.0.1.tar.gz

Download URL fastexchange-0.0.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
50e11a9e1bdedd86faa58a92396ac41994958cea21602ae803ec1e1f651a0efe
BLAKE2b-256 checksum
How to use checksums
624c5456835b4352e47430908ead85fcb08736bc6cb44bbf051fabcca13a4607
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.8 Linux/6.5.0-1016-azure

Release files / fastexchange-0.0.1-py3-none-any.whl

Download URL fastexchange-0.0.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d94c9f0bc1f619e009c0d8a9755b377c8137e2894802d19910253dc32accb3a4
BLAKE2b-256 checksum
How to use checksums
9153f0b303fbb3ce04077d01afdb3b428932ff62be5fd1ae8c497d95db7b74d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.8 Linux/6.5.0-1016-azure

Security for fastexchange 0.0.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.0.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