https://github.com/seanmayer/algo-trading-broker-testing
Multi-Broker Algorithmic Trading Platform - Proof of Concept
https://github.com/seanmayer/algo-trading-broker-testing
algorithmic-trading automated-trading backtesting broker-integration financial-data forex-trading high-frequency-trading ibkr interactive-brokers market-data oanda-api portfolio-management quantitative-finance real-time-data risk-management streaming-data technical-analysis time-series trading-api-financial-apis trading-bot
Last synced: 5 months ago
JSON representation
Multi-Broker Algorithmic Trading Platform - Proof of Concept
- Host: GitHub
- URL: https://github.com/seanmayer/algo-trading-broker-testing
- Owner: seanmayer
- Created: 2025-10-13T09:36:54.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-12-13T10:28:09.000Z (6 months ago)
- Last Synced: 2025-12-15T00:53:06.418Z (6 months ago)
- Topics: algorithmic-trading, automated-trading, backtesting, broker-integration, financial-data, forex-trading, high-frequency-trading, ibkr, interactive-brokers, market-data, oanda-api, portfolio-management, quantitative-finance, real-time-data, risk-management, streaming-data, technical-analysis, time-series, trading-api-financial-apis, trading-bot
- Language: Jupyter Notebook
- Homepage:
- Size: 792 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Algorithmic Trading Basics
A proof-of-concept for algorithmic trading with OANDA and Interactive Brokers APIs.
## Quick Start
### Prerequisites
- Python 3.8 or higher
- OANDA account (for OANDA examples)
- Interactive Brokers account with TWS/IB Gateway (for IBKR examples)
### Installation
1. **Clone or download this repository**
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Set up your trading credentials** (see Configuration section below)
4. **Start trading!** Open the Jupyter notebooks and begin exploring.
## 📁 Project Structure
```
oanda-algo-trading-basics/
├── brokers/
│ ├── oanda/ # OANDA-specific implementations
│ └── ibkr/ # Interactive Brokers implementations
│ └── notebooks/ # Jupyter notebooks for IBKR
├── requirements.txt # Python dependencies
└── README.md # This file
```
## 📚 Available Notebooks
### Interactive Brokers (IBKR)
- **`HistoricalAccountValues.ipynb`** - Fetch and analyze historical market data
- **`TradingChallenge.ipynb`** - Complete SMA crossover trading system with performance analysis
## ⚙️ Configuration
### OANDA Setup
1. Create a `.env` file in the project root
2. Add your OANDA credentials:
```
OANDA_API_KEY=your_api_key_here
OANDA_ACCOUNT_ID=your_account_id_here
OANDA_ENVIRONMENT=practice # or 'live' for real trading
```
### Interactive Brokers Setup
1. Install and run TWS (Trader Workstation) or IB Gateway
2. Enable API connections in TWS/Gateway settings:
- Go to Global Configuration → API → Settings
- Enable "Enable ActiveX and Socket Clients"
- Note the Socket Port (usually 7497 for TWS, 4001 for Gateway)
3. The notebooks will connect to `localhost:7497` by default
## 🛡️ Important Safety Notes
⚠️ **ALWAYS USE PAPER TRADING FIRST!**
- Start with demo/paper trading accounts
- Test all strategies thoroughly before risking real money
- The code includes educational examples - modify for your risk tolerance
- Never commit API keys or credentials to version control
## 💡 Getting Started Examples
### 1. Historical Data Analysis
```python
# Run HistoricalAccountValues.ipynb
# - Fetch EUR/USD historical data
# - Analyze price movements
# - Convert data to pandas DataFrames
```
### 2. Complete Trading System
```python
# Run TradingChallenge.ipynb
# - Implement SMA crossover strategy
# - Execute backtests on historical data
# - Analyze performance metrics
# - Optional: Run live signal monitoring
```
## 📊 Features
- ✅ **Multiple Broker Support** - OANDA and Interactive Brokers
- ✅ **Historical Data** - Fetch and analyze market data
- ✅ **Trading Strategies** - SMA crossover and more
- ✅ **Risk Management** - Stop-loss, take-profit, position sizing
- ✅ **Performance Analysis** - Win rate, Sharpe ratio, drawdown analysis
- ✅ **Visualization** - Charts and performance metrics
- ✅ **Backtesting** - Test strategies on historical data
## 🔧 Dependencies
Key libraries used:
- **ib_async** - Interactive Brokers API
- **oandapyV20** - OANDA REST API
- **pandas/numpy** - Data analysis
- **matplotlib** - Visualization
- **requests** - HTTP requests
## 🤝 Contributing
This is a proof-of-concept project. Feel free to:
- Add new trading strategies
- Improve risk management
- Add support for other brokers
- Enhance visualizations
## ⚠️ Disclaimer
This software is for educational purposes only. Trading involves significant risk of loss. The authors are not responsible for any financial losses incurred through the use of this software. Always do your own research and consider consulting with a financial advisor.
## 📞 Support
For questions or issues:
1. Check the notebook comments and documentation
2. Review the broker API documentation
3. Test with paper trading accounts first
4. Ensure all dependencies are properly installed
---
**Happy Trading! 📈**