Merge pull request #1707 from c9s/c9s/xmaker/stb-improvements

FIX: [xmaker] position metrics missing label
This commit is contained in:
c9s 2024-08-23 20:12:31 +08:00 committed by GitHub
commit f7f8ecfd15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -577,6 +577,7 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
Type: types.OrderTypeMarket, Type: types.OrderTypeMarket,
Side: side, Side: side,
Quantity: quantity, Quantity: quantity,
MarginSideEffect: types.SideEffectTypeMarginBuy,
}) })
if err != nil { if err != nil {

View File

@ -665,6 +665,7 @@ func (p *Position) updateMetrics() {
labels := prometheus.Labels{ labels := prometheus.Labels{
"strategy_id": p.StrategyInstanceID, "strategy_id": p.StrategyInstanceID,
"strategy_type": p.Strategy, "strategy_type": p.Strategy,
"symbol": p.Symbol,
} }
positionAverageCostMetrics.With(labels).Set(p.AverageCost.Float64()) positionAverageCostMetrics.With(labels).Set(p.AverageCost.Float64())
positionBaseQuantityMetrics.With(labels).Set(p.Base.Float64()) positionBaseQuantityMetrics.With(labels).Set(p.Base.Float64())