Algorithmic Trading Bot

Automating quantitative financial strategies in a live environment.

Trading bot dashboard or chart

The Objective: Systematic & Disciplined Trading

Financial markets are driven by data, speed, and psychology. To remove emotion and execute strategies with perfect discipline, I developed a multi-strategy algorithmic trading bot. This Python-based system connects to my live brokerage account via its API, allowing it to analyze market data, identify opportunities, and execute trades automatically based on a predefined set of quantitative rules.

Implemented Quantitative Strategies

The bot is not a single algorithm, but a framework designed to run multiple, independent strategies simultaneously. The primary strategies I've developed and deployed include:

1. Leveraged ETF Hedging (TQQQ Risk Management)

This is the most complex strategy, designed to capture the upside of a leveraged ETF like TQQQ while actively managing its significant downside risk.

  • The core of the strategy is a custom formula I developed that incorporates market volatility (like VIX) and interest rate data to determine an optimal hedge ratio.
  • Based on this ratio, the algorithm automatically purchases protective put options to hedge the long TQQQ position.
  • The goal is to systematically reduce drawdowns during market downturns, creating a more favorable risk-adjusted return profile compared to a simple buy-and-hold approach.

2. Statistical Arbitrage: Pairs Trading

This strategy operates on the principle of mean reversion.

  1. The algorithm continuously scans pairs of historically correlated assets (e.g., two stocks in the same sector).
  2. It performs statistical tests, such as the Augmented Dickey-Fuller test, to check for cointegration (a stationary, long-term relationship).
  3. When the price ratio between two cointegrated assets diverges significantly from its historical mean, the bot simultaneously goes long on the undervalued asset and short on the overvalued one, betting on their eventual reconvergence.

3. Market Making

This strategy aims to profit from the bid-ask spread. The bot places simultaneous buy (bid) and sell (ask) orders on a specific asset, providing liquidity to the market. As other market participants execute trades against these orders, the bot captures the small difference between the bid and ask prices. This requires careful management of inventory risk and rapid order placement.

Technological Stack & Learnings

The bot is built in Python, utilizing libraries like `pandas` and `numpy` for data analysis, and the brokerage's official REST API for market data and order execution. Developing this project has been an incredible learning experience in quantitative finance, risk management, and the practical challenges of building robust, automated systems that interact with live, high-stakes environments.