From b820fccce13699a804778cf57666aa8d2a32164a Mon Sep 17 00:00:00 2001 From: narumi Date: Wed, 21 Aug 2024 13:38:54 +0800 Subject: [PATCH] add order type to config --- pkg/strategy/autobuy/strategy.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/autobuy/strategy.go b/pkg/strategy/autobuy/strategy.go index 1fe8beff4..06dadb86c 100644 --- a/pkg/strategy/autobuy/strategy.go +++ b/pkg/strategy/autobuy/strategy.go @@ -31,6 +31,7 @@ type Strategy struct { Symbol string `json:"symbol"` Schedule string `json:"schedule"` MinBaseBalance fixedpoint.Value `json:"minBaseBalance"` + OrderType types.OrderType `json:"orderType"` PriceType types.PriceType `json:"priceType"` Bollinger *types.BollingerSetting `json:"bollinger"` DryRun bool `json:"dryRun"` @@ -81,6 +82,10 @@ func (s *Strategy) Validate() error { } func (s *Strategy) Defaults() error { + if s.OrderType == "" { + s.OrderType = types.OrderTypeLimit + } + if s.PriceType == "" { s.PriceType = types.PriceTypeMaker } @@ -159,7 +164,7 @@ func (s *Strategy) autobuy(ctx context.Context) { submitOrder := types.SubmitOrder{ Symbol: s.Symbol, Side: side, - Type: types.OrderTypeLimitMaker, + Type: s.OrderType, Quantity: quantity, Price: price, }