Skip to content

Commit

Permalink
Merge pull request #10277 from vegaprotocol/fix/10276-candles-empty-s…
Browse files Browse the repository at this point in the history
…tring-instead-of-zero

fix: candles where there are no trades should have empty strings for …
  • Loading branch information
ValentinTrinque authored Dec 20, 2023
2 parents 91057f4 + bc3a10d commit dee8710
Show file tree
Hide file tree
Showing 62 changed files with 36,083 additions and 36,064 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
- [10260](https://github.com/vegaprotocol/vega/issues/10260) - `ListCandleData` errors when interval is `block`
- [9677](https://github.com/vegaprotocol/vega/issues/9677) - Removing snapshots and checkpoints do not fail on missing or corrupt state.
- [10267](https://github.com/vegaprotocol/vega/issues/10267) - `ListCandleData` errors when market is in opening auction
- [10276](https://github.com/vegaprotocol/vega/issues/10276) - `ListCandleData` should return empty strings instead of zero for prices when being gap filled.
- [10278](https://github.com/vegaprotocol/vega/issues/10278) - Transfers connection filtering by `isReward` and party causes error

## 0.73.0
Expand Down
26 changes: 22 additions & 4 deletions datanode/entities/candle.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,31 @@ func (c *Candle) ToV1CandleProto(interval vega.Interval) (*vega.Candle, error) {
}

func (c *Candle) ToV2CandleProto() *v2.Candle {
var openPx, highPx, lowPx, closePx string

if c.Open.GreaterThan(decimal.Zero) {
openPx = c.Open.String()
}

if c.High.GreaterThan(decimal.Zero) {
highPx = c.High.String()
}

if c.Low.GreaterThan(decimal.Zero) {
lowPx = c.Low.String()
}

if c.Close.GreaterThan(decimal.Zero) {
closePx = c.Close.String()
}

return &v2.Candle{
Start: c.PeriodStart.UnixNano(),
LastUpdate: c.LastUpdateInPeriod.UnixNano(),
High: c.High.String(),
Low: c.Low.String(),
Open: c.Open.String(),
Close: c.Close.String(),
High: highPx,
Low: lowPx,
Open: openPx,
Close: closePx,
Volume: c.Volume,
Notional: c.Notional,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
]
}
},
"Duration": 2163432
"Duration": 1964792
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
]
}
},
"Duration": 1546725
"Duration": 1712871
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
]
}
},
"Duration": 3713090
"Duration": 3914986
}
Original file line number Diff line number Diff line change
Expand Up @@ -1184,5 +1184,5 @@
]
}
},
"Duration": 48098361
"Duration": 58085241
}
Original file line number Diff line number Diff line change
Expand Up @@ -1184,5 +1184,5 @@
]
}
},
"Duration": 4935888
"Duration": 4376640
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"targetAddress": "0x0b755ae366FE0368F5b0D1879002B06e9Af40f26"
}
},
"Duration": 1855847
"Duration": 1984137
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
}
}
},
"Duration": 2972972
"Duration": 4654750
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
}
}
},
"Duration": 5540371
"Duration": 2582263
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
}
}
},
"Duration": 6504054
"Duration": 6316078
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
}
}
},
"Duration": 2920870
"Duration": 2782709
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@
]
}
},
"Duration": 2862761
"Duration": 3396689
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,5 @@
]
}
},
"Duration": 4310381
"Duration": 4705386
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@
]
}
},
"Duration": 4198982
"Duration": 4132543
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@
]
}
},
"Duration": 3327352
"Duration": 3310644
}
2 changes: 1 addition & 1 deletion datanode/integration/testdata/golden/TestMarkets
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,5 @@
]
}
},
"Duration": 3321136
"Duration": 3080166
}
2 changes: 1 addition & 1 deletion datanode/integration/testdata/golden/TestMarkets_Accounts
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
]
}
},
"Duration": 1732086
"Duration": 1639398
}
2 changes: 1 addition & 1 deletion datanode/integration/testdata/golden/TestMarkets_Basic
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
]
}
},
"Duration": 444126
"Duration": 498671
}
Loading

0 comments on commit dee8710

Please sign in to comment.