xdepthmaker: log covered position

This commit is contained in:
c9s 2024-09-25 16:23:06 +08:00
parent d83297b605
commit 67fd15c88f
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -150,12 +150,17 @@ func (s *CrossExchangeMarketMakingStrategy) Initialize(
s.HedgeOrderExecutor.ActiveMakerOrders().OnCanceled(func(o types.Order) {
remaining := o.Quantity.Sub(o.ExecutedQuantity)
log.Infof("canceled order #%d, remaining quantity: %f", o.OrderID, remaining.Float64())
switch o.Side {
case types.SideTypeSell:
remaining = remaining.Neg()
}
s.CoveredPosition.Sub(remaining)
log.Infof("coveredPosition - %f => %f", remaining.Float64(), s.CoveredPosition.Get().Float64())
})
s.HedgeOrderExecutor.TradeCollector().OnTrade(func(trade types.Trade, profit, netProfit fixedpoint.Value) {