diff --git a/config/marketcap.yaml b/config/marketcap.yaml index d1f8b41bf..7f4caa615 100644 --- a/config/marketcap.yaml +++ b/config/marketcap.yaml @@ -22,5 +22,6 @@ exchangeStrategies: threshold: 1% # max amount to buy or sell per order maxAmount: 1_000 - dryRun: true queryInterval: 1h + orderType: LIMIT_MAKER # LIMIT_MAKER, LIMIT, MARKET + dryRun: true diff --git a/pkg/strategy/marketcap/strategy.go b/pkg/strategy/marketcap/strategy.go index 83800f573..14f6b7d51 100644 --- a/pkg/strategy/marketcap/strategy.go +++ b/pkg/strategy/marketcap/strategy.go @@ -31,11 +31,12 @@ type Strategy struct { QuoteCurrencyWeight fixedpoint.Value `json:"quoteCurrencyWeight"` BaseCurrencies []string `json:"baseCurrencies"` Threshold fixedpoint.Value `json:"threshold"` - DryRun bool `json:"dryRun"` // max amount to buy or sell per order MaxAmount fixedpoint.Value `json:"maxAmount"` // interval to query marketcap data from coinmarketcap - QueryInterval types.Interval `json:"queryInterval"` + QueryInterval types.Interval `json:"queryInterval"` + OrderType types.OrderType `json:"orderType"` + DryRun bool `json:"dryRun"` subscribeSymbol string activeOrderBook *bbgo.ActiveOrderBook @@ -77,6 +78,10 @@ func (s *Strategy) Validate() error { return fmt.Errorf("maxAmount shoud not less than 0") } + if s.OrderType == "" { + s.OrderType = types.OrderTypeLimitMaker + } + return nil } @@ -178,7 +183,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, } diff --git a/pkg/strategy/rebalance/strategy.go b/pkg/strategy/rebalance/strategy.go index 41eef02dc..d4ba35ace 100644 --- a/pkg/strategy/rebalance/strategy.go +++ b/pkg/strategy/rebalance/strategy.go @@ -62,6 +62,10 @@ func (s *Strategy) Validate() error { return fmt.Errorf("maxAmount shoud not less than 0") } + if s.OrderType == "" { + s.OrderType = types.OrderTypeLimitMaker + } + return nil }