explaingit

durdenbtc/survival-alpha

3PythonAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

Python CLI that audits trading strategy backtests from TradingView trade logs and flags common bugs like same-bar trades and concentrated profit.

Mindmap

mindmap
  root((survival-alpha))
    Inputs
      TradingView trade log CSV
      Pine Script strategy
      Stocks or crypto flag
    Outputs
      Tearsheet metrics
      Hygiene check report
      Pine to Python backtest diff
    Use Cases
      Audit a TradingView backtest
      Detect overfit strategies
      Convert Pine Script to Python
      Compare Python and TV results
    Tech Stack
      Python
      pipx
      CLI

Things people build with this

USE CASE 1

Audit a TradingView trade log for inflated Sharpe and concentrated profit

USE CASE 2

Print a tearsheet with Sharpe, Sortino, Calmar, and max drawdown for your CSV

USE CASE 3

Convert a Pine Script strategy to Python and diff it against the TradingView log

USE CASE 4

Switch annualization between stocks 252 and crypto 365 days for accurate risk numbers

Tech stack

Pythonpipx

Getting it running

Difficulty · easy Time to first run · 5min

Install with pipx and point the CLI at a TradingView trade log CSV; choose stocks 252 or crypto 365 annualization to match your asset class.

MIT license lets anyone use, modify, and distribute the code, including commercially, as long as the copyright notice is kept.

In plain English

survival-alpha is a small command-line tool written in Python that audits trading strategy backtests for amateur quant traders. Its tagline in the README is that your backtest is lying to you and this library catches it. The user gives it a trade log exported from TradingView, runs one command, and gets back a report of how the strategy performed along with sanity checks that try to flag common bugs and self-deception. In its first mode, the tool reads a CSV file of trades, then prints a tearsheet. The numbers include total return, compound annual growth rate, Sharpe and Sortino ratios, Calmar, maximum drawdown, win rate, profit factor, average win and loss, and average trade duration. The README is clear about the hygiene checks too: it looks for trades with strange durations, trades that enter and exit on the same bar, P&L numbers that do not reconcile, suspiciously high Sharpe ratios, profit that is concentrated in a tiny number of trades, and profit that only came from a single time period. A second mode, listed as version 0.2, converts TradingView's Pine Script strategies into Python and then runs a backtest, optionally diffing the result against a reference TradingView trade log. The README shows a sample output with emoji icons next to each check, so passes and fails are easy to spot. Install instructions point to pipx, which the README describes as an App Store for Python command-line tools. The CLI is invoked as sa, reads files from local data and convert folders, and supports a flag to switch annualization between stocks (252 days per year) and crypto (365 days per year), since that choice changes risk numbers. The project is MIT licensed and the author also runs a Substack and X account.

Copy-paste prompts

Prompt 1
Walk me through running the sa CLI against a TradingView trade log and reading the hygiene check output
Prompt 2
Show me how survival-alpha flags suspiciously high Sharpe ratios and concentrated profit
Prompt 3
Help me convert one of my Pine Script strategies to Python with the v0.2 mode and diff against TradingView
Prompt 4
Explain how the CSV trade log is parsed and which columns are required
Prompt 5
Help me install survival-alpha with pipx and run my first audit
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.