From 8d4eb611f3737ea23bc7d3f25ff3b6c637343b32 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 12 Sep 2022 23:48:40 +0800 Subject: [PATCH] bbgo: add more open position doc comments --- config/pivotshort.yaml | 11 +++++++++++ pkg/bbgo/order_executor_general.go | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/config/pivotshort.yaml b/config/pivotshort.yaml index 67142b902..025e059b3 100644 --- a/config/pivotshort.yaml +++ b/config/pivotshort.yaml @@ -33,8 +33,19 @@ exchangeStrategies: quantity: 10.0 # marketOrder submits the market sell order when the closed price is lower than the previous pivot low. + # by default we will use market order marketOrder: true + # limitOrder place limit order to open the short position instead of using market order + # this is useful when your quantity or leverage is quiet large. + limitOrder: false + + # limitOrderTakerRatio is the price ratio to adjust your limit order as a taker order. e.g., 0.1% + # for sell order, 0.1% ratio means your final price = price * (1 - 0.1%) + # for buy order, 0.1% ratio means your final price = price * (1 + 0.1%) + # this is only enabled when the limitOrder option set to true + limitOrderTakerRatio: 0 + # bounceRatio is used for calculating the price of the limit sell order. # it's ratio of pivot low bounce when a new pivot low is detected. # Sometimes when the price breaks the previous low, the price might be pulled back to a higher price. diff --git a/pkg/bbgo/order_executor_general.go b/pkg/bbgo/order_executor_general.go index 11cc76d48..89b8ea501 100644 --- a/pkg/bbgo/order_executor_general.go +++ b/pkg/bbgo/order_executor_general.go @@ -138,12 +138,14 @@ type OpenPositionOptions struct { Short bool `json:"-" yaml:"-"` // Leverage is used for leveraged position and account + // Leverage is not effected when using non-leverage spot account Leverage fixedpoint.Value `json:"leverage,omitempty"` - // Quantity will be used first, it will override the leverage if it's given. + // Quantity will be used first, it will override the leverage if it's given Quantity fixedpoint.Value `json:"quantity,omitempty"` // MarketOrder set to true to open a position with a market order + // default is MarketOrder = true MarketOrder bool `json:"marketOrder,omitempty"` // LimitOrder set to true to open a position with a limit order @@ -151,6 +153,11 @@ type OpenPositionOptions struct { // LimitOrderTakerRatio is used when LimitOrder = true, it adjusts the price of the limit order with a ratio. // So you can ensure that the limit order can be a taker order. Higher the ratio, higher the chance it could be a taker order. + // + // limitOrderTakerRatio is the price ratio to adjust your limit order as a taker order. e.g., 0.1% + // for sell order, 0.1% ratio means your final price = price * (1 - 0.1%) + // for buy order, 0.1% ratio means your final price = price * (1 + 0.1%) + // this is only enabled when the limitOrder option set to true LimitOrderTakerRatio fixedpoint.Value `json:"limitOrderTakerRatio,omitempty"` Price fixedpoint.Value `json:"-" yaml:"-"`