grid2: expose order group ID field

This commit is contained in:
c9s 2023-02-08 16:26:37 +08:00
parent 0b73520371
commit 760fc74187
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -115,6 +115,9 @@ type Strategy struct {
// PrometheusLabels will be used as the base prometheus labels
PrometheusLabels prometheus.Labels `json:"prometheusLabels"`
// OrderGroupID is the group ID used for the strategy instance for canceling orders
OrderGroupID uint32 `json:"orderGroupID"`
// FeeRate is used for calculating the minimal profit spread.
// it makes sure that your grid configuration is profitable.
FeeRate fixedpoint.Value `json:"feeRate"`
@ -131,9 +134,6 @@ type Strategy struct {
orderExecutor OrderExecutor
historicalTrades *bbgo.TradeStore
// groupID is the group ID used for the strategy instance for canceling orders
groupID uint32
logger *logrus.Entry
gridReadyCallbacks []func()
@ -1328,7 +1328,9 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
"symbol": s.Symbol,
})
s.groupID = util.FNV32(instanceID)
if s.OrderGroupID == 0 {
s.OrderGroupID = util.FNV32(instanceID)
}
if s.AutoRange != nil {
indicatorSet := session.StandardIndicatorSet(s.Symbol)