mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
Merge pull request #1707 from c9s/c9s/xmaker/stb-improvements
FIX: [xmaker] position metrics missing label
This commit is contained in:
commit
f7f8ecfd15
|
@ -572,11 +572,12 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
|
||||||
bbgo.Notify("Submitting %s hedge order %s %v", s.Symbol, side.String(), quantity)
|
bbgo.Notify("Submitting %s hedge order %s %v", s.Symbol, side.String(), quantity)
|
||||||
orderExecutor := &bbgo.ExchangeOrderExecutor{Session: s.sourceSession}
|
orderExecutor := &bbgo.ExchangeOrderExecutor{Session: s.sourceSession}
|
||||||
returnOrders, err := orderExecutor.SubmitOrders(ctx, types.SubmitOrder{
|
returnOrders, err := orderExecutor.SubmitOrders(ctx, types.SubmitOrder{
|
||||||
Market: s.sourceMarket,
|
Market: s.sourceMarket,
|
||||||
Symbol: s.Symbol,
|
Symbol: s.Symbol,
|
||||||
Type: types.OrderTypeMarket,
|
Type: types.OrderTypeMarket,
|
||||||
Side: side,
|
Side: side,
|
||||||
Quantity: quantity,
|
Quantity: quantity,
|
||||||
|
MarginSideEffect: types.SideEffectTypeMarginBuy,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user