From 2599a4bcd3ea1927e5c9877ee9fd6182591f9f47 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 7 Oct 2024 17:07:09 +0800 Subject: [PATCH] xmaker: add SubscribeFeeTokenMarkets option --- pkg/strategy/xmaker/strategy.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index a1a24da1f..c8ad15187 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -88,6 +88,8 @@ type Strategy struct { HedgeInterval types.Duration `json:"hedgeInterval"` OrderCancelWaitTime types.Duration `json:"orderCancelWaitTime"` + SubscribeFeeTokenMarkets bool `json:"subscribeFeeTokenMarkets"` + EnableSignalMargin bool `json:"enableSignalMargin"` SignalConfigList []SignalConfig `json:"signals"` SignalMarginScale *bbgo.SlideRule `json:"signalMarginScale,omitempty"` @@ -232,6 +234,13 @@ func (s *Strategy) CrossSubscribe(sessions map[string]*bbgo.ExchangeSession) { sourceSession.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: sig.BollingerBandTrendSignal.Interval}) } } + + if s.SubscribeFeeTokenMarkets { + feeTokenQuote := "USDT" + subscribeOpts := types.SubscribeOptions{Interval: "1m"} + sourceSession.Subscribe(types.KLineChannel, sourceSession.Exchange.PlatformFeeCurrency()+feeTokenQuote, subscribeOpts) + makerSession.Subscribe(types.KLineChannel, makerSession.Exchange.PlatformFeeCurrency()+feeTokenQuote, subscribeOpts) + } } func aggregatePrice(pvs types.PriceVolumeSlice, requiredQuantity fixedpoint.Value) (price fixedpoint.Value) {