From 904491e750c54a2975b1d71f8fa133f5d96bd79e Mon Sep 17 00:00:00 2001 From: narumi Date: Thu, 2 Mar 2023 15:56:25 +0800 Subject: [PATCH] add orderType parameter --- config/rebalance.yaml | 4 ++-- pkg/strategy/rebalance/strategy.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/rebalance.yaml b/config/rebalance.yaml index 340c02dc4..e9a01e94b 100644 --- a/config/rebalance.yaml +++ b/config/rebalance.yaml @@ -36,6 +36,6 @@ exchangeStrategies: MAX: 15% USDT: 10% threshold: 1% - # max amount to buy or sell per order - maxAmount: 1_000 + maxAmount: 1_000 # max amount to buy or sell per order + orderType: LIMIT_MAKER # LIMIT, LIMIT_MAKER or MARKET dryRun: false diff --git a/pkg/strategy/rebalance/strategy.go b/pkg/strategy/rebalance/strategy.go index cb1c39559..41eef02dc 100644 --- a/pkg/strategy/rebalance/strategy.go +++ b/pkg/strategy/rebalance/strategy.go @@ -24,9 +24,9 @@ type Strategy struct { QuoteCurrency string `json:"quoteCurrency"` TargetWeights types.ValueMap `json:"targetWeights"` Threshold fixedpoint.Value `json:"threshold"` + MaxAmount fixedpoint.Value `json:"maxAmount"` // max amount to buy or sell per order + OrderType types.OrderType `json:"orderType"` DryRun bool `json:"dryRun"` - // max amount to buy or sell per order - MaxAmount fixedpoint.Value `json:"maxAmount"` activeOrderBook *bbgo.ActiveOrderBook } @@ -199,7 +199,7 @@ func (s *Strategy) generateSubmitOrders(ctx context.Context, session *bbgo.Excha order := types.SubmitOrder{ Symbol: symbol, Side: side, - Type: types.OrderTypeLimit, + Type: s.OrderType, Quantity: quantity, Price: currentPrice, }