Skip to content

Errors & Confirmations

HTTP Errors

The SDK raises requests/aiohttp exceptions for non-2xx responses. Wrap calls in try/except for trading-safe behavior:

python
try:
    client.buy("AAPL", 10)
except Exception as exc:
    print("Order failed:", exc)

Confirmations

Some IBKR orders return warning prompts. Use force=True on order methods to auto-confirm.

python
client.place_bracket_order(
    symbol="AAPL",
    quantity=10,
    side="BUY",
    entry_price=150.0,
    stop_loss=145.0,
    take_profit=160.0,
    force=True
)

Data Availability

If a data field requires a market data subscription, the SDK returns empty data with a note field where applicable. Check the response before relying on it in production logic.