Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10514,11 +10514,11 @@ func TestToggleRateSourceStatus(t *testing.T) {
wantErr: true,
}, {
name: "ok valid source",
source: messari,
source: coinpaprika,
wantErr: false,
}, {
name: "ok already disabled/not initialized || enabled",
source: messari,
source: coinpaprika,
wantErr: false,
}}

Expand Down
4 changes: 3 additions & 1 deletion client/core/exchangeratefetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ var (
var fiatRateFetchers = map[string]rateFetcher{
coinpaprika: FetchCoinpaprikaRates,
dcrdataDotOrg: FetchDcrdataRates,
messari: FetchMessariRates,
// TODO: messari is temporarily disabled until it is decided to procure an API Key.
// messari: FetchMessariRates,
}

// fiatRateInfo holds the fiat rate and the last update time for an
Expand Down Expand Up @@ -170,6 +171,7 @@ func FetchDcrdataRates(ctx context.Context, log dex.Logger, assets map[uint32]*S
// FetchMessariRates retrieves and parses fiat rate data from the Messari API.
// See https://messari.io/api/docs#operation/Get%20Asset%20Market%20Data for
// sample request and response information.
// TODO: Requires an API Key, temporarily disabled.
func FetchMessariRates(ctx context.Context, log dex.Logger, assets map[uint32]*SupportedAsset) map[uint32]float64 {
fiatRates := make(map[uint32]float64)
fetchRate := func(sa *SupportedAsset) {
Expand Down
2 changes: 1 addition & 1 deletion client/webserver/live_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func newTCore() *TCore {
noteFeed: make(chan core.Notification, 1),
fiatSources: map[string]bool{
"dcrdata": true,
"Messari": true,
"Messari": false,
"Coinpaprika": true,
},
lang: "en-US",
Expand Down
6 changes: 3 additions & 3 deletions client/webserver/webserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,16 +865,16 @@ func TestAPI_ToggleRatesource(t *testing.T) {
wantErr error
}{{
name: "Invalid rate source",
source: "binance",
source: "Messari",
wantErr: errors.New("cannot disable unknown fiat rate source"),
want: `{"ok":false,"msg":"cannot disable unknown fiat rate source"}`,
}, {
name: "ok valid source",
source: "Messari",
source: "Coinpaprika",
want: `{"ok":true}`,
}, {
name: "ok already disabled/not initialized",
source: "Messari",
source: "Coinpaprika",
want: `{"ok":true}`,
}}

Expand Down
2 changes: 1 addition & 1 deletion dex/fiatrates/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func fiatSources(cfg Config) []*source {
{
name: messari,
requestInterval: messariRefreshInterval,
disabled: strings.Contains(disabledSources, strings.ToLower(messari)),
disabled: strings.Contains(disabledSources, strings.ToLower(messari)) || true,
getRates: func(ctx context.Context, tickers []string, log dex.Logger) (map[string]float64, error) {
fiatRates := make(map[string]float64)
for _, ticker := range tickers {
Expand Down
3 changes: 0 additions & 3 deletions dex/testing/loadbot/loadbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,6 @@ func liveRate() (float64, error) {
}
as := map[uint32]*core.SupportedAsset{baseID: b, quoteID: q}
liveRates := core.FetchCoinpaprikaRates(ctx, log, as)
if len(liveRates) != 2 {
liveRates = core.FetchMessariRates(ctx, log, as)
}
// If decred check dcrdata.
if len(liveRates) != 2 && (quoteID == 42 || baseID == 42) {
liveRates = core.FetchDcrdataRates(ctx, log, as)
Expand Down