Documentation
¶
Overview ¶
Package cryptofx provides zero-dependency crypto-to-fiat conversion, OTC/P2P USDT spread calculation, and multi-chain stablecoin withdrawal fee basis-point comparison.
Live interactive converters & fee references:
- https://holdwins.com/en/crypto-price/ (BTC, ETH, SOL, XRP & Crypto Converter)
- https://holdwins.com/en/crypto-price/usdt/ (USDT to EUR, GBP & Fiat Converter)
- https://holdwins.com/crypto-price/ (比特币与主流币实时汇率换算)
- https://holdwins.com/crypto-price/usdt/ (USDT 人民币实时汇率换算)
- https://holdwins.com/en/guides/binance-usdt-network-fee-guide/
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultUSDTNetworkFees = map[string]float64{
"opBNB": 0.00,
"BEP20": 0.01,
"Polygon": 0.035,
"Arbitrum": 0.10,
"Optimism": 0.10,
"Solana": 0.22,
"ERC20": 0.60,
"TRC20": 2.00,
}
DefaultUSDTNetworkFees lists reference USDT withdrawal fees across major chains.
var ReferenceFiatPerUSD = map[string]float64{
"USD": 1.0,
"EUR": 0.9350,
"GBP": 0.7880,
"CNY": 7.2450,
"CAD": 1.4020,
"AUD": 1.5380,
"JPY": 151.40,
"HKD": 7.7820,
"SGD": 1.3440,
}
ReferenceFiatPerUSD provides baseline mid-market FX rates per 1 USD.
Functions ¶
This section is empty.
Types ¶
type ConversionQuote ¶
type ConversionQuote struct {
Symbol string
Quantity float64
USDPrice float64
USDValue float64
FiatCode string
FXRatePerUSD float64
FiatValue float64
NetFiatAfterFee float64
}
ConversionQuote represents a crypto-to-USD and target-fiat valuation.
func ConvertCryptoFiat ¶
func ConvertCryptoFiat(symbol string, quantity, usdPrice float64, fiatCode string, fxRatePerUSD, tradingFeeRate, rebateRate float64) (ConversionQuote, error)
ConvertCryptoFiat converts an asset quantity into USD and target fiat net of trading fees and rebates.
type NetworkFeeRow ¶
type NetworkFeeRow struct {
Network string
FeeUSDT float64
NetReceivedUSDT float64
CostBps float64
}
NetworkFeeRow ranks a chain's fixed withdrawal fee as basis points of transfer size.
func CompareUSDTNetworkFees ¶
func CompareUSDTNetworkFees(transferUSDT float64, customFees map[string]float64) ([]NetworkFeeRow, error)
CompareUSDTNetworkFees returns chains sorted from lowest to highest withdrawal cost in basis points.
type P2PSpreadQuote ¶
type P2PSpreadQuote struct {
FiatCode string
MidFXRate float64
P2PQuoteRate float64
SpreadPerUSDT float64
SpreadPct float64
SpreadBps float64
USDTReceivedFor1000Fiat float64
}
P2PSpreadQuote quantifies P2P/OTC USDT quote premium or discount vs mid-market FX.
func AnalyzeP2PSpread ¶
func AnalyzeP2PSpread(midFXRate, p2pQuoteRate float64, fiatCode string) (P2PSpreadQuote, error)
AnalyzeP2PSpread computes the percentage and basis-point spread of a P2P USDT quote over mid-market FX.