Skip to content

Commit

Permalink
xdepthmaker: log covered position
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Sep 25, 2024
1 parent 2049e72 commit ea858d9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/strategy/xdepthmaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ea858d9

Please sign in to comment.