Skip to main content

crypto-fx-converter

Zero-dependency Python (decimal.Decimal), Go (cryptofx), and JavaScript (ESM) library + CLI for crypto-to-multi-fiat (USD, EUR, GBP, CNY, CAD, AUD, JPY) conversion, OTC / P2P USDT spread calculation, and multi-chain USDT withdrawal fee basis-point comparison.

Live Interactive Converters & References


Installation & Usage

1. Python (pypi.org)

pip install crypto-fx-converter
from crypto_fx_converter import (
    convert_crypto_fiat,
    analyze_p2p_spread,
    compare_usdt_network_fees,
)

# 1) Convert 0.25 BTC at $96,400 into EUR (including 0.10% spot fee & 20% permanent rebate)
quote = convert_crypto_fiat(
    quantity="0.25",
    usd_price="96400",
    fiat_code="EUR",
    fx_rate_per_usd="0.9350",
    trading_fee_rate="0.001",
    rebate_rate="0.20",
    symbol="BTC",
)
print(f"{quote.usd_value} USD -> {quote.fiat_value} EUR (net {quote.net_fiat_after_fee} EUR)")

# 2) Measure P2P USDT quote spread vs. mid-market USD/CNY (e.g. 7.31 vs 7.245)
spread = analyze_p2p_spread(mid_fx_rate="7.2450", p2p_quote_rate="7.3100", fiat_code="CNY")
print(f"P2P Spread: +{spread.spread_pct}% ({spread.spread_bps} bps)")

# 3) Compare multi-chain withdrawal fees on a 500 USDT transfer
for row in compare_usdt_network_fees("500"):
    print(f"{row.network:10s} fee={row.fee_usdt} USDT ({row.cost_bps} bps)")

CLI (crypto-fx):

crypto-fx --symbol BTC --qty 0.5 --usd 96400 --fiat EUR --transfer-usdt 500

2. Go (pkg.go.dev)

go get github.com/dalangdalang934/crypto-fx-converter@latest
package main

import (
	"fmt"
	cryptofx "github.com/dalangdalang934/crypto-fx-converter"
)

func main() {
	q, _ := cryptofx.ConvertCryptoFiat("BTC", 0.5, 96400, "EUR", 0.935, 0.001, 0.20)
	fmt.Printf("USD: %.2f | EUR: %.2f (net %.2f)\n", q.USDValue, q.FiatValue, q.NetFiatAfterFee)
}

3. JavaScript (ESM)

import { convertCryptoFiat, analyzeP2PSpread, compareUsdtNetworkFees } from './src/index.mjs';

console.log(convertCryptoFiat({ symbol: 'ETH', quantity: 2, usdPrice: 3650, fiatCode: 'GBP' }));
console.log(analyzeP2PSpread(7.245, 7.31, 'CNY'));
console.log(compareUsdtNetworkFees(250));

Why P2P USDT Quotes Differ from Mid-Market FX

Bank and interbank FX feeds quote USD/CNY or USD/EUR on wire settlement, whereas peer-to-peer (P2P / C2C) stablecoin desks price local fiat liquidity, T+1 withdrawal protections, and payment-rail friction:

P2P Spread (%) = (Quote_P2P − FX_Mid) / FX_Mid × 100%
Net Effective Spot Fee = Base_Fee × (1 − BNB_Discount) × (1 − Referral_Rebate)

With a standard 0.10% spot fee, stacking a 25% BNB deduction and a 20% permanent referral rebate reduces effective spot execution cost to 0.06% (6 bps)—often smaller than a single basis-point swing in the P2P FX spread. See the full Binance Fee & Rebate Breakdown (中文手续费说明) and TRC20 vs ERC20 vs BEP20 Comparison.

License

MIT © HoldWins

Metadata

Release files for crypto-fx-converter 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crypto-fx-converter 1.0.0
File Size Uploaded Provenance Actions
crypto_fx_converter-1.0.0.tar.gz 6.0 kB Without provenance Details for crypto_fx_converter-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for crypto-fx-converter 1.0.0
File Interpreter ABI Platform Actions
crypto_fx_converter-1.0.0-py3-none-any.whl Python 3 none any Details for crypto_fx_converter-1.0.0-py3-none-any.whl

Total release size: 13.8 kB

Release files / crypto_fx_converter-1.0.0.tar.gz

Download URL crypto_fx_converter-1.0.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
61eb3eb2cd7d204229e8134f15572e72ae6485e8ccee668b6e85dfb935fd3522
BLAKE2b-256 checksum
How to use checksums
fd746c7c9d8ec619eaa318a90e8010fae711b55284544249b8b3ec9395c3c9f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / crypto_fx_converter-1.0.0-py3-none-any.whl

Download URL crypto_fx_converter-1.0.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1575735ec94a05e7b6902f74732921d3ef7f72052d7de8fa39b8f96ba1dd24ec
BLAKE2b-256 checksum
How to use checksums
5c6b81102faf3d8ce9632d3f9e8cde44b766e4d643efa2c06793c996c705505d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for crypto-fx-converter 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.0 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