riskcontrol: log on release position order

This commit is contained in:
c9s 2023-07-12 16:17:22 +08:00
parent d6ade1f2fd
commit baf431d7b6
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -36,14 +36,16 @@ func NewPositionRiskControl(orderExecutor bbgo.OrderExecutorExtended, hardLimit,
control.OnReleasePosition(func(quantity fixedpoint.Value, side types.SideType) { control.OnReleasePosition(func(quantity fixedpoint.Value, side types.SideType) {
pos := orderExecutor.Position() pos := orderExecutor.Position()
createdOrders, err := orderExecutor.SubmitOrders(context.Background(), types.SubmitOrder{ submitOrder := types.SubmitOrder{
Symbol: pos.Symbol, Symbol: pos.Symbol,
Market: pos.Market, Market: pos.Market,
Side: side, Side: side,
Type: types.OrderTypeMarket, Type: types.OrderTypeMarket,
Quantity: quantity, Quantity: quantity,
}) }
log.Infof("submitting order: %+v", submitOrder)
createdOrders, err := orderExecutor.SubmitOrders(context.Background(), submitOrder)
if err != nil { if err != nil {
log.WithError(err).Errorf("failed to submit orders") log.WithError(err).Errorf("failed to submit orders")
return return