Turn raw backtest order data into actionable diagnostic reports. Feed the output directly to an LLM for strategy improvement decisions.
Use this skill when the user has completed a backtest and wants to understand why the strategy performed the way it did. Typical triggers:
The OrderForensics class takes an orders.csv (and optionally a result.json) and produces a multi-section diagnostic report:
python
from forensics import OrderForensics
forensics = OrderForensics("path/to/orders.csv", "path/to/result.json")
report = forensics.full_diagnosis()
print(report) # LLM-readable text report
Or from CLI:
bash
python3 -c "
from forensics import OrderForensics
f = OrderForensics('orders.csv', 'result.json')
print(f.full_diagnosis())
"
Extracted from result.json: Net Profit, Sharpe Ratio, Drawdown, Win Rate, Expectancy, Alpha, Beta, Total Fees.
orders.csv columns (standard QC export):
text
orderId, symbol, type, direction, quantity, fillPrice, fillQty, fee, status, submitTime, fillTime, tag
The parser automatically separates options from equity (QQQ) orders by extracting the underlying from the symbol field.
A structured plain-text report using emoji markers for quick visual scanning. Designed to be directly consumed by LLMs for follow-up analysis and strategy iteration decisions.
MetricHealthy RangeRed FlagZero rate< 50%> 65% means most options expire worthlessWindfall > 400%>= 2 per year0 means no tail wins to offset lossesMonthly cashflowMixed +/-All negative = structural problemDrawdown streaks< 3 months> 6 months = survival crisis
orderId, symbol, type, direction, quantity, fillPrice, fillQty, fee, status, submitTime, fillTime, tag. Missing columns will cause silent misclassification.equity_symbol parameter (default "QQQ") must match your strategy's anchor equity. If your strategy holds SPY instead of QQQ, pass --equity-symbol SPY or the equity/options split will be wrong.