Merge pull request #1115 from c9s/bhwu/fix-correct-price-metrics

FIX: [grid2] fix correct price metrics
This commit is contained in:
Yo-An Lin 2023-03-15 22:10:17 +08:00 committed by GitHub
commit 4ac5a2a9e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1124,7 +1124,14 @@ func (s *Strategy) updateGridNumOfOrdersMetrics(grid *Grid) {
metricsGridNumOfMissingOrders.With(baseLabels).Set(float64(numOfMissingOrders))
var numOfOrdersWithCorrectPrice int
priceSet := make(map[fixedpoint.Value]struct{})
for _, order := range makerOrders.Orders() {
// filter out duplicated prices
if _, ok := priceSet[order.Price]; ok {
continue
}
priceSet[order.Price] = struct{}{}
if grid.HasPin(Pin(order.Price)) {
numOfOrdersWithCorrectPrice++
}