Increase decimal places for btc and eth conversions. Closes #51

pull/58/head
Miguel Mota 4 years ago
parent 6fafc47a81
commit 7459139c15

@ -32,7 +32,7 @@ func NewCoinGecko() *Service {
return &Service{
client: client,
maxResultsPerPage: 250,
maxPages: 20,
maxPages: 10,
}
}

@ -62,7 +62,7 @@ func FormatPrice(price float64, convert string) float64 {
convert = strings.ToUpper(convert)
pricestr := fmt.Sprintf("%.2f", price)
if convert == "ETH" || convert == "BTC" || price < 1 {
pricestr = fmt.Sprintf("%.5f", price)
pricestr = fmt.Sprintf("%.8f", price)
}
price, _ = strconv.ParseFloat(pricestr, 64)
return price

@ -173,8 +173,8 @@ func (ct *Cointop) RefreshTable() error {
rank,
namecolor(pad.Right(fmt.Sprintf("%.22s", name), 21, " ")),
ct.colorscheme.TableRow(pad.Right(fmt.Sprintf("%.6s", coin.Symbol), symbolpadding, " ")),
ct.colorscheme.TableColumnPrice(fmt.Sprintf("%12s", humanize.Commaf(coin.Price))),
ct.colorscheme.TableRow(fmt.Sprintf("%18s", humanize.Commaf(coin.MarketCap))),
ct.colorscheme.TableColumnPrice(fmt.Sprintf("%13s", humanize.Commaf(coin.Price))),
ct.colorscheme.TableRow(fmt.Sprintf("%17s", humanize.Commaf(coin.MarketCap))),
ct.colorscheme.TableRow(fmt.Sprintf("%15s", humanize.Commaf(coin.Volume24H))),
color1h(fmt.Sprintf("%8.2f%%", coin.PercentChange1H)),
color24h(fmt.Sprintf("%8.2f%%", coin.PercentChange24H)),

Loading…
Cancel
Save