Merge branch 'cointop-sh:master' into tcell-events

pull/232/head
Simon Roberts 3 years ago committed by GitHub
commit 000d60b2d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -208,7 +208,7 @@ var DefaultSortBy = "rank"
var DefaultPerPage = uint(100)
// DefaultMaxPages ...
var DefaultMaxPages = uint(35)
var DefaultMaxPages = uint(10)
// DefaultColorscheme ...
var DefaultColorscheme = "cointop"

@ -242,7 +242,7 @@ func (ct *Cointop) SetCurrencyConverstionFn(convert string) func() error {
if err := ct.Save(); err != nil {
return err
}
go ct.UpdateCurrentPageCoins()
go ct.RefreshAll()
return nil
}

@ -46,6 +46,22 @@ func (ct *Cointop) UpdateCoins() error {
return nil
}
// UpdateCurrentPageCoins updates all the coins in the current page
func (ct *Cointop) UpdateCurrentPageCoins() error {
log.Debugf("UpdateCurrentPageCoins(%d)", len(ct.State.coins))
currentPageCoins := make([]string, len(ct.State.coins))
for i, entry := range ct.State.coins {
currentPageCoins[i] = entry.Name
}
coins, err := ct.api.GetCoinDataBatch(currentPageCoins, ct.State.currencyConversion)
if err != nil {
return err
}
go ct.processCoins(coins)
return nil
}
// ProcessCoinsMap processes coins map
func (ct *Cointop) processCoinsMap(coinsMap map[string]types.Coin) {
log.Debug("ProcessCoinsMap()")

@ -15,7 +15,8 @@ draft: false
## What coins does this support?
This supports any coin supported by the API being used to fetch coin information.
This supports any coin supported by the API being used to fetch coin information. There is, however, a limit on the number of coins that
cointop fetches by default. You can increase this by passing `--max-pages` and `--per-page` arguments on the command line.
## How do I set the API to use?

@ -205,7 +205,7 @@ func shortenFloatVal(x float64) string {
return fmt.Sprintf("%.4fB", x/1e9)
}
if x > 1e6 {
return fmt.Sprintf("%.4fB", x/1e6)
return fmt.Sprintf("%.4fM", x/1e6)
}
return fmt.Sprintf("%.4f", x)
}

Loading…
Cancel
Save