diff --git a/price-feeder/CHANGELOG.md b/price-feeder/CHANGELOG.md index e46ef1ca51..8f33b45094 100644 --- a/price-feeder/CHANGELOG.md +++ b/price-feeder/CHANGELOG.md @@ -62,6 +62,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [#552](https://github.com/umee-network/umee/pull/552) Stop requiring telemetry during config validation. - [#574](https://github.com/umee-network/umee/pull/574) Stop registering metrics endpoint if telemetry is disabled. - [#573](https://github.com/umee-network/umee/pull/573) Strengthen CORS settings. +- [#607](https://github.com/umee-network/umee/pull/607) Fix kraken provider timestamp unit. ### Refactor diff --git a/price-feeder/oracle/provider/huobi.go b/price-feeder/oracle/provider/huobi.go index 8d7c88c72b..aefe6291cb 100644 --- a/price-feeder/oracle/provider/huobi.go +++ b/price-feeder/oracle/provider/huobi.go @@ -267,8 +267,8 @@ func (p *HuobiProvider) setTickerPair(ticker HuobiTicker) { func (p *HuobiProvider) setCandlePair(candle HuobiCandle) { p.mtx.Lock() defer p.mtx.Unlock() - // huobi time period comes in seconds - candle.Tick.TimeStamp = candle.Tick.TimeStamp * 1000 + // convert huobi timestamp seconds -> milliseconds + candle.Tick.TimeStamp = candle.Tick.TimeStamp * int64(time.Second/time.Millisecond) staleTime := PastUnixTime(providerCandlePeriod) candleList := []HuobiCandle{} candleList = append(candleList, candle) diff --git a/price-feeder/oracle/provider/kraken.go b/price-feeder/oracle/provider/kraken.go index cacc42f8da..efa501cd35 100644 --- a/price-feeder/oracle/provider/kraken.go +++ b/price-feeder/oracle/provider/kraken.go @@ -482,6 +482,8 @@ func (p *KrakenProvider) setTickerPair(symbol string, ticker TickerPrice) { func (p *KrakenProvider) setCandlePair(candle KrakenCandle) { p.mtx.Lock() defer p.mtx.Unlock() + // convert kraken timestamp seconds -> milliseconds + candle.TimeStamp = candle.TimeStamp * int64(time.Second/time.Millisecond) staleTime := PastUnixTime(providerCandlePeriod) candleList := []KrakenCandle{} diff --git a/price-feeder/oracle/provider/provider.go b/price-feeder/oracle/provider/provider.go index c3b1dddf7e..61673bb618 100644 --- a/price-feeder/oracle/provider/provider.go +++ b/price-feeder/oracle/provider/provider.go @@ -89,5 +89,5 @@ func newCandlePrice(provider, symbol, lastPrice, volume string, timeStamp int64) // PastUnixTime returns a millisecond timestamp that represents the unix time // minus t. func PastUnixTime(t time.Duration) int64 { - return time.Now().Add(t*-1).Unix() * 1000 + return time.Now().Add(t*-1).Unix() * int64(time.Second/time.Millisecond) }