From 78c73e4514dad871045725f1de9de2ee1a842146 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 26 Mar 2023 01:32:47 +0800 Subject: [PATCH] bbgo: check e.disableNotify for profit stats --- pkg/bbgo/order_executor_general.go | 6 ++++-- pkg/strategy/xfunding/profitstats.go | 1 + pkg/strategy/xfunding/strategy.go | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 pkg/strategy/xfunding/profitstats.go diff --git a/pkg/bbgo/order_executor_general.go b/pkg/bbgo/order_executor_general.go index db97ae7e0..daba2999c 100644 --- a/pkg/bbgo/order_executor_general.go +++ b/pkg/bbgo/order_executor_general.go @@ -155,8 +155,10 @@ func (e *GeneralOrderExecutor) BindProfitStats(profitStats *types.ProfitStats) { profitStats.AddProfit(*profit) - Notify(profit) - Notify(profitStats) + if !e.disableNotify { + Notify(profit) + Notify(profitStats) + } }) } diff --git a/pkg/strategy/xfunding/profitstats.go b/pkg/strategy/xfunding/profitstats.go new file mode 100644 index 000000000..80467a4ce --- /dev/null +++ b/pkg/strategy/xfunding/profitstats.go @@ -0,0 +1 @@ +package xfunding diff --git a/pkg/strategy/xfunding/strategy.go b/pkg/strategy/xfunding/strategy.go index 3786d232c..174535393 100644 --- a/pkg/strategy/xfunding/strategy.go +++ b/pkg/strategy/xfunding/strategy.go @@ -843,5 +843,6 @@ func (s *Strategy) allocateOrderExecutor(ctx context.Context, session *bbgo.Exch orderExecutor.TradeCollector().OnPositionUpdate(func(position *types.Position) { bbgo.Sync(ctx, s) }) + orderExecutor.BindProfitStats(s.ProfitStats) return orderExecutor }