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

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.1.tar.gz (6.2 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.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: btc2-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 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.1.tar.gz
Algorithm Hash digest
SHA256 5a8d2acd973677b8c4c24df2c5ad73da1b974dff8106149fe2470ee9b0a6a1fd
MD5 bd8e09d3f917b6897cca2fbedca3ec3b
BLAKE2b-256 170205fa541fcb91dbe77b3017528ef454bbfcec57f489ff403c95574ac2f539

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btc2-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9848acc7868a0c87194479de246a6d9c50b20030d8c5440d959f8e836a66837
MD5 0bf3775ea0173f9dd34769bb342e55bf
BLAKE2b-256 d5f5d84c9ce9f58170d8ba7b9e4909950aee151e19d78f6f16445b3a690376a2

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