liqmaker: add logger to order generator
Some checks failed
Go / build (1.21, 6.2) (push) Has been cancelled
golang-lint / lint (push) Has been cancelled

This commit is contained in:
c9s 2024-10-26 20:53:28 +08:00
parent a48b8f6544
commit f4df9a09e2
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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)
@ -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
}
}