xmaker: move notify trade

This commit is contained in:
c9s 2021-05-29 01:41:29 +08:00
parent 3789315214
commit 70284a8c0f

View File

@ -521,10 +521,6 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
func (s *Strategy) handleTrade(trade types.Trade) { func (s *Strategy) handleTrade(trade types.Trade) {
s.tradeC <- trade s.tradeC <- trade
if s.NotifyTrade {
s.Notifiability.Notify(trade)
}
} }
func (s *Strategy) processTrade(trade types.Trade) { func (s *Strategy) processTrade(trade types.Trade) {
@ -537,6 +533,10 @@ func (s *Strategy) processTrade(trade types.Trade) {
return return
} }
if s.NotifyTrade {
s.Notifiability.Notify(trade)
}
log.Infof("identified %s trade %d with an existing order: %d", trade.Symbol, trade.ID, trade.OrderID) log.Infof("identified %s trade %d with an existing order: %d", trade.Symbol, trade.ID, trade.OrderID)
q := fixedpoint.NewFromFloat(trade.Quantity) q := fixedpoint.NewFromFloat(trade.Quantity)