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) {
pos := orderExecutor.Position()
createdOrders, err := orderExecutor.SubmitOrders(context.Background(), types.SubmitOrder{
submitOrder := types.SubmitOrder{
Symbol: pos.Symbol,
Market: pos.Market,
Side: side,
Type: types.OrderTypeMarket,
Quantity: quantity,
})
}
log.Infof("submitting order: %+v", submitOrder)
createdOrders, err := orderExecutor.SubmitOrders(context.Background(), submitOrder)
if err != nil {
log.WithError(err).Errorf("failed to submit orders")
return