Fix Bybit isolated balance sizing
This commit is contained in:
@@ -43,9 +43,15 @@ class OrderValidator:
|
||||
quantity = _round_down(quantity, instrument.qty_step)
|
||||
notional = quantity * entry
|
||||
if quantity < instrument.min_qty:
|
||||
raise OrderRejected("Calculated quantity is below instrument minimum")
|
||||
raise OrderRejected(
|
||||
f"Calculated quantity {quantity} is below instrument minimum {instrument.min_qty} "
|
||||
f"(available_balance={account.available_balance}, leverage={leverage}, entry_price={entry})"
|
||||
)
|
||||
if notional < instrument.min_notional:
|
||||
raise OrderRejected("Calculated notional is below instrument minimum")
|
||||
raise OrderRejected(
|
||||
f"Calculated notional {notional} is below instrument minimum {instrument.min_notional} "
|
||||
f"(available_balance={account.available_balance}, quantity={quantity}, entry_price={entry})"
|
||||
)
|
||||
|
||||
rounded_entry = _round_price(entry, instrument.tick_size)
|
||||
stop = _round_price(request.stop_loss, instrument.tick_size)
|
||||
|
||||
Reference in New Issue
Block a user