mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 16:42:41 +00:00
Forex: convert to/from crypto via CoinGecko (keyless)
Wire a curated set of crypto assets (BTC, ETH, SOL, XRP, DOGE, ADA, LTC) into the !fx conversion path only. fxLivePairRate now resolves each side to units-per-USD and crosses them, so USD/fiat/crypto mix uniformly; fiat sides still batch into one Frankfurter call, crypto hits CoinGecko's keyless simple/price with a 60s cache. Analysis (rate/report/setalert) stays fiat-only on purpose -- a daily snapshot buy-signal/52w range is meaningless for 24/7 crypto.
This commit is contained in:
@@ -34,8 +34,12 @@ func fxIsTracked(cur string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// fxFormatRate formats a rate: JPY uses 2 decimal places, others use 4.
|
||||
// fxFormatRate formats a rate: crypto uses up to 8 decimals (trailing zeros
|
||||
// trimmed) for tiny per-USD figures, JPY uses 2, others use 4.
|
||||
func fxFormatRate(currency string, rate float64) string {
|
||||
if fxIsCrypto(currency) {
|
||||
return fxTrimZeros(fmt.Sprintf("%.8f", rate))
|
||||
}
|
||||
if currency == "JPY" {
|
||||
return fmt.Sprintf("%.2f", rate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user