explaingit

gbeced/pyalgotrade

4,654PythonAudience · dataComplexity · 3/5LicenseSetup · easy

TLDR

PyAlgoTrade is a deprecated Python library for backtesting and running automated trading strategies using technical indicators, the author now recommends their newer project Basana instead.

Mindmap

mindmap
  root((pyalgotrade))
    What it does
      Backtest strategies
      Paper trading
      Live trading Bitcoin
    Tech stack
      Python
      TA-Lib
      pip
    Data sources
      Yahoo Finance CSV
      Google Finance CSV
      Quandl
      NinjaTrader
    Indicators
      Moving averages
      RSI
      Bollinger Bands
    Performance metrics
      Sharpe ratio
      Drawdown analysis
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Backtest a moving average crossover strategy against historical Yahoo Finance CSV data to see how it would have performed.

USE CASE 2

Calculate RSI and Bollinger Bands on historical price data to validate a trading signal before going live.

USE CASE 3

Run a paper trading simulation against real Bitcoin prices on Bitstamp without risking real money.

USE CASE 4

Measure a strategy's Sharpe ratio and maximum drawdown to compare risk-adjusted performance across multiple approaches.

Tech stack

PythonTA-Libpip

Getting it running

Difficulty · easy Time to first run · 30min

Deprecated, Python 2.7/3.7 only, for new projects use Basana by the same author instead.

Apache 2.0, use freely for any purpose including commercial projects, keep the copyright notice.

In plain English

PyAlgoTrade is a Python library for algorithmic trading, meaning code that automatically makes trading decisions based on rules you define. The README prominently notes that this project is deprecated and no longer maintained, and points readers to a newer project called Basana by the same author. The library is built around an event-driven model, where your trading strategy responds to price changes and other market events as they arrive rather than processing data in batches. The original focus was on backtesting, which means running a strategy against historical market data to see how it would have performed in the past. The library also supports paper trading (simulated trading with real market prices but no real money) and live trading, both of which are limited to Bitcoin on the Bitstamp exchange. For analyzing price data, PyAlgoTrade includes a range of common technical indicators: Simple Moving Average, Exponential Moving Average, Relative Strength Index, Bollinger Bands, and others. It can read historical price data from CSV files in formats produced by Yahoo Finance, Google Finance, Quandl, and NinjaTrader. For measuring how well a strategy performs, it provides metrics such as the Sharpe ratio and drawdown analysis, which are standard ways traders evaluate risk and return. It also integrates with TA-Lib, a widely used technical analysis library, and included support for watching Twitter events in real time, which was a common source of market signals at the time the library was active. The library was tested with Python 2.7 and 3.7 and can be installed via pip. Given its deprecated status, new projects should look at Basana instead.

Copy-paste prompts

Prompt 1
Using PyAlgoTrade, write a backtest strategy that buys when the 20-day SMA crosses above the 50-day SMA on Yahoo Finance CSV data.
Prompt 2
How do I calculate RSI and Bollinger Bands for a stock using PyAlgoTrade's built-in technical indicators?
Prompt 3
Show me how to load historical price data from a Quandl CSV file into PyAlgoTrade and run a backtest.
Prompt 4
How do I measure the Sharpe ratio and max drawdown of a PyAlgoTrade backtest result?
Open on GitHub → Explain another repo

← gbeced on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.