pinkfish

pinkfish on youtube

A backtester and spreadsheet library for security analysis.

Why another python backtesting library? How is pinkfish different? Simple, I couldn't find a python backtesting library that I allowed me to backtest intraday strategies with daily data. Even simple strategies like 'buying on the close' on the SAME day a 'new 20 day high is set' were not allowed. Additionally, I was put off by the complexity of some of the libraries available, and wanted something simple, that doesn't get in the way, and just allows me to test my trading ideas. One user commented that pinkfish is "very lightweight and to the point". I didn't set out to write a new backtesting library, but I had to. Daily data is free; minute and tick data are typically not. Using minute and tick data can require hours to run vs seconds for daily data.

Some of the key features of pinkfish:

Installation

I recommend using Pinkfish either directly with Linux or using a Linux VM. That said, you should be able to make it work under Windows or MacOS.

This is how I got pinkfish working on Xubuntu 22.04:


# Make sure your system is up to date

sudo apt update
sudo apt upgrade

# Install some preliminary requirements

sudo apt install build-essential
sudo apt install git
sudo apt install python3-pip

# Clone pinkfish repo from Github

git clone https://github.com/fja05680/pinkfish.git
cd pinkfish

# Create virtual Python environment

python -m venv venv
source venv/bin/activate

# Install pinkfish
python setup.py develop

# Install TA-LIB (Optional)

cd ~/Downloads
sudo wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzvf ta-lib-0.4.0-src.tar.gz
cd ta-lib
./configure --prefix=/usr
make
sudo make install
pip install TA-Lib

# Create shared data cache directory (optional)
mkdir $HOME/data
echo [global] > $HOME/.pinkfish
echo base_dir = $HOME >> $HOME/.pinkfish

Examples

Documentation

The pinkfish API documentation