Metadata-Version: 2.4
Name: mistake-journal
Version: 0.1.0
Summary: Learn from your trading mistakes. Track patterns in bad decisions.
License: MIT
Project-URL: Homepage, https://github.com/mistake-journal/mistake-journal
Keywords: trading,journal,crypto,stocks,learning
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Requires-Dist: rich>=13.0
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"

# Mistake Journal

[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/brody4321)

[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-support-yellow?logo=buymeacoffee)](https://buymeacoffee.com/brody4321)

Learn from your trading mistakes. Track patterns in your bad decisions.

Mistake Journal is a CLI trade journal that focuses on **what went wrong** and **why**. Log your trades with emotions, reasoning, and outcomes - then analyze patterns in your losing trades to become a better trader.

## Features

- **Trade Logging**: Record entries with emotions, reasoning, market conditions
- **Mistake Tagging**: Categorize errors (FOMO, revenge trade, no stop loss, etc.)
- **Pattern Analysis**: AI identifies recurring mistakes in your history
- **Emotion Tracking**: Correlate emotional state with trade outcomes
- **Weekly Reports**: Summarize wins, losses, and lessons learned
- **Export**: JSON/CSV export for external analysis

## Installation

```bash
pip install mistake-journal
```

## Quick Start

```bash
# Log a new trade
mistake-journal log

# Quick log with inline data
mistake-journal log --symbol BTC --action buy --price 45000 --emotion anxious

# Review your journal
mistake-journal review

# Analyze your mistakes
mistake-journal analyze

# Weekly summary
mistake-journal report --week
```

## Example Session

```
$ mistake-journal log

NEW TRADE ENTRY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Symbol: DOGE
Action [buy/sell]: buy
Entry price: 0.15
Position size ($): 500
Date (enter for now):

PRE-TRADE STATE
How are you feeling? [1-5 scale]
  1=Fearful  2=Anxious  3=Neutral  4=Confident  5=Euphoric
Emotion level: 5

Why did you enter this trade?
> Elon tweeted and it's pumping, don't want to miss out

Did you have a plan before entering? [y/n]: n
Stop loss set? [y/n]: n
Take profit target? [y/n]: n

Tags (comma-separated): fomo, no-plan, social-media
Notes: Saw it on Twitter, jumped in without thinking

Entry logged! Remember to close this trade later with:
  mistake-journal close --id 47
```

```
$ mistake-journal close --id 47

CLOSING TRADE #47 (DOGE)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Exit price: 0.11
Exit date (enter for now):

OUTCOME: -$133.33 (-26.7%)

POST-TRADE REFLECTION
What went wrong (or right)?
> Bought the top, it dumped right after. Classic.

What would you do differently?
> Wait for a pullback, set a stop loss, don't trade on tweets

Lesson learned: Don't chase pumps based on social media

Trade closed and saved!
```

## Analyze Your Patterns

```
$ mistake-journal analyze

MISTAKE PATTERN ANALYSIS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Total trades: 47
Win rate: 38%
Avg winner: +$234
Avg loser: -$189

TOP MISTAKE PATTERNS:

1. FOMO (12 trades, 83% loss rate)
   - Avg loss: -$201
   - Usually occurs when: emotion level 4-5
   - Common symbols: DOGE, SHIB, meme coins

2. No Stop Loss (18 trades, 67% loss rate)
   - Avg loss when wrong: -$312 (vs -$98 with stops)
   - "Let me just hold and see" → usually gets worse

3. Revenge Trading (6 trades, 100% loss rate)
   - Always follows a losing trade within 1 hour
   - Avg loss: -$287

4. Overconfidence (8 trades, 62% loss rate)
   - Emotion level 5, large position sizes
   - Avg position: 15% of portfolio (vs your 5% rule)

INSIGHTS:
• You perform best when emotion level is 2-3 (neutral/slightly cautious)
• Your worst day is Monday (42% win rate vs 51% other days)
• Trades with a written plan: 58% win rate
• Trades without a plan: 24% win rate

RECOMMENDATION:
Stop trading meme coins on social media hype. Your win rate on
these is 12%. Consider a 24-hour waiting rule for high-emotion trades.
```

## Mistake Tags

Built-in tags (or add your own):

| Tag | Description |
|-----|-------------|
| `fomo` | Fear of missing out - chased a pump |
| `revenge` | Tried to "win back" losses immediately |
| `no-plan` | Entered without clear entry/exit criteria |
| `no-stop` | No stop loss set |
| `oversized` | Position too large for risk tolerance |
| `overtrading` | Too many trades in short period |
| `averaging-down` | Added to a losing position |
| `moved-stop` | Moved stop loss to avoid being stopped out |
| `early-exit` | Sold winner too early out of fear |
| `held-loser` | Held loser hoping it would recover |

## Commands

```bash
mistake-journal log                  # Log new trade
mistake-journal close --id <ID>      # Close a trade
mistake-journal review               # Browse journal entries
mistake-journal analyze              # Pattern analysis
mistake-journal report [--week/--month]  # Performance report
mistake-journal tags                 # Manage custom tags
mistake-journal export --format csv  # Export data
mistake-journal stats                # Quick statistics
```

## Use as Library

```python
from mistake_journal import Journal

journal = Journal()

# Log a trade
trade_id = journal.log_trade(
    symbol="BTC",
    action="buy",
    price=45000,
    size=1000,
    emotion=4,
    reasoning="Breakout pattern",
    tags=["technical", "planned"]
)

# Close it
journal.close_trade(
    trade_id,
    exit_price=48000,
    reflection="Stuck to the plan, took profits at target"
)

# Analyze
analysis = journal.analyze()
print(analysis.top_mistakes)
print(analysis.recommendations)
```

## Storage

Journal data stored locally in `~/.mistake-journal/`:
- `trades.json` - All trade entries
- `config.json` - Settings
- `tags.json` - Custom tags

## Philosophy

The goal isn't to track P&L (use a spreadsheet for that). The goal is to:

1. **Force reflection** on every trade
2. **Identify patterns** you can't see in the moment
3. **Build self-awareness** about emotional trading
4. **Create accountability** through written records

Most traders repeat the same 3-4 mistakes. Find yours. Fix them.

## License

MIT License
