bitcoinvn
Modern, typed Python client for the BitcoinVN Exchange API — Vietnam's premier cryptocurrency exchange and instant swap platform. Built on HTTPX.
Official API documentation:
- OpenAPI specification: https://bitcoinvn.io/api/doc.json
- Exchange website: https://bitcoinvn.io
Features
- 📊 Public Market Data — Tickers, real-time exchange rates, pair metadata, and system status (no API key required).
- 🔄 Instant Swaps & Quotes — Calculate competitive quotes for crypto-to-crypto and crypto-to-fiat trades.
- 📦 Order Management — Create orders with support for crypto wallets, Lightning Network invoices, destination tags, bank wires, and cash pickups.
- 💰 Balances & History — Inspect internal wallet balances, transaction ledgers, and attach deposit transaction IDs.
- 📈 Staking Vaults — Discover staking opportunities, toggle auto-staking, and adjust notification alerts.
- 🛡️ Cryptographic Proofs — Retrieve and verify BitcoinVN cryptographic guarantee letters and public keys.
- ⚡ Resilient — Context manager support (
with BitcoinVn(...) as client:), type annotations, and rate-limit handling (retry_afterheader).
Installation
pip install bitcoinvn
Requires Python 3.10 or higher.
Quick Start (Safe Check)
The quick check queries the public market ticker for BTC/USDT. It does not require an API key and does not place orders or move funds.
import os
from bitcoinvn import BitcoinVn
# Anonymous client for public market queries (or pass api_key)
api_key = os.environ.get("BITCOINVN_API_KEY")
with BitcoinVn(api_key) as client:
ticker = client.get_ticker("BTC", "USDT")
print(f"Rate: {ticker['rate']}, 24h Volume: {ticker['volume24h']}")
Usage Guide
1. Authentication
Public read operations (health, info, pairs, ticker, address validation) work without a key.
For account-specific operations (viewing balances, order history, internal balance orders, staking), pass your API key:
from bitcoinvn import BitcoinVn
with BitcoinVn(api_key="your_api_key_here") as client:
balances = client.get_balances()
print(balances)
API keys can be generated in your account dashboard on bitcoinvn.io.
2. Market Pairs and Quotes
Inspect supported trading pairs and request live price quotes:
from bitcoinvn import BitcoinVn
with BitcoinVn() as client:
# Fetch trading pair specifications and limits
pair = client.get_pair("btc", "usdt")
print(f"Min: {pair['minDeposit']}, Max: {pair['maxDeposit']}")
# Request an instant quote
quote = client.create_quote(
deposit_method="btc",
settle_method="usdt",
deposit_amount=0.05,
)
print(f"Expected settle amount: {quote['settleAmount']}")
3. Creating and Managing Orders
Create an exchange order with specific settlement details:
from bitcoinvn import BitcoinVn
with BitcoinVn(api_key=os.environ.get("BITCOINVN_API_KEY")) as client:
# Create an order swapping BTC for USDT
order = client.create_order(
deposit_method="btc",
settle_method="usdt",
settle_amount=1000,
settle_data={"address": "0xYourUsdtAddressHere..."},
)
print(f"Order created: {order['shortId']}")
print(f"Send BTC deposit to: {order['depositAddress']}")
# Check order status
status = client.get_order(order["shortId"])
print(f"Order status: {status['status']}")
4. Account Balances and History
Inspect your account's internal wallet balances and ledger transactions:
with BitcoinVn(api_key=os.environ["BITCOINVN_API_KEY"]) as client:
# List balances
balances = client.get_balances()
print(balances)
# List ledger history
history = client.list_balance_history(limit=10)
for entry in history:
print(f"{entry['createdAt']}: {entry['amount']} {entry['asset']}")
Error Handling
When the API returns a 4xx or 5xx error, the client raises a BitcoinVnError containing HTTP status code, API error message, and rate-limit backoff details:
from bitcoinvn import BitcoinVn, BitcoinVnError
with BitcoinVn() as client:
try:
client.get_ticker("INVALID", "PAIR")
except BitcoinVnError as err:
print(f"BitcoinVN error [{err.status_code}]: {err.message}")
if err.status_code == 429 and err.retry_after:
print(f"Rate limited. Retry after {err.retry_after} seconds.")
Partner Referrer ID
In accordance with BitcoinVN's partner program, outgoing POST /api/orders requests automatically include the required referrer identifier in the payload.
License
ISC © api-kit contributors
Metadata
Release files for bitcoinvn 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bitcoinvn-0.1.0.tar.gz | 78.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bitcoinvn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.1 kB
Release files / bitcoinvn-0.1.0.tar.gz
| Download URL | bitcoinvn-0.1.0.tar.gz |
|---|---|
| Size | 78.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30ffa27395da40ff7401de79929aef4ccd6f5ad6a2d24313aac868adb53a8d2a
|
|
BLAKE2b-256 checksum How to use checksums |
ebd0718a738120f215bdf695f1dc9dc776dc1fa34cc6198f4563ba69b86f037b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bitcoinvn-0.1.0-py3-none-any.whl
| Download URL | bitcoinvn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35f511af4903e6af7f3df80b12fa3fec88b912f1d44447062765057718b6136f
|
|
BLAKE2b-256 checksum How to use checksums |
b817eb1f00fd5a1bc4f8c157b1613766b1cabbe0f0f237b3f8b4c7559095e493
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for bitcoinvn 0.1.0
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.