mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
bbgo: check options.price when limit order taker ratio is given
This commit is contained in:
parent
14c941c9f3
commit
bfc4cc0db1
|
@ -266,6 +266,10 @@ func (e *GeneralOrderExecutor) OpenPosition(ctx context.Context, options OpenPos
|
|||
// quoteBalance, _ := e.session.Account.Balance(e.position.Market.QuoteCurrency)
|
||||
|
||||
if !options.LimitOrderTakerRatio.IsZero() {
|
||||
if options.Price.IsZero() {
|
||||
return nil, fmt.Errorf("OpenPositionOptions.Price is zero, can not adjust limit taker order price, options given: %+v", options)
|
||||
}
|
||||
|
||||
if options.Long {
|
||||
// use higher price to buy (this ensures that our order will be filled)
|
||||
price = price.Mul(one.Add(options.LimitOrderTakerRatio))
|
||||
|
|
Loading…
Reference in New Issue
Block a user