Metadata-Version: 2.4
Name: tradeloop-tilt-checker
Version: 1.1.0
Summary: Red Day Autopsy CLI: deterministic local statement forensics for first-break trades, leak cost, and next-session seatbelts.
Project-URL: Homepage, https://app.tradeloop.trade
Project-URL: Documentation, https://app.tradeloop.trade/methodology
Project-URL: Source, https://github.com/varunteja0/tradeloop-red-day-autopsy
Project-URL: Issues, https://github.com/varunteja0/tradeloop-red-day-autopsy/issues
Project-URL: Methodology, https://app.tradeloop.trade/methodology
Project-URL: LiftStudy, https://app.tradeloop.trade/methodology/lift-study
Project-URL: FoundersStory, https://app.tradeloop.trade/wall
Author-email: Varun Teja Chunduri <founder@tradeloop.trade>
License: Apache-2.0
License-File: LICENSE
Keywords: behavioural-finance,disposition-effect,prop-firm,prop-trading,revenge-trading,risk-management,tilt-detection,trader-baselines,trading,trading-journal
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Typing :: Typed
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: hypothesis>=6.92; extra == 'dev'
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# TradeLoop Red Day Autopsy

I blew 11 FundingPips evals.

The pattern was always the same: the first loss hurt, but the trade after the
loss broke the account.

TradeLoop Red Day Autopsy takes a real statement and shows:

1. the first trade where your rule stopped being real
2. the cost of the leak in that window
3. the seatbelt rules to carry into the next session

Deterministic. Versioned. Same input, same output. No AI in the score.

This is the open-source reference implementation behind
[TradeLoop](https://app.tradeloop.trade), the hosted Red Day Autopsy and
Tomorrow's Seatbelt product. Run it locally, inspect the math, challenge the
rules, or add broker formats.

## Run It Locally

```bash
pip install tradeloop-tilt-checker
tilt-check examples/sample_trades.csv
```

JSON output for audits, tests, or prop-firm review:

```bash
tilt-check examples/sample_trades.csv --format json --currency USD
```

The CLI never uploads your trades. It reads a local CSV and prints Markdown or
JSON.

Required CSV columns are case-insensitive and alias-friendly:

- `timestamp`
- `symbol`
- `side`
- `entry_price`
- `exit_price`
- `quantity`
- `pnl`
- optional `duration_minutes`
- optional `id`

## What It Detects

This package implements four open-core signatures:

| Signature | What it catches |
|---|---|
| `revenge_size_escalation` | Size jump immediately after a losing trade. |
| `post_loss_tilt_session` | Cluster of trades inside the post-loss window. |
| `loss_streak_oversize` | Three losses followed by a larger recovery attempt. |
| `drawdown_doubling` | Adding size while the recent trade window is already net negative. |

Thresholds use per-trader baselines where possible. A trader is compared to
their own typical size and pace, not a universal lot-size rule.

## Example Output

```json
{
  "engine_version": "rda-0.1.0",
  "privacy": "local_only_no_upload",
  "score": 532,
  "band": "Fragile",
  "first_break_trade": {
    "row": 14,
    "symbol": "XAUUSD",
    "pattern": "revenge_size_escalation",
    "size_multiple": 2.4,
    "minutes_after_loss": 6.0
  },
  "leak_cost": {
    "currency": "USD",
    "amount": 320.0,
    "method": "sum_abs_negative_pnl_on_flagged_break_trades"
  },
  "seatbelts": [
    "No size increase for 15 minutes after a losing trade.",
    "If you take 3 trades after a loss inside the window, stop the session."
  ]
}
```

See [examples](examples/) for synthetic/anonymized statements plus expected
outputs.

## Methodology

The full public explanation is in [METHODOLOGY.md](METHODOLOGY.md).

Short version:

- Sort trades chronologically.
- Build a robust per-trader baseline from median and IQR.
- Evaluate each trade as if it arrived live.
- Freeze every signature fire with evidence.
- Pick the first material break.
- Sum the negative PnL of flagged break trades as leak cost.
- Generate seatbelts from the fired patterns.

This is for discipline forensics, not financial advice and not signal
generation. It does not tell you what to buy or sell.

## Hosted App Vs Open Core

| Capability | This repo | Hosted TradeLoop |
|---|---:|---:|
| Local CSV analysis | Yes | Yes |
| Markdown report | Yes | Yes |
| JSON contract | Yes | Yes |
| First-break trade | Yes | Yes |
| Leak cost | Yes | Yes |
| Seatbelt suggestions | Yes | Yes |
| Multi-statement history | No | Yes |
| Live Seatbelt interrupt | No | Yes, Pro |
| Outcome Receipt | No | Yes |
| Score Card mint/share | No | Yes |
| Prop-firm Passport | No | Yes |
| Broker sync / webhooks | No | Yes |

Use this repo when you want to audit the promise. Use the hosted app when you
want the 60-second product loop and next-session continuity.

- Hosted app: <https://app.tradeloop.trade/score?utm_source=github&utm_medium=oss&utm_campaign=red_day_autopsy>
- Methodology: <https://app.tradeloop.trade/methodology?utm_source=github&utm_medium=oss&utm_campaign=red_day_autopsy>
- Telegram bot: <https://t.me/TradeLoopTiltBot>

## Why This Exists

TradeLoop was built after Varun Teja Chunduri cycled through 11 FundingPips
$5K/$10K evaluation accounts between October 2025 and May 2026. The corrected
public disclosure is roughly Rs 50,000 to Rs 60,000 in evaluation fees and
about $3,000 to $5,000 in cumulative simulated capital wiped.

The point of publishing the core is simple: traders and prop firms should be
able to inspect how the promise is kept.

## Contributing

Good first contributions:

- add a broker CSV format
- add a synthetic example case
- improve a seatbelt rule
- challenge a methodology assumption
- add a parser regression test

Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a PR.

## License

Apache License 2.0. See [LICENSE](LICENSE).