mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
Merge pull request #1594 from c9s/kbearXD/dca2/round-collector
FIX: [dca2] fix order group id not set issue
This commit is contained in:
commit
819fc59340
|
@ -186,6 +186,10 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
||||||
s.Position.SetTTL(s.PersistenceTTL.Duration())
|
s.Position.SetTTL(s.PersistenceTTL.Duration())
|
||||||
s.ProfitStats.SetTTL(s.PersistenceTTL.Duration())
|
s.ProfitStats.SetTTL(s.PersistenceTTL.Duration())
|
||||||
|
|
||||||
|
if s.OrderGroupID == 0 {
|
||||||
|
s.OrderGroupID = util.FNV32(instanceID) % math.MaxInt32
|
||||||
|
}
|
||||||
|
|
||||||
// round collector
|
// round collector
|
||||||
s.roundCollector = NewRoundCollector(s.logger, s.Symbol, s.OrderGroupID, s.ExchangeSession.Exchange)
|
s.roundCollector = NewRoundCollector(s.logger, s.Symbol, s.OrderGroupID, s.ExchangeSession.Exchange)
|
||||||
if s.roundCollector == nil {
|
if s.roundCollector == nil {
|
||||||
|
@ -215,10 +219,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
||||||
s.OrderExecutor.BindEnvironment(s.Environment)
|
s.OrderExecutor.BindEnvironment(s.Environment)
|
||||||
s.OrderExecutor.Bind()
|
s.OrderExecutor.Bind()
|
||||||
|
|
||||||
if s.OrderGroupID == 0 {
|
|
||||||
s.OrderGroupID = util.FNV32(instanceID) % math.MaxInt32
|
|
||||||
}
|
|
||||||
|
|
||||||
// order executor
|
// order executor
|
||||||
s.OrderExecutor.TradeCollector().OnPositionUpdate(func(position *types.Position) {
|
s.OrderExecutor.TradeCollector().OnPositionUpdate(func(position *types.Position) {
|
||||||
s.logger.Infof("POSITION UPDATE: %s", s.Position.String())
|
s.logger.Infof("POSITION UPDATE: %s", s.Position.String())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user