Install
openclaw skills install ibkrClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.
Comprehensive Interactive Brokers (IBKR) TWS/Gateway skill using ib_insync. Includes Python and bash CLIs for account, market data, historical data, contract lookup, scanners, and order lifecycle management.
openclaw skills install ibkrThis skill integrates with Interactive Brokers Trader Workstation (TWS) and IB Gateway through ib_insync, exposing operational IBKR workflows through:
scripts/ibkr_cli.pyscripts/ibkr.shscripts/openclaw.shscripts/get_account_info.pyscripts/get_historical_data.pyscripts/place_order.pyib_insync installed:pip install ib_insync
All CLIs support connection overrides using flags or env vars.
Environment variables:
IBKR_HOST (default 127.0.0.1)IBKR_PORT (default 7497)IBKR_CLIENT_ID (default 1)IBKR_ACCOUNT (optional)Examples:
IBKR_PORT=4002 IBKR_CLIENT_ID=14 ./scripts/ibkr.sh account-summary
python3 scripts/ibkr_cli.py positions --host 127.0.0.1 --port 7496 --account DU123456
./scripts/ibkr.sh <command> [args]
Supported commands:
account (account summary + positions)account-summarypositionsportfoliopnlquotehistoricalplace-ordercancel-orderopen-ordersexecutionscontract-detailsscanner./scripts/openclaw.sh is an alias to the same CLI surface.
python3 scripts/ibkr_cli.py <command> [args]
python3 scripts/ibkr_cli.py account-summary --json
python3 scripts/ibkr_cli.py positions --account DU123456
python3 scripts/ibkr_cli.py portfolio --json
python3 scripts/ibkr_cli.py pnl --account DU123456 --wait 2
python3 scripts/ibkr_cli.py quote --symbol AAPL --sec-type STK --market-data-type 3
python3 scripts/ibkr_cli.py historical --symbol EURUSD --sec-type CASH --duration "30 D" --bar-size "1 hour"
Notes:
"30 D".CASH, default whatToShow is MIDPOINT unless explicitly overridden.python3 scripts/ibkr_cli.py contract-details --symbol ES --sec-type FUT --expiry 202606
python3 scripts/ibkr_cli.py place-order --symbol AAPL --sec-type STK --action BUY --quantity 10 --order-type MKT
python3 scripts/ibkr_cli.py place-order --symbol AAPL --sec-type STK --action SELL --quantity 10 --order-type LMT --limit-price 250 --tif GTC
python3 scripts/ibkr_cli.py open-orders
python3 scripts/ibkr_cli.py cancel-order --order-id 12345
python3 scripts/ibkr_cli.py executions --json
Supported order types in the CLI:
MKTLMTSTPSTP LMTplace-order waits for status updates and surfaces API errors collected during placement.
python3 scripts/ibkr_cli.py scanner --instrument STK --location-code STK.US.MAJOR --scan-code TOP_PERC_GAIN --rows 25
Legacy scripts remain supported and now delegate to the unified CLI:
get_account_info.pyget_historical_data.py (legacy positional mode still works)place_order.py (legacy positional mode still works)The CLI returns non-zero exit codes for:
See references/api_reference.md for IBKR and ib_insync documentation links.