mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
xdepthmaker: run profit fixer before s.CrossExchangeMarketMakingStrategy.Initialize
This commit is contained in:
parent
ac43937847
commit
31676cce8e
|
@ -319,19 +319,6 @@ func (s *Strategy) CrossRun(
|
||||||
|
|
||||||
log.Infof("makerSession: %s hedgeSession: %s", makerSession.Name, hedgeSession.Name)
|
log.Infof("makerSession: %s hedgeSession: %s", makerSession.Name, hedgeSession.Name)
|
||||||
|
|
||||||
if err := s.CrossExchangeMarketMakingStrategy.Initialize(ctx, s.Environment, makerSession, hedgeSession, s.Symbol, ID, s.InstanceID()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
s.pricingBook = types.NewStreamBook(s.Symbol)
|
|
||||||
s.pricingBook.BindStream(s.hedgeSession.MarketDataStream)
|
|
||||||
|
|
||||||
s.stopC = make(chan struct{})
|
|
||||||
|
|
||||||
s.authedC = make(chan struct{}, 5)
|
|
||||||
bindAuthSignal(ctx, s.makerSession.UserDataStream, s.authedC)
|
|
||||||
bindAuthSignal(ctx, s.hedgeSession.UserDataStream, s.authedC)
|
|
||||||
|
|
||||||
if s.ProfitFixerConfig != nil {
|
if s.ProfitFixerConfig != nil {
|
||||||
if s.ProfitFixerConfig.TradesSince.Time().IsZero() {
|
if s.ProfitFixerConfig.TradesSince.Time().IsZero() {
|
||||||
return errors.New("tradesSince time can not be zero")
|
return errors.New("tradesSince time can not be zero")
|
||||||
|
@ -349,6 +336,19 @@ func (s *Strategy) CrossRun(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := s.CrossExchangeMarketMakingStrategy.Initialize(ctx, s.Environment, makerSession, hedgeSession, s.Symbol, ID, s.InstanceID()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
s.pricingBook = types.NewStreamBook(s.Symbol)
|
||||||
|
s.pricingBook.BindStream(s.hedgeSession.MarketDataStream)
|
||||||
|
|
||||||
|
s.stopC = make(chan struct{})
|
||||||
|
|
||||||
|
s.authedC = make(chan struct{}, 5)
|
||||||
|
bindAuthSignal(ctx, s.makerSession.UserDataStream, s.authedC)
|
||||||
|
bindAuthSignal(ctx, s.hedgeSession.UserDataStream, s.authedC)
|
||||||
|
|
||||||
if s.RecoverTrade {
|
if s.RecoverTrade {
|
||||||
go s.runTradeRecover(ctx)
|
go s.runTradeRecover(ctx)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user