Skip to main content

Simple cryptocurrency price fetching from 10 top exchanges

Project description

btc2

Simple cryptocurrency price fetching from 10 top exchanges.

Install

pip install btc2

Quick Start

import btc2

# Print price (no parentheses needed for print)
print(btc2.btc)        # → 67432.50
print(btc2.eth)        # → 2378.92
print(btc2.btc.all)    # → {"binance": 67432.50, ...}

# Get price as number (use parentheses)
btc2.btc()             # → 67432.50
btc2.btc.binance()     # → 67432.50
btc2.btc.binance.fut() # → 67450.00

# For calculations
price = float(btc2.btc)  # → 67432.50

Alternative import

from btc2 import btc, eth

print(btc)    # → 67432.50
btc()         # → 67432.50

Supported Coins

  • btc, bitcoin → BTC
  • eth, ethereum → ETH
  • sol, solana → SOL
  • xrp, ripple → XRP
  • ada, cardano → ADA
  • doge, dogecoin → DOGE
  • dot, polkadot → DOT
  • avax, avalanche → AVAX
  • link, chainlink → LINK
  • matic, polygon → MATIC
  • shib, shiba → SHIB
  • ltc, litecoin → LTC
  • trx, tron → TRX
  • uni, uniswap → UNI
  • atom, cosmos → ATOM
  • xlm, stellar → XLM
  • bch, bitcoin-cash → BCH
  • etc, ethereum-classic → ETC
  • fil, filecoin → FIL
  • apt, aptos → APT
  • arb, arbitrum → ARB
  • op, optimism → OP
  • near, near-protocol → NEAR
  • sui, sui-network → SUI
  • pepe, pepecoin → PEPE
  • ton, toncoin → TON
  • inj, injective → INJ
  • rndr, render → RNDR
  • imx, immutable → IMX
  • vet, vechain → VET
  • algo, algorand → ALGO
  • ftm, fantom → FTM
  • sand, sandbox → SAND
  • mana, decentraland → MANA
  • axs, axie → AXS
  • gala, galaxy → GALA

And more (top 50+ coins supported)

Supported Exchanges

  • binance
  • bybit
  • okx
  • coinbase
  • kraken
  • kucoin
  • gate
  • bitget
  • huobi
  • mexc

API Reference

Syntax Description
btc.binance BTC on Binance spot (default)
btc.binance.spot BTC on Binance spot
btc.binance.fut BTC on Binance futures
eth.bybit ETH on Bybit spot
btc.all BTC price from all exchanges (spot)
btc.all.fut BTC futures from all exchanges
btc() Same as btc.all

Notes

  • All prices are fetched asynchronously in parallel for speed
  • Results are cached for 1 second to avoid rate limiting
  • If an exchange is unavailable, it will be skipped in results
  • Futures are supported on: binance, bybit, okx, kucoin, gate, bitget, mexc

Publish to PyPI

# Install build tools
pip install build twine

# Build package
python -m build

# Upload to PyPI
twine upload dist/*

When prompted for credentials:

  • Username: __token__
  • Password: your_pypi_api_token

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

btc2-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

btc2-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file btc2-0.1.0.tar.gz.

File metadata

  • Download URL: btc2-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for btc2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e7367fbeef8389f107b138a0eac5128e1b1d6cdc075650112a9f1b0a32ada6a7
MD5 8f8cb335e7d609a041bc2874ed73bfde
BLAKE2b-256 07e08851a2f906dcb72f2e156a1d29f0c1fe311d395ad119b88f77da5a7068a8

See more details on using hashes here.

File details

Details for the file btc2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: btc2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for btc2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd21381842fbd712e13f8c649f0c75b8d1ff8b295a95270540a1ea59fd5d851
MD5 0ea1d88e44b115b088a6ffcd8e845ff9
BLAKE2b-256 7b0d0d4ba34d2fdd123cf692be105674f679da28789eb21c36fbe50501f7f938

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page