From 0f49f9fbe59701a10ef787ed43dd4733b3c5d6d9 Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 25 Mar 2023 02:48:27 +0800 Subject: [PATCH] xfunding: add e.AccountUpdate.EventReasonType switch case --- pkg/strategy/xfunding/strategy.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pkg/strategy/xfunding/strategy.go b/pkg/strategy/xfunding/strategy.go index 77e662d73..78648cac2 100644 --- a/pkg/strategy/xfunding/strategy.go +++ b/pkg/strategy/xfunding/strategy.go @@ -332,9 +332,22 @@ func (s *Strategy) CrossRun(ctx context.Context, orderExecutionRouter bbgo.Order } }) - s.futuresSession.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, types.Interval1m, func(kline types.KLine) { - // s.queryAndDetectPremiumIndex(ctx, binanceFutures) - })) + // s.futuresSession.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, types.Interval1m, func(kline types.KLine) {})) + + if binanceStream, ok := s.futuresSession.UserDataStream.(*binance.Stream); ok { + binanceStream.OnAccountUpdateEvent(func(e *binance.AccountUpdateEvent) { + log.Infof("onAccountUpdateEvent: %+v", e) + switch e.AccountUpdate.EventReasonType { + + case binance.AccountUpdateEventReasonDeposit: + + case binance.AccountUpdateEventReasonWithdraw: + + case binance.AccountUpdateEventReasonFundingFee: + + } + }) + } go func() { ticker := time.NewTicker(10 * time.Second)