diff --git a/CHANGELOG.md b/CHANGELOG.md index 5da6d85..16b754d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.0] - 2019-05-12 +### Added +- Added CoinGecko API support + +### Changed +- Default API from CoinMarketCap to CoinGecko + ## [1.1.6] - 2019-04-23 ### Added - Prompt for CoinMarketCap Pro API Key diff --git a/cmd/cointop.go b/cmd/cointop.go index 62b40e7..0b7b0e3 100644 --- a/cmd/cointop.go +++ b/cmd/cointop.go @@ -18,7 +18,7 @@ func Run() { flag.BoolVar(&reset, "reset", false, "Reset config") flag.StringVar(&config, "config", "", "Config filepath") flag.StringVar(&cmcAPIKey, "coinmarketcap-api-key", "", "CoinMarketCap API key") - flag.StringVar(&apiChoice, "api", cointop.CoinMarketCap, "API choice") + flag.StringVar(&apiChoice, "api", cointop.CoinGecko, "API choice") flag.Parse() if v || ver { fmt.Printf("cointop v%s", cointop.Version()) diff --git a/cointop/common/api/impl/coingecko/coingecko.go b/cointop/common/api/impl/coingecko/coingecko.go index a0f8cf0..610d4ab 100644 --- a/cointop/common/api/impl/coingecko/coingecko.go +++ b/cointop/common/api/impl/coingecko/coingecko.go @@ -204,6 +204,7 @@ func (s *Service) GetGlobalMarketData(convert string) (apitypes.GlobalMarketData ActiveAssets: 0, ActiveMarkets: int(market.Markets), } + return ret, nil } diff --git a/cointop/marketbar.go b/cointop/marketbar.go index 9b5be81..f2b8c24 100644 --- a/cointop/marketbar.go +++ b/cointop/marketbar.go @@ -75,7 +75,9 @@ func (ct *Cointop) updateMarketbar() error { if ok { ct.debuglog("soft cache hit") } - } else { + } + + if market.TotalMarketCapUSD == 0 { market, err = ct.api.GetGlobalMarketData(ct.currencyconversion) if err != nil { filecache.Get(cachekey, &market) diff --git a/cointop/version.go b/cointop/version.go index f5df71c..f547aef 100644 --- a/cointop/version.go +++ b/cointop/version.go @@ -1,7 +1,7 @@ package cointop // TODO: make dynamic based on git tag -const version = "1.1.6" +const version = "1.2.0" func (ct *Cointop) version() string { return version