diff --git a/price-feeder/config/config.go b/price-feeder/config/config.go index ddfcb57dac..d7dbece74e 100644 --- a/price-feeder/config/config.go +++ b/price-feeder/config/config.go @@ -62,6 +62,7 @@ var ( "BTC": {}, "ETH": {}, "ATOM": {}, + "OSMO": {}, } ) diff --git a/price-feeder/oracle/convert.go b/price-feeder/oracle/convert.go index 9400d19c71..03b142dc9d 100644 --- a/price-feeder/oracle/convert.go +++ b/price-feeder/oracle/convert.go @@ -49,7 +49,7 @@ func ConvertCandlesToUSD( } conversionRates := make(map[string]sdk.Dec) - requiredConversions := make(map[provider.Name]types.CurrencyPair) + requiredConversions := make(map[provider.Name][]types.CurrencyPair) for pairProviderName, pairs := range providerPairs { for _, pair := range pairs { @@ -103,23 +103,25 @@ func ConvertCandlesToUSD( } conversionRates[pair.Quote] = cvRate - requiredConversions[pairProviderName] = pair + requiredConversions[pairProviderName] = append(requiredConversions[pairProviderName], pair) } } } // Convert assets to USD. for provider, assetMap := range candles { - conversionRate, ok := conversionRates[requiredConversions[provider].Quote] - if !ok { - continue - } - for asset, assetCandles := range assetMap { - if requiredConversions[provider].Base == asset { - for i := range assetCandles { - assetCandles[i].Price = assetCandles[i].Price.Mul( - conversionRate, - ) + for _, requiredConversion := range requiredConversions[provider] { + conversionRate, ok := conversionRates[requiredConversion.Quote] + if !ok { + continue + } + for asset, assetCandles := range assetMap { + if requiredConversion.Base == asset { + for i := range assetCandles { + assetCandles[i].Price = assetCandles[i].Price.Mul( + conversionRate, + ) + } } } } diff --git a/price-feeder/oracle/provider/osmosisv2.go b/price-feeder/oracle/provider/osmosisv2.go index 33e4f73e16..cf76f821a4 100644 --- a/price-feeder/oracle/provider/osmosisv2.go +++ b/price-feeder/oracle/provider/osmosisv2.go @@ -353,5 +353,5 @@ func (p *OsmosisV2Provider) GetAvailablePairs() (map[string]struct{}, error) { // currencyPairToOsmosisV2Pair receives a currency pair and return osmosisv2 // ticker symbol atomusdt@ticker. func currencyPairToOsmosisV2Pair(cp types.CurrencyPair) string { - return strings.ToUpper(cp.Base + "/" + cp.Quote) + return cp.Base + "/" + cp.Quote } diff --git a/price-feeder/price-feeder.example.toml b/price-feeder/price-feeder.example.toml index d3d14368fd..3d78a4367c 100644 --- a/price-feeder/price-feeder.example.toml +++ b/price-feeder/price-feeder.example.toml @@ -38,6 +38,34 @@ threshold = "2" base = "WBTC" threshold = "1.5" +[[deviation_thresholds]] +base = "BNB" +threshold = "2" + +[[deviation_thresholds]] +base = "JUNO" +threshold = "2" + +[[deviation_thresholds]] +base = "OSMO" +threshold = "2" + +[[deviation_thresholds]] +base = "BTC" +threshold = "1.5" + +[[deviation_thresholds]] +base = "stATOM" +threshold = "2" + +[[deviation_thresholds]] +base = "stOSMO" +threshold = "2" + +[[deviation_thresholds]] +base = "IST" +threshold = "2" + [[currency_pairs]] base = "UMEE" providers = [ @@ -120,6 +148,102 @@ providers = [ ] quote = "USDT" +[[currency_pairs]] +base = "JUNO" +providers = [ + "kraken", +] +quote = "USD" + +[[currency_pairs]] +base = "JUNO" +providers = [ + "bitget", +] +quote = "USDT" + +[[currency_pairs]] +base = "JUNO" +providers = [ + "osmosisv2", +] +quote = "ATOM" + +[[currency_pairs]] +base = "CRO" +providers = [ + "crypto", + "bitget", + "okx", +] +quote = "USDT" + +[[currency_pairs]] +base = "BNB" +providers = [ + "binanceus", + "bitget", + "okx", +] +quote = "USDT" + +[[currency_pairs]] +base = "OSMO" +providers = [ + "osmosisv2", +] +quote = "ATOM" + +[[currency_pairs]] +base = "OSMO" +providers = [ + "bitget", +] +quote = "USDT" + +[[currency_pairs]] +base = "OSMO" +providers = [ + "crypto", +] +quote = "USD" + +[[currency_pairs]] +base = "BTC" +providers = [ + "coinbase", +] +quote = "USD" + +[[currency_pairs]] +base = "BTC" +providers = [ + "huobi", + "kraken", +] +quote = "USDT" + +[[currency_pairs]] +base = "stATOM" +providers = [ + "osmosisv2", +] +quote = "ATOM" + +[[currency_pairs]] +base = "stOSMO" +providers = [ + "osmosisv2", +] +quote = "OSMO" + +[[currency_pairs]] +base = "IST" +providers = [ + "osmosisv2", +] +quote = "OSMO" + [account] address = "umee15nejfgcaanqpw25ru4arvfd0fwy6j8clccvwx4" chain_id = "umee-local-testnet"