mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
bbgo: add description to the open position options
This commit is contained in:
parent
8dca24e9ee
commit
5f2254e2cb
|
@ -132,24 +132,34 @@ func (e *GeneralOrderExecutor) SubmitOrders(ctx context.Context, submitOrders ..
|
|||
type OpenPositionOptions struct {
|
||||
// Long is for open a long position
|
||||
// Long or Short must be set
|
||||
Long bool
|
||||
Long bool `json:"long"`
|
||||
|
||||
// Short is for open a short position
|
||||
// Long or Short must be set
|
||||
Short bool
|
||||
Short bool `json:"short"`
|
||||
|
||||
// Leverage is used for leveraged position and account
|
||||
Leverage fixedpoint.Value
|
||||
Leverage fixedpoint.Value `json:"leverage,omitempty"`
|
||||
|
||||
Quantity fixedpoint.Value
|
||||
MarketOrder bool
|
||||
LimitOrder bool
|
||||
// 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
|
||||
MarketOrder bool
|
||||
|
||||
// LimitOrder set to true to open a position with a limit order
|
||||
LimitOrder bool
|
||||
|
||||
// LimitTakerRatio 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.
|
||||
LimitTakerRatio fixedpoint.Value
|
||||
CurrentPrice fixedpoint.Value
|
||||
Tag string
|
||||
}
|
||||
|
||||
func (e *GeneralOrderExecutor) OpenPosition(ctx context.Context, options OpenPositionOptions) error {
|
||||
log.Infof("opening %s position: %+v", e.position.Symbol, options)
|
||||
|
||||
price := options.CurrentPrice
|
||||
submitOrder := types.SubmitOrder{
|
||||
Symbol: e.position.Symbol,
|
||||
|
|
Loading…
Reference in New Issue
Block a user