mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 02:53:50 +00:00
fixup! get marketcap values from coinmarketcap
This commit is contained in:
parent
e7a7e21b68
commit
71ae75df73
|
@ -23,7 +23,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Strategy struct {
|
type Strategy struct {
|
||||||
Datasource *coinmarketcap.DataSource
|
datasource *coinmarketcap.DataSource
|
||||||
|
|
||||||
Interval types.Interval `json:"interval"`
|
Interval types.Interval `json:"interval"`
|
||||||
BaseCurrency string `json:"baseCurrency"`
|
BaseCurrency string `json:"baseCurrency"`
|
||||||
|
@ -40,7 +40,7 @@ type Strategy struct {
|
||||||
|
|
||||||
func (s *Strategy) Initialize() error {
|
func (s *Strategy) Initialize() error {
|
||||||
apiKey := os.Getenv("COINMARKETCAP_API_KEY")
|
apiKey := os.Getenv("COINMARKETCAP_API_KEY")
|
||||||
s.Datasource = coinmarketcap.New(apiKey)
|
s.datasource = coinmarketcap.New(apiKey)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ func (s *Strategy) getTargetWeights(ctx context.Context) types.ValueMap {
|
||||||
|
|
||||||
// get marketcap from coinmarketcap
|
// get marketcap from coinmarketcap
|
||||||
// set higher query limit to avoid target currency not in the list
|
// set higher query limit to avoid target currency not in the list
|
||||||
marketcaps, err := s.Datasource.QueryMarketCapInUSD(ctx, 100)
|
marketcaps, err := s.datasource.QueryMarketCapInUSD(ctx, 100)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("failed to query market cap")
|
log.WithError(err).Error("failed to query market cap")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user