Skip to content

Commit

Permalink
feat: price-feeder: coinbase provider (#648)
Browse files Browse the repository at this point in the history
* coinbase tickers & trades

* trades -> candles

* test stuff

* cleanup :~)

* preallocate

* a couple nit fixes

* leftify the happy path

* add GetAvailablePairs function to coinbase provider

* cl++
  • Loading branch information
adamewozniak authored Mar 21, 2022
1 parent 58be905 commit bf606c1
Show file tree
Hide file tree
Showing 5 changed files with 587 additions and 19 deletions.
1 change: 1 addition & 0 deletions price-feeder/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- [#601](https://github.com/umee-network/umee/pull/601) Use TVWAP formula for determining prices when available.
- [#609](https://github.com/umee-network/umee/pull/609) TVWAP faulty provider detection.
- [#649](https://github.com/umee-network/umee/pull/649) Add "GetAvailablePairs" function to providers.
- [#648](https://github.com/umee-network/umee/pull/648) Add Coinbase as a provider.

### Bug Fixes

Expand Down
30 changes: 16 additions & 14 deletions price-feeder/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ const (
defaultSrvWriteTimeout = 15 * time.Second
defaultSrvReadTimeout = 15 * time.Second

ProviderKraken = "kraken"
ProviderBinance = "binance"
ProviderOsmosis = "osmosis"
ProviderHuobi = "huobi"
ProviderOkx = "okx"
ProviderGate = "gate"
ProviderMock = "mock"
ProviderKraken = "kraken"
ProviderBinance = "binance"
ProviderOsmosis = "osmosis"
ProviderHuobi = "huobi"
ProviderOkx = "okx"
ProviderGate = "gate"
ProviderCoinbase = "coinbase"
ProviderMock = "mock"
)

var (
Expand All @@ -36,13 +37,14 @@ var (
// SupportedProviders defines a lookup table of all the supported currency API
// providers.
SupportedProviders = map[string]struct{}{
ProviderKraken: {},
ProviderBinance: {},
ProviderOsmosis: {},
ProviderOkx: {},
ProviderHuobi: {},
ProviderGate: {},
ProviderMock: {},
ProviderKraken: {},
ProviderBinance: {},
ProviderOsmosis: {},
ProviderOkx: {},
ProviderHuobi: {},
ProviderGate: {},
ProviderCoinbase: {},
ProviderMock: {},
}
)

Expand Down
11 changes: 6 additions & 5 deletions price-feeder/oracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ const (
tickerTimeout = 1000 * time.Millisecond
)

var (
// deviationThreshold defines how many 𝜎 a provider can be away from the mean
// without being considered faulty.
deviationThreshold = sdk.MustNewDecFromStr("2")
)
// deviationThreshold defines how many 𝜎 a provider can be away from the mean
// without being considered faulty.
var deviationThreshold = sdk.MustNewDecFromStr("2")

// PreviousPrevote defines a structure for defining the previous prevote
// submitted on-chain.
Expand Down Expand Up @@ -366,6 +364,9 @@ func NewProvider(ctx context.Context, providerName string, logger zerolog.Logger
case config.ProviderHuobi:
return provider.NewHuobiProvider(ctx, logger, providerPairs...)

case config.ProviderCoinbase:
return provider.NewCoinbaseProvider(ctx, logger, providerPairs...)

case config.ProviderOkx:
return provider.NewOkxProvider(ctx, logger, providerPairs...)

Expand Down
Loading

0 comments on commit bf606c1

Please sign in to comment.