From 7fb4d2f78db4b434c85f12c9a8e73a39c572de70 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 5 Oct 2021 21:44:39 +0800 Subject: [PATCH] return positionChanged for Process method --- pkg/bbgo/tradecollector.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/bbgo/tradecollector.go b/pkg/bbgo/tradecollector.go index db61d7246..882c66142 100644 --- a/pkg/bbgo/tradecollector.go +++ b/pkg/bbgo/tradecollector.go @@ -53,7 +53,7 @@ func (c *TradeCollector) Emit() { // Process filters the received trades and see if there are orders matching the trades // if we have the order in the order store, then the trade will be considered for the position. // profit will also be calculated. -func (c *TradeCollector) Process() { +func (c *TradeCollector) Process() bool { positionChanged := false c.tradeStore.Filter(func(trade types.Trade) bool { if c.orderStore.Exists(trade.OrderID) { @@ -69,6 +69,8 @@ func (c *TradeCollector) Process() { if positionChanged { c.EmitPositionUpdate(c.position) } + + return positionChanged } func (c *TradeCollector) Run(ctx context.Context) {