Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(price-feeder): Parse multiple candles from OsmosisV2 response #1615

Merged
merged 4 commits into from
Nov 22, 2022
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: 4 additions & 0 deletions price-feeder/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Bugs

- [1615](https://github.com/umee-network/umee/pull/1615) Parse multiple candles from OsmosisV2 response

### Improvements

- [1602](https://github.com/umee-network/umee/pull/1602) Remove FTX provider.
Expand Down
14 changes: 8 additions & 6 deletions price-feeder/oracle/provider/osmosisv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (p *OsmosisV2Provider) messageReceived(messageType int, bz []byte) {
messageErr error
tickerResp OsmosisV2Ticker
tickerErr error
candleResp OsmosisV2Candle
candleResp []OsmosisV2Candle
candleErr error
)

Expand Down Expand Up @@ -242,7 +242,7 @@ func (p *OsmosisV2Provider) messageReceived(messageType int, bz []byte) {
if len(v) == 0 {
continue
}
candleString, _ := json.Marshal(v[len(v)-1].(map[string]interface{}))
candleString, _ := json.Marshal(v)
candleErr = json.Unmarshal(candleString, &candleResp)
if candleErr != nil {
p.logger.Error().
Expand All @@ -251,10 +251,12 @@ func (p *OsmosisV2Provider) messageReceived(messageType int, bz []byte) {
Msg("Error on receive message")
continue
}
p.setCandlePair(
osmosisV2Pair,
candleResp,
)
for _, singleCandle := range candleResp {
p.setCandlePair(
osmosisV2Pair,
singleCandle,
)
}
telemetryWebsocketMessage(ProviderOsmosisV2, MessageTypeCandle)
continue
}
Expand Down