mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 17:13:51 +00:00
Merge pull request #238 from jessy1092/binance_order
This commit is contained in:
commit
9c666f9a04
|
@ -106,6 +106,7 @@ func (e *ExecutionReportEvent) Order() (*types.Order, error) {
|
|||
switch e.CurrentExecutionType {
|
||||
case "NEW", "CANCELED", "REJECTED", "EXPIRED":
|
||||
case "REPLACED":
|
||||
case "TRADE": // For Order FILLED status. And the order has been completed.
|
||||
default:
|
||||
return nil, errors.New("execution report type is not for order")
|
||||
}
|
||||
|
|
|
@ -169,6 +169,17 @@ func NewStream(client *binance.Client) *Stream {
|
|||
}
|
||||
|
||||
stream.EmitTradeUpdate(*trade)
|
||||
|
||||
order, err := e.Order()
|
||||
if err != nil {
|
||||
log.WithError(err).Error("order convert error")
|
||||
return
|
||||
}
|
||||
|
||||
// Update Order with FILLED event
|
||||
if (order.Status == types.OrderStatusFilled) {
|
||||
stream.EmitOrderUpdate(*order)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user