Skip to main content

Simple cryptocurrency price fetching from 10 top exchanges

Project description

btc2

Simple cryptocurrency price fetching from CEX + DEX + Wallet balance.

Install

pip install btc2

Quick Start

import btc2

# Price (no parentheses needed)
print(btc2.btc)        # → 80000.00
print(btc2.eth)       # → 2400.00
print(btc2.sol)       # → 85.00

# Specific exchange
print(btc2.btc.binance)    # → Binance price
print(btc2.btc.coinbase)  # → Coinbase price

# DEX prices (DexScreener, Raydium, etc.)
print(btc2.sol.dexscreener)  # → Solana token prices

# All prices
print(btc2.btc.all)    # → {"binance": 80000, ...}

# Wallet balance (Solana)
print(btc2.wallet("ADDRESS"))
print(btc2.wallet_info("ADDRESS"))

# Calculations
price = float(btc2.btc)  # → 80000.00

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
  • And 50+ more coins

CEX Exchanges (11)

binance, coinbase, kucoin, huobi, mexc, bitstamp, gemini, exmo, coingecko, coinpaprika, cryptocompare

DEX Exchanges (7)

uniswap, pancakeswap, sushiswap, curve, orca, raydium, dexscreener

Wallet

import btc2

# Get SOL balance
btc2.wallet("7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU")
# → {'address': '7xKX...', 'sol': 50.53, 'tokens': []}

# Pretty print
btc2.wallet_info("ADDRESS")

API Reference

Syntax Description
btc.binance BTC on Binance spot
btc.binance.fut BTC on Binance futures
btc.dexscreener DEX price from DexScreener
btc.all All exchange prices
btc() First available price
btc.sol First available (CEX or DEX)
btc2.wallet("addr") SOL wallet balance

Notes

  • No API keys required
  • Prices cached for 1 second
  • Async parallel fetching
  • Free public RPC for wallet

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.4.1.tar.gz (9.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.4.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for btc2-0.4.1.tar.gz
Algorithm Hash digest
SHA256 84343c6a9192c1315ef37895906caa700195097ed2ab1f70218fe19d74ce3108
MD5 f92074c3e338269df25ebd478dd74292
BLAKE2b-256 ad1fca515cafbd3e80f0a129d6edbcd1f672470080884bbd19e805153a6f5366

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for btc2-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4259a3d78acc093106e1291fe7f813da104f3372c4577c1d75291a193ab4683c
MD5 8a9640ef3af66cc410e9851234257679
BLAKE2b-256 eee0d48077f8f2d0e3b2ad34a5ab0e4690738b49d8bf2a41a0f03cda955d81ca

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