mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
Merge pull request #957 from c9s/fix/submit-order-notify
bbgo: remove submitOrder notification
This commit is contained in:
commit
cddc70fb0d
|
@ -109,18 +109,6 @@ type ExchangeOrderExecutor struct {
|
|||
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) {
|
||||
formattedOrders, err := e.Session.FormatOrders(orders)
|
||||
if err != nil {
|
||||
|
@ -128,19 +116,9 @@ func (e *ExchangeOrderExecutor) SubmitOrders(ctx context.Context, orders ...type
|
|||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
e.notifySubmitOrders(formattedOrders...)
|
||||
|
||||
createdOrders, _, err := BatchPlaceOrder(ctx, e.Session.Exchange, formattedOrders...)
|
||||
return createdOrders, err
|
||||
}
|
||||
|
|
|
@ -59,25 +59,26 @@ func (m AssetMap) PlainText() (o string) {
|
|||
usd := a.InUSD
|
||||
btc := a.InBTC
|
||||
if !a.InUSD.IsZero() {
|
||||
o += fmt.Sprintf(" %s: %s (≈ %s) (≈ %s)",
|
||||
o += fmt.Sprintf(" %s: %s (≈ %s) (≈ %s)",
|
||||
a.Currency,
|
||||
a.Total.String(),
|
||||
a.NetAsset.String(),
|
||||
USD.FormatMoney(usd),
|
||||
BTC.FormatMoney(btc),
|
||||
) + "\n"
|
||||
sumUsd = sumUsd.Add(usd)
|
||||
sumBTC = sumBTC.Add(btc)
|
||||
} else {
|
||||
o += fmt.Sprintf(" %s: %s",
|
||||
o += fmt.Sprintf(" %s: %s",
|
||||
a.Currency,
|
||||
a.Total.String(),
|
||||
a.NetAsset.String(),
|
||||
) + "\n"
|
||||
}
|
||||
}
|
||||
o += fmt.Sprintf(" Summary: (≈ %s) (≈ %s)",
|
||||
|
||||
o += fmt.Sprintf("Net Asset Value: (≈ %s) (≈ %s)",
|
||||
USD.FormatMoney(sumUsd),
|
||||
BTC.FormatMoney(sumBTC),
|
||||
) + "\n"
|
||||
)
|
||||
return o
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user