diff --git a/cryptoexchanges/cryptolive/cryptolive.go b/cryptoexchanges/cryptolive/cryptolive.go index 462c144e..b9e641a0 100644 --- a/cryptoexchanges/cryptolive/cryptolive.go +++ b/cryptoexchanges/cryptolive/cryptolive.go @@ -15,33 +15,7 @@ type toCurrency struct { price float32 } -type cResponse struct { - BTC float32 `json:"BTC"` - HBZ float32 `json:"HBZ"` - ETH float32 `json:"ETH"` - EOS float32 `json:"EOS"` - BCH float32 `json:"BCH"` - TRX float32 `json:"TRX"` - XRP float32 `json:"XRP"` - LTC float32 `json:"LTC"` - ETC float32 `json:"ETC"` - ADA float32 `json:"ADA"` - CMT float32 `json:"CMT"` - DASH float32 `json:"DASH"` - ZEC float32 `json:"ZEC"` - IOT float32 `json:"IOT"` - ONT float32 `json:"ONT"` - NEO float32 `json:"NEO"` - BTG float32 `json:"BTG"` - LSK float32 `json:"LSK"` - ELA float32 `json:"ELA"` - DTA float32 `json:"DTA"` - NANO float32 `json:"NANO"` - WTC float32 `json:"WTC"` - DOGE float32 `json:"DOGE"` - USD float32 `json:"USD"` - EUR float32 `json:"EUR"` -} +type cResponse map[string]float32 /* -------------------- Unexported Functions -------------------- */ diff --git a/cryptoexchanges/cryptolive/widget.go b/cryptoexchanges/cryptolive/widget.go index bdfc6655..b7f76103 100644 --- a/cryptoexchanges/cryptolive/widget.go +++ b/cryptoexchanges/cryptolive/widget.go @@ -174,8 +174,7 @@ func makeRequest(currency *fromCurrency) *http.Request { } func setPrices(response *cResponse, currencry *fromCurrency) { - responseRef := reflect.Indirect(reflect.ValueOf(response)) for idx, toCurrency := range currencry.to { - currencry.to[idx].price = responseRef.FieldByName(toCurrency.name).Interface().(float32) + currencry.to[idx].price = (*response)[toCurrency.name] } }