Skip to content

Commit

Permalink
liqmaker: add logger to order generator
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Oct 26, 2024
1 parent a48b8f6 commit f4df9a0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/strategy/liquiditymaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
s.orderGenerator = &LiquidityOrderGenerator{
Symbol: s.Symbol,
Market: s.Market,
logger: s.logger,
}

s.liquidityOrderBook = bbgo.NewActiveOrderBook(s.Symbol)
Expand Down Expand Up @@ -390,9 +391,15 @@ func (s *Strategy) placeLiquidityOrders(ctx context.Context) {
if s.MaxPositionExposure.Sign() > 0 {
if positionBase.Abs().Compare(s.MaxPositionExposure) > 0 {
if s.Position.IsLong() {
s.logger.Infof("long position size %f exceeded max position exposure %f, turnning off bid orders",
positionBase.Float64(), s.MaxPositionExposure.Float64())

placeBid = false
}
if s.Position.IsShort() {
s.logger.Infof("short position size %f exceeded max position exposure %f, turnning off ask orders",
positionBase.Float64(), s.MaxPositionExposure.Float64())

placeAsk = false
}
}
Expand Down

0 comments on commit f4df9a0

Please sign in to comment.