grid2: add order side to the metrics label

This commit is contained in:
c9s 2023-01-10 21:41:10 +08:00
parent 75919a0bf1
commit 0d47afd5fd
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 2 additions and 0 deletions

View File

@ -52,6 +52,7 @@ func initMetrics(extendedLabels []string) {
"exchange", // exchange name "exchange", // exchange name
"symbol", // symbol of the market "symbol", // symbol of the market
"ith", "ith",
"side",
}, extendedLabels...), }, extendedLabels...),
) )

View File

@ -884,6 +884,7 @@ func (s *Strategy) updateOpenOrderPricesMetrics(orders []types.Order) {
metricsGridOrderPrices.Reset() metricsGridOrderPrices.Reset()
for idx, order := range orders { for idx, order := range orders {
labels := s.newPrometheusLabels() labels := s.newPrometheusLabels()
labels["side"] = order.Side.String()
labels["ith"] = strconv.Itoa(num - idx) labels["ith"] = strconv.Itoa(num - idx)
metricsGridOrderPrices.With(labels).Set(order.Price.Float64()) metricsGridOrderPrices.With(labels).Set(order.Price.Float64())
} }