mirror of https://github.com/miguelmota/cointop
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
809 B
Go
21 lines
809 B
Go
package cointop
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
humanize "github.com/dustin/go-humanize"
|
|
"github.com/miguelmota/cointop/pkg/color"
|
|
"github.com/miguelmota/cointop/pkg/pad"
|
|
)
|
|
|
|
func (ct *Cointop) updateMarket() error {
|
|
maxX, _ := ct.g.Size()
|
|
market, err := ct.api.GetGlobalMarketData()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
timeframe := "7 Day"
|
|
fmt.Fprintln(ct.marketview, pad.Right(fmt.Sprintf("%s Chart: %s • Total Market Cap: %s • 24H Volume: %s • BTC Dominance: %.2f%% • Active Currencies: %s • Active Markets: %s", color.Cyan("cointop"), timeframe, color.WhiteBold(humanize.Commaf(market.TotalMarketCapUSD)), humanize.Commaf(market.Total24HVolumeUSD), market.BitcoinPercentageOfMarketCap, humanize.Comma(int64(market.ActiveCurrencies)), humanize.Comma(int64(market.ActiveMarkets))), maxX, " "))
|
|
return nil
|
|
}
|