Skip to content

Commit f20d000

Browse files
committed
✨ feat(xmaker): set last price for pnl metrics
1 parent 2b4dfa3 commit f20d000

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/strategy/xmaker/strategy.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,6 +2739,10 @@ func (s *Strategy) CrossRun(
27392739
})
27402740
s.connectorManager.Add(s.marketTradeStream)
27412741
}
2742+
s.marketTradeStream.OnMarketTrade(types.TradeWith(s.Symbol, func(trade types.Trade) {
2743+
// set the last price to enable the unrealized PnL calculation
2744+
s.Position.SetLastPrice(trade.Price)
2745+
}))
27422746

27432747
if s.FastCancel != nil && s.FastCancel.Enabled {
27442748
if err := s.FastCancel.InitializeAndBind(sessions, s); err != nil {

0 commit comments

Comments
 (0)