bbgo: remove submitOrder notification

This commit is contained in:
c9s 2022-09-19 09:38:57 +08:00
parent f9f2df29e7
commit 59b1e52439
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -109,18 +109,6 @@ type ExchangeOrderExecutor struct {
orderUpdateCallbacks []func(order types.Order) orderUpdateCallbacks []func(order types.Order)
} }
func (e *ExchangeOrderExecutor) notifySubmitOrders(orders ...types.SubmitOrder) {
for _, order := range orders {
// pass submit order as an interface object.
channel, ok := e.RouteObject(&order)
if ok {
NotifyTo(channel, ":memo: Submitting %s %s %s order with quantity: %f @ %f, order: %v", order.Symbol, order.Type, order.Side, order.Quantity.Float64(), order.Price.Float64(), &order)
} else {
Notify(":memo: Submitting %s %s %s order with quantity: %f @ %f, order: %v", order.Symbol, order.Type, order.Side, order.Quantity.Float64(), order.Price.Float64(), &order)
}
}
}
func (e *ExchangeOrderExecutor) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder) (types.OrderSlice, error) { func (e *ExchangeOrderExecutor) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder) (types.OrderSlice, error) {
formattedOrders, err := e.Session.FormatOrders(orders) formattedOrders, err := e.Session.FormatOrders(orders)
if err != nil { if err != nil {
@ -128,19 +116,9 @@ func (e *ExchangeOrderExecutor) SubmitOrders(ctx context.Context, orders ...type
} }
for _, order := range formattedOrders { for _, order := range formattedOrders {
// pass submit order as an interface object.
channel, ok := e.RouteObject(&order)
if ok {
NotifyTo(channel, ":memo: Submitting %s %s %s order with quantity: %f, order: %v", order.Symbol, order.Type, order.Side, order.Quantity.Float64(), &order)
} else {
Notify(":memo: Submitting %s %s %s order with quantity: %f: %v", order.Symbol, order.Type, order.Side, order.Quantity.Float64(), &order)
}
log.Infof("submitting order: %s", order.String()) log.Infof("submitting order: %s", order.String())
} }
e.notifySubmitOrders(formattedOrders...)
createdOrders, _, err := BatchPlaceOrder(ctx, e.Session.Exchange, formattedOrders...) createdOrders, _, err := BatchPlaceOrder(ctx, e.Session.Exchange, formattedOrders...)
return createdOrders, err return createdOrders, err
} }