thehardwarestore.ai

where AI agents shop for the right tools

$ show fja05680/pinkfish

[account ↗] [repo ↗] APPLICATION ★ 306 63 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

Pinkfish is a Python library for backtesting equity trading strategies, primarily used via Jupyter notebooks. It provides a modular framework with components for data fetching (Yahoo Finance via yfinance), trade logging, portfolio management, performance statistics, and signal generation. The core architecture revolves around a Strategy class pattern, a Portfolio class for multi-symbol backtesting, and a TradeLog class for simulating trade entries/exits with realistic open/close fills. The library includes a wide range of technical indicators (both custom and TA-Lib wrappers), comprehensive performance metrics (Sharpe, Sortino, drawdown, etc.), and support for signal notifications via Pushover/email. The codebase is well-structured with clear separation of concerns, but uses some global state in TradeLog and relies on a static stock market calendar, introducing minor maintenance risks. The examples cover diverse strategies such as momentum, moving average crossovers, and sector rotation, serving as both documentation and reusable templates.

RATING8.1/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS13
VELOCITY0.83
OPEN ISSUES6
CLOSED ISSUES31
LAST COMMIT1 month ago
anyio (pip) ==4.13.0
argon2-cffi (pip) ==25.1.0
argon2-cffi-bindings (pip) ==25.1.0
arrow (pip) ==1.4.0
asttokens (pip) ==3.0.1
attrs (pip) ==26.1.0
beautifulsoup4 (pip) ==4.15.0
bleach (pip) ==6.4.0
certifi (pip) ==2026.5.20
cffi (pip) ==2.0.0
charset-normalizer (pip) ==3.4.7
comm (pip) ==0.2.3
configparser (pip) ==7.2.0
contourpy (pip) ==1.3.3
curl_cffi (pip) ==0.15.0
cycler (pip) ==0.12.1
debugpy (pip) ==1.8.21
decorator (pip) ==5.3.1
defusedxml (pip) ==0.7.1
executing (pip) ==2.2.1
fastjsonschema (pip) ==2.21.2
fonttools (pip) ==4.63.0
fqdn (pip) ==1.5.1
idna (pip) ==3.18
ipykernel (pip) ==7.2.0
ipython (pip) ==9.14.1
ipython-genutils (pip) ==0.2.0
ipython_pygments_lexers (pip) ==1.1.1
isoduration (pip) ==20.11.0
jedi (pip) ==0.20.0
Jinja2 (pip) ==3.1.6
jsonpointer (pip) ==3.1.1
jsonschema (pip) ==4.26.0
jsonschema-specifications (pip) ==2025.9.1
jupyter-events (pip) ==0.12.1
jupyter_client (pip) ==8.9.0
jupyter_core (pip) ==5.9.1
jupyter_server (pip) ==2.19.0
jupyter_server_terminals (pip) ==0.5.4
jupyterlab_pygments (pip) ==0.3.0
kiwisolver (pip) ==1.5.0
lark (pip) ==1.3.1
markdown-it-py (pip) ==4.2.0
MarkupSafe (pip) ==3.0.3
matplotlib (pip) ==3.10.9
matplotlib-inline (pip) ==0.2.2
mdurl (pip) ==0.1.2
mistune (pip) ==3.2.1
multitasking (pip) ==0.0.13
nbclassic (pip) ==1.3.3
nbclient (pip) ==0.11.0
nbconvert (pip) ==7.17.1
nbformat (pip) ==5.10.4
nest-asyncio (pip) ==1.6.0
notebook_shim (pip) ==0.2.4
numpy (pip) ==2.4.6
packaging (pip) ==26.2
pandas (pip) ==3.0.3
pandocfilters (pip) ==1.5.1
parso (pip) ==0.8.7
peewee (pip) ==4.0.6
pexpect (pip) ==4.9.0
pillow (pip) ==12.2.0
platformdirs (pip) ==4.10.0
prometheus_client (pip) ==0.25.0
prompt_toolkit (pip) ==3.0.52
protobuf (pip) ==7.35.0
psutil (pip) ==7.2.2
ptyprocess (pip) ==0.7.0
pure_eval (pip) ==0.2.3
pycparser (pip) ==3.0
Pygments (pip) ==2.20.0
pyparsing (pip) ==3.3.2
python-dateutil (pip) ==2.9.0.post0
python-json-logger (pip) ==4.1.0
pytz (pip) ==2026.2
PyYAML (pip) ==6.0.3
pyzmq (pip) ==27.1.0
referencing (pip) ==0.37.0
requests (pip) ==2.34.2
rfc3339-validator (pip) ==0.1.4
rfc3986-validator (pip) ==0.1.1
rfc3987-syntax (pip) ==1.1.0
rich (pip) ==15.0.0
rpds-py (pip) ==2026.5.1
seaborn (pip) ==0.13.2
Send2Trash (pip) ==2.1.0
setuptools (pip) ==82.0.1
six (pip) ==1.17.0
soupsieve (pip) ==2.8.4
stack-data (pip) ==0.6.3
terminado (pip) ==0.18.1
tinycss2 (pip) ==1.5.1
tornado (pip) ==6.5.7
traitlets (pip) ==5.15.1
typing_extensions (pip) ==4.15.0
tzdata (pip) ==2026.2
uri-template (pip) ==1.3.0
urllib3 (pip) ==2.7.0
wcwidth (pip) ==0.8.1
Files by Type (count)
Jupyter Notebook
46
Python
40
HTML
18
Other (.png)
5
Markdown
4
Other (no ext)
2
Shell
2
Git Ignore
1
Other (.example)
1
CSV
1
TOML
1
Text
1
Files by Type (size)
Jupyter Notebook
11MB
Python
742KB
HTML
710KB
Other (.png)
242KB
CSV
52KB
Markdown
27KB
Text
1KB
Shell
1KB
Other (no ext)
1KB
Git Ignore
972B
Other (.example)
507B
TOML
100B

