Description
Getting InvalidOrder Exception when trying to place bracket orders (stop-loss and take-profit) during backtesting of a strategy (paper trade)
blankly.utils.exceptions.InvalidOrder: Not enough base currency. Available: 0.0. hold: 1.0. requested: 1.0.
# Place orders
state.interface.market_order(symbol, side='buy', size=1)
state.interface.take_profit_order(symbol, size=1, price=take_profit)
state.interface.stop_loss_order(symbol, size=1, price=stop_loss) # Getting the exception here
It happens due to the fact that the quantity is being held after take-profit order
settings.json
Paper account on Binance exchange
Using default settings
Error (if applicable)
> `blankly.utils.exceptions.InvalidOrder: Not enough base currency. Available: 0.0. hold: 1.0. requested: 1.0.`
Platform Info
- Python version: 3.10.13
- Platform: mac-os Ventura 13.5.2 (22G91)