mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
fix/general-order-executor: do not check for base balance for futures orders in reduceQuantityAndSubmitOrder()
This commit is contained in:
parent
79c93e9a0f
commit
06c95a4735
|
@ -230,6 +230,7 @@ func (e *GeneralOrderExecutor) reduceQuantityAndSubmitOrder(ctx context.Context,
|
||||||
var err error
|
var err error
|
||||||
for i := 0; i < submitOrderRetryLimit; i++ {
|
for i := 0; i < submitOrderRetryLimit; i++ {
|
||||||
q := submitOrder.Quantity.Mul(fixedpoint.One.Sub(quantityReduceDelta))
|
q := submitOrder.Quantity.Mul(fixedpoint.One.Sub(quantityReduceDelta))
|
||||||
|
if !e.session.Futures {
|
||||||
if submitOrder.Side == types.SideTypeSell {
|
if submitOrder.Side == types.SideTypeSell {
|
||||||
if baseBalance, ok := e.session.GetAccount().Balance(e.position.Market.BaseCurrency); ok {
|
if baseBalance, ok := e.session.GetAccount().Balance(e.position.Market.BaseCurrency); ok {
|
||||||
q = fixedpoint.Min(q, baseBalance.Available)
|
q = fixedpoint.Min(q, baseBalance.Available)
|
||||||
|
@ -239,6 +240,7 @@ func (e *GeneralOrderExecutor) reduceQuantityAndSubmitOrder(ctx context.Context,
|
||||||
q = fixedpoint.Min(q, quoteBalance.Available.Div(price))
|
q = fixedpoint.Min(q, quoteBalance.Available.Div(price))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
log.Warnf("retrying order, adjusting order quantity: %v -> %v", submitOrder.Quantity, q)
|
log.Warnf("retrying order, adjusting order quantity: %v -> %v", submitOrder.Quantity, q)
|
||||||
|
|
||||||
submitOrder.Quantity = q
|
submitOrder.Quantity = q
|
||||||
|
|
Loading…
Reference in New Issue
Block a user