
Explore four Interactive Brokers API courses covering algorithmic trading with Python, advanced topics like execution and scanner APIs, and options, bond trading, and client portal API.
Explore Interactive Brokers' TWS platform for algorithmic trading with Python API, covering global markets, product types, and separate brokerage and global accounts; learn to use paper trading to test strategies.
Explore Interactive Brokers API architecture, where a lightweight IB gateway sits between your trading application and the broker server, using tcp/ip connectivity rather than a simple restful connection.
Install Anaconda's Biton distribution to access libraries and manage them easily, then use the Anaconda prompt with BEP or Onda to install libraries, e.g., pip install pandas.
Create and manage a dedicated virtual environment using conda to isolate project libraries. Activate the environment, install essential libraries like pandas and spider, and keep versions consistent to avoid conflicts.
Install the IB Python client by running setup.py install in source/python folder, activate your virtual environment, then import the Python API into your IDE for data access and strategy development.
Configure api settings in ws domain and ib gateway to listen to api calls, enabling read-only api, setting ports 7496/7497 (live trading) or 4001/4002 (ip gateway), and restricting to localhost.
Learn object oriented programming in Python by defining classes and objects, using self and __init__, and encapsulating attributes and methods with an employee example for the Interactive Brokers Python API.
Explore how the Python class uses the __init__ magic method, default arguments, and dot notation to instantiate employees, access attributes, and compute salary.
Explore object oriented programming basics with inheritance, subclassing, and the super call to reuse and customize an employee class for subsidiaries and salary logic.
Explore how Python memory management and the global interpreter lock shape multi-threading, then implement threads with a random number generator and a greeting function to see concurrent execution.
Learn how daemon threads run in the background and how to mark them as demon threads in the ib's python api trading module, including termination when the main program ends.
Learn to implement multithreading with an event object, contrasting daemon thread and event-based architectures, using a flag to trigger and stop threads after ten outputs.
Explore WebSocket architecture and how it differs from HTTP and RESTful connections, emphasizing persistent streaming for real-time trading data in Interactive Brokers' Python API.
Learn how ibapi's eclient and ewrapper classes connect a Python trading app to the WS API and translate WS data into a Python-friendly format.
Learn to debug IB API errors caused by function signature changes by updating the error function arguments, consulting documentation and source code, and adapting code across versions.
Learn how to fetch contract information with Interactive Brokers Python API, defining a contract with symbol, security type, exchange, and currency, and retrieving contract details via the contract details function.
Design an asynchronous implementation to manage a persistent WebSocket connection by moving the WebSocket handling to a separate daemon thread, using callback functions, and coordinating with contract details.
Shows how to convert a multi-threading approach from daemon threads to an event-based model, using an event object to wait for WebSocket and retrieve contract info before closing the connection.
Learn to subscribe to market data on Interactive Brokers, configure user settings, and enroll in Nasdaq level one data to enable historical data extraction for trading strategies.
Learn to fetch historical data with IBAPI by calling the historical data function, constructing bar data (open, high, low, close), and configuring request parameters for Nasdaq with smart routing.
Pull historical data for multiple tickers using IB API by defining US tech stock contracts and fetching volume and price data in USD on Nasdaq.
store historical data in a dictionary or data frame within a trading class, capturing open, high, low, close, and volume per ticker, using keys and appended rows.
Store trading app data in a dictionary mapping tickers to data frames, then convert to a single data frame with date as the index for easy analysis.
Learn to extract historical data into a dataframe from Interactive Brokers' Python API, with configurable tickers, duration, and time frame. It also covers iterative extraction with time-based sleeps.
place a simple limit order using the ib api by building a contract and an order, then submit via place order with a unique next valid id.
Refactor the historical data extraction code into reusable contract and order templates, enabling limit, market, and stop-loss orders for Nasdaq stocks like Microsoft.
Cancel pending trades with the Interactive Brokers API; modifications are limited to basic fields, so cancel and replace as needed using next valid ID or request global.
Place and cancel a facebook trade to demonstrate amending orders by changing the limit price to 190, using next valid order id and request id, with lag-aware timing.
Explore essential order types in Interactive Brokers' Python API, including market, limit, stop, and trailing stop orders, and learn to implement them with the next valid order id handling.
Fetch account level data by requesting open orders with the Interactive Brokers Python API, handle the open orders callback, and store results in a data frame for single-strategy trading.
Learn to fetch position level information with interactive broker's python api and store it in a position data frame with account, security type, currency, position, and average cost.
Develop a trading app object to fetch account summary and profit and loss details, returning cash balances, realized and unrealized pnl, and related account data in a data frame.
Explore technical indicators, their use in trend analysis, and how to call them from Python, noting lagging nature and role in confirming trends with examples like NASED and Bollinger Band.
Learn to visualize and implement technical indicators in the Interactive Brokers TWS terminal, focusing on simple and exponential moving averages using close prices on a line chart.
Explore MACD indicator, its fast and slow moving averages (12 and 26), the MACD and signal lines, crossovers, and using exponential moving averages to avoid false positives.
Explore MACD implementation with IBAPI by building a five-minute close-price moving average framework, calculating the MACD and signal lines, and aligning outputs with interactive brokers data.
Learn how Bollinger bands use a moving average and standard deviations to quantify volatility, creating bands that widen with volatility and tighten when calm. Understand average true range (ADR) as a three-range volatility measure using high-low, high-previous close, and low-previous close differences, and see how ADR reinforces Bollinger signals.
Learn the Python implementation of Bollinger bands with IBAPI by computing moving averages (default 20, exponential vs simple) and the two standard deviation bands on five-minute data.
Learn to implement atr with ibapi by calculating true range as the max of high-low, high-previous close, and low-previous close, then applying an ema over a configurable window.
Explain the relative strength index as a momentum oscillator that signals overbought and oversold conditions and demonstrate its Excel calculation using gains, losses, and a 14-period smoothing.
Implement RSI with IBAPI by extracting historical close prices, computing gains and losses, and smoothing averages to derive the RSI, then compare to the 20-day IB RSI value.
Learn how adx quantifies trend strength from zero to one hundred, with bands signaling weak to extremely strong trends and no directional bias.
Learn to implement the adx indicator in excel, calculating true range, directional movement, di plus and di minus, and a smoothed adx over 14 periods for trend strength.
Learn to implement the adx indicator in python with IBAPI by computing true range, plus dm, minus dm, and exponential moving averages, then derive di and adx.
Explore the stochastic oscillator, a momentum indicator that uses close, lowest low, and highest high over a lookback period to gauge price momentum and overbought or oversold conditions.
Learn how to implement a stochastic oscillator using ibapi in python, computing rolling twenty-lookback high and low, close minus low, and percent gain rate with an exponential moving average.
Back test trading strategies with historical data using interactive brokers to mimic real-world conditions. Factor in slippage and costs, stay conservative, and test before deployment.
Implement CAGR using IBAPI by computing end value over start value from daily returns, applying one-year standard periods, and addressing intraday data considerations.
Learn to compute volatility from returns using standard deviation and annualize with sqrt(252) for daily data, then combine risk and return via the Sharpe ratio to assess IBAPI strategies.
Define and implement maximum drawdown as the key risk metric by tracking the equity (cumulative return) and peaks to measure drawdown percentage.
Discover intraday KPIs for algorithmic trading with Interactive Broker's Python API, including absolute return, win rate, mean return per trade, and maximum consecutive loss, with backtesting notes.
Explore backtesting on Interactive Brokers with a long-only MACD and stochastic strategy. Implement a trailing stop-loss that updates with each period's close to manage risk.
Implement backtesting for the strategy using a historical data frame with 25 Nasdaq stocks and 15-minute candles over one year. Prepare for data fetch delays due to Interactive Brokers limits.
Backtest a multi-signal trading strategy by generating buy signals from macv and the stochastic oscillator, applying adr stop losses, and calculating period returns.
Backtest the strategy by building a data frame of ticker returns across 15-minute periods and calculate KPI metrics like mean return, max drawdown, Sharpe, considering capital allocation and risk-free rate.
Implement intraday KPIs by expanding the scoreboard and refining data structures to capture entry and exact trade prices for each intraday trade.
Assemble a modular trading strategy blueprint by integrating historical data, position and order data frames, non-duplicating callbacks, and market and stop orders within a main loop.
Implement the main function for the McGeady stochastic eight year strategy, preparing positions, handling orders, fetching historical data, and adding EMA and stochastic indicators.
Implement a signal-based trading strategy with position awareness, conditional logic for new and existing positions, and placing market and stop-loss orders using Interactive Broker's Python API.
Watch a live demonstration of running a mid-frequency trading strategy with the Interactive Brokers Python API, featuring data extraction, real-time analysis, and market and limit order execution.
Programmatically cancel all open orders and close all positions by using the next valid order id and position callbacks to sell each holding.
Learn to stream tick-by-tick market data with Interactive Broker's Python API, contrast level one and level two data, and capture time, last price, and size in real time.
Manage Interactive Brokers market data lines and stream aggregated snapshot data using request market data, while configuring snapshot, regulatory snapshot, and generic tick options to control costs and data types.
Learn how to stream aggregated snapshot data, extract price, size, time, and volume weighted price from tick strings, compare tick types, and print or store useful fields for real-time trading.
Learn how to store streaming tick data from the Interactive Brokers API in an SQLite database using Python and the escalatory library, including creating tables and defining a primary key.
Store streaming tick data for algorithmic trading in an SQL database by creating tables, inserting time, price, and volume, managing connections, handling exceptions, and addressing thread and timestamp constraints.
Implement a robust tick data store by enforcing unique timestamps in the sql db, using a millisecond loop to resolve duplicates, and streaming ticks with error handling.
Stream live data into a database, inspect table structure with pragma, and run looping queries to store time, price, and volume for real-time analysis.
Learn to build a local database to fetch tick data and convert to five-minute candles using Pandas resample, producing open-high-low-close and volume aggregates.
Design and deploy trading strategies on Interactive Broker's platform. Automate every step of your strategy including, extracting data (stock data and fundamental data), performing technical/fundamental analysis, generating signals, placing trades, risk management etc. Gain a thorough understanding of native interactive broker's API.
You can expect to gain the following skills from this course
API trading
Advanced python concepts (OOP concepts, multi-threading etc.)
Extracting historical data
Extracting fundamental data
Harnessing streaming tick level data
Incorporating technical indicators using python
End to End strategy design and deployment
Handling asynchronous calls
Sqlite database management
Interactive Broker's TWS terminal
Relevant account settings in IB
#############################################################################################
Important note - Course prerequisites:
Please note that this course requires basic python proficiency. At the minimum, you should be comfortable with:
basic python data types and format
basic python data structures such as list, dictionary, tuple etc.
how to create python functions
how to implement loops in python
installing and importing libraries
Basic python proficiency is mandatory because Interactive Broker API's python client uses advanced OOP and asynchronous programming concepts. While, I have devoted an entire section explaining these concepts, students with no python knowledge will really struggle to follow along.
#############################################################################################