Disclaimer - These IBKR sessions are for training and research purpose only. Please consult your investment advisor before making any investment decisions.
Use Case
Sample usage of IBKR Python API
- Use Python API and IBKR paper trading account to test some trading strategies
- IBKR C++ API (For basic trading Python API should be sufficient)
References
Dataflow Diagram
Source Code
- https://interactivebrokers.github.io/index.html (Downloadable zip file)
- https://interactivebrokers.github.io/api_software_contribute.html (Sign collaborator agreement and get readonly access to the API on github)
- Docker Compose Update
Session 1:
- Topics Discussed:
- Start the IBKR API container in docker
- Using VS Code remote development run the API test samples
- Place SPY Limit and Market Orders
- Cancel the placed Limit and Market Orders
Video explanation of the code
Session 2:
- Topics Discussed:
- Fetch Stock Details
- Fetch Future Details
- Fetch Option Contract Details
Video explanation of the code
Source Code
Session 3:
- Topics Discussed:
- Order Create
- Order Query
- Order Update
- Order Cancel
- Order Global Cancel
Video explanation of the code
Source Code
References
Reference - IBKR Python API Videos
Session 4:
- Topics Discussed:
- Advanced Orders
- Bracket Order
- Combo Order
- Advanced Orders
Video explanation of the code
Source Code
Session 5:
Use Case
Create a short list of instruments based on a theme:
- Show contracts with the highest percent price increase between the last trade and opening price
- Most Active by Volume
- Options by Put/Call volume/open interest ratio
- Many scenarios are supported per IBKR API Guide
- Topics Discussed:
- Market Scanner:
- Request Market Scanner Parameters
- Request stocks with the highest percent price INCREASE between the last trade and opening prices
- Request US Traded futures
- Market Scanner:
Video explanation of the code
Source Code
References
IBKR Python API Videos
IBKR API Reference Guide
Query Contract Details