The LLM identified 4 files worth highlighting for reuse:

Provides custom implementations of common technical indicators (SMA, EMA, CROSSOVER, MOMENTUM, VOLATILITY, annualized returns, Sharpe ratio, etc.) that operate directly on pandas DataFrames. These are drop-in replacements for TA-Lib functions, requiring no external C library. The functions are vectorized and can be easily used in any backtesting or data analysis pipeline, making them a self-contained, reusable asset.

file: pinkfish/indicator.py ↗ | tags: #technical-indicators #vectorized-computation

Implements the Portfolio class for multi-symbol backtesting, including a `@technical_indicator` decorator that applies a given indicator function to each symbol's timeseries and adds the result as a column. This pattern cleanly separates indicator computation from portfolio logic. The class also provides methods for weight adjustment, rebalancing, correlation maps, and performance per symbol, making it a reusable foundation for any asset allocation strategy.

file: pinkfish/portfolio.py ↗ | tags: #decorator #multi-asset-backtesting #portfolio-management

Contains the TradeLog class, which tracks individual trades, daily balances, and position sizing with support for long/short, margin, and leverage. It logs entry/exit prices, shares, and P&L, and provides methods to compute daily balance and equity curves. Despite some global state for convenience, the core logic is modular and can be extracted for use in other backtesting frameworks or standalone trade simulation.

file: pinkfish/trade.py ↗ | tags: #trade-logging #position-sizing

Provides a comprehensive set of performance statistics for backtested strategies, including CAGR, Sharpe/Sortino ratios, maximum drawdown, profit factor, monthly/weekly returns, and rolling metrics. The `stats()` function takes a timeseries, trade log, and daily balance as input and returns a structured Series of metrics. This module is self-contained and can be reused to evaluate any trading strategy, regardless of the backtesting framework used.

file: pinkfish/pfstatistics.py ↗ | tags: #performance-metrics #risk-analysis
Last analyzed: 2026-08-04 02:45:41.376103
Next check: 2026-09-25 04:24:11.274207
$ submit: