Skip to main content

CryptoManager

CryptoManager is a small Python library for getting cryptocurrency and fiat exchange rates, converting between currencies, and working with simple money objects.

The library works without required API keys. It tries multiple public providers in order and falls back to the next provider when one of them is unavailable.

Installation

pip install cryptomanager

Quick Start

import cryptomanager as cm

btc_usd = cm.price(1, "BTC")
eth_eur = cm.price(1, "ETH", "EUR")

print(f"1 BTC = ${btc_usd:,.2f}")
print(f"1 ETH = EUR {eth_eur:,.2f}")

You can also use the global manager object directly:

from cryptomanager import cm

print(cm.price(0.5, "BTC"))

Conversion

import cryptomanager as cm

btc_to_usdt = cm.transfer(1, "BTC").to("USDT")
eth_to_btc = cm.transfer(10, "ETH").to("BTC")
usd_to_eur = cm.transfer(100, "USD").to("EUR")

print(btc_to_usdt)
print(eth_to_btc)
print(usd_to_eur)

Local Fixed-Rate Conversion

Use local conversion when you want to provide your own fixed rate:

import cryptomanager as cm

RUBY_RATE = 90
result = cm.transfer.local(2, "USD").to((RUBY_RATE, "RUBY"))

print(result)  # 180

Money Objects

import cryptomanager as cm

usdt = cm.money("USDT")
amount = usdt(1000)

btc_amount = amount.to("BTC")

print(amount)
print(btc_amount)

Supported Providers

Crypto providers:

  • Binance
  • CoinGecko
  • Coinbase Exchange
  • CoinPaprika
  • CoinLore
  • MEXC
  • CoinCap
  • CryptoCompare
  • Kraken
  • Bitfinex
  • Huobi
  • OKX
  • Bybit
  • KuCoin
  • Gate.io
  • Gemini
  • Bitstamp
  • Bittrex
  • CoinMarketCap, optional API key

Fiat providers:

  • Frankfurter
  • Exchangerate.host
  • ExchangeRate-API, optional API key
  • Open Exchange Rates, optional API key
  • Currency Layer, optional API key
  • Fixer.io, optional API key
  • Alpha Vantage, optional API key

API Keys

The package works without API keys, but some optional providers can be enabled:

import cryptomanager as cm

cm.set_api_key("coinmarketcap", "your_api_key")
cm.set_api_key("alphavantage", "your_api_key")

Do not commit API keys to GitHub.

Cache

Rates are cached for 60 seconds by default.

import cryptomanager as cm

cm.set_update_interval(30)
cm.clear_cache()

Supported Currency Lists

import cryptomanager as cm

cryptos = cm.get_supported_cryptos()
fiats = cm.get_supported_fiats()

print(len(cryptos))
print(len(fiats))

Error Handling

Network APIs can fail, rate-limit requests, or temporarily return incomplete data. Wrap live price calls in try/except:

import cryptomanager as cm

try:
    price = cm.price(1, "BTC")
    print(price)
except ValueError as exc:
    print(f"Could not get price: {exc}")

Development

Install the local project in editable mode:

python -m pip install -e .

Run smoke tests:

python tests.py
python test_examples.py

Build release files:

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*

Upload to PyPI:

python -m twine upload dist/*

Use __token__ as the username and your PyPI API token as the password.

License

MIT License. See LICENSE.

Metadata

Release files for cryptomanager 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 cryptomanager 0.1.1
File Size Uploaded Provenance Actions
cryptomanager-0.1.1.tar.gz 15.9 kB Without provenance Details for cryptomanager-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 29.9 kB

Release files / cryptomanager-0.1.1.tar.gz

Download URL cryptomanager-0.1.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1d9d553fe7bffe0d11e822acd4487baeec763fb47ecc0695ff51252fe7444888
BLAKE2b-256 checksum
How to use checksums
086197a08ca73204795271bfca06c66a1a353b00280fd437abe4022fac7d5b24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

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

Download URL cryptomanager-0.1.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df761b1a7efc1e5e1ab18bac261de3ec6a7586b48736bd26f1a1da33ea37393a
BLAKE2b-256 checksum
How to use checksums
b2ea7b44b2199fd870a801be0ba4a40fa4a72fbeb1dee172db016ffbf8294787
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Security for cryptomanager 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