-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Feature Request: Built-in PnL Tracking and Portfolio Analytics
Summary
Add native portfolio tracking to SlopeSniper to help traders monitor their performance over time without external tools.
Use Case
As a trader, I want to see my realized and unrealized gains/losses, track my portfolio value over time, and understand my trading performance - all within SlopeSniper.
Current Gap
SlopeSniper provides excellent execution tools but lacks portfolio analytics:
- ✅ Can see current wallet balance
- ✅ Can see trade history
- ❌ No starting balance reference
- ❌ No PnL calculation
- ❌ No performance metrics
- ❌ No timeline/charting
Users must manually track this in spreadsheets or build custom scripts.
Proposed Solution
Basic Implementation
Add PnL tracking to existing commands:
# Initialize tracking with current balance as baseline
slopesniper pnl init
# View current PnL
slopesniper pnlOutput example:
Portfolio Performance
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Starting Value: $14.17 (2026-01-27 22:38:31)
Current Value: $12.49
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total PnL: -$1.68 (-11.85%)
Realized PnL: $0.00
Unrealized PnL: -$1.68
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Trades: 1 buy, 0 sells
Win Rate: N/A (no closed positions)
Data Structure
Store in ~/.slopesniper/pnl.db (SQLite):
CREATE TABLE snapshots (
id INTEGER PRIMARY KEY,
timestamp TEXT NOT NULL,
sol_balance REAL,
sol_value_usd REAL,
total_value_usd REAL,
trigger TEXT -- 'manual', 'trade', 'init'
);
CREATE TABLE positions (
id INTEGER PRIMARY KEY,
mint TEXT NOT NULL,
symbol TEXT,
entry_timestamp TEXT,
entry_amount REAL,
entry_cost_usd REAL,
entry_price REAL,
exit_timestamp TEXT,
exit_amount REAL,
exit_value_usd REAL,
exit_price REAL,
realized_pnl REAL,
status TEXT -- 'open', 'closed'
);Auto-Tracking
Automatically log snapshots after trades:
- After
slopesniper buysucceeds → log snapshot - After
slopesniper sellsucceeds → log snapshot + close position - Manual:
slopesniper pnl snapshot→ log current state
Advanced Features (Future)
1. Timeline view
slopesniper pnl timelineShows hourly/daily snapshots in ASCII chart
2. Position-level tracking
slopesniper pnl positionsOpen Positions
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Token Entry Cost Current PnL Age
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Peyote $0.00014 $10.00 $8.81 -$1.19 24m
3. Export
slopesniper pnl export --format csv
slopesniper pnl export --format json4. Statistics
slopesniper pnl statsTrading Statistics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total Trades: 42
Win Rate: 57.14%
Average Gain: +32.5%
Average Loss: -18.2%
Largest Win: +247% ($123)
Largest Loss: -42% ($38)
Average Hold Time: 4.2 hours
5. Reset/Rebase
# Reset starting point to current balance
slopesniper pnl reset
# Set specific starting balance
slopesniper pnl init --starting-value 100Implementation Notes
Storage:
- Use SQLite for structured queries
- Store in
~/.slopesniper/pnl.db - Migrate existing
trade_history.dbif present
Performance:
- Only log on trades, not on every price check
- Keep snapshots table pruned (archive old data)
- Fast queries for common operations
Privacy:
- All data stored locally
- No external services
- User controls retention
Current Workaround
I built a bash + JSON solution:
pnl-tracker.json - Manual tracking database
log-trade.sh - Update after trades
view-pnl.sh - Display summary
Works but requires:
- Running scripts manually after trades
- No integration with SlopeSniper commands
- Fragile JSON parsing
- No historical charting
Benefits
- Better decision making - See if your strategy is working
- Risk management - Track drawdowns and position sizes
- Tax reporting - Export trade history with cost basis
- Motivation - Visual progress tracking
- Professional tool - Compete with centralized exchange UX
Related Issues
- Feature Request: Auto-Sell Based on Market Cap Target #24 - Auto-sell targets (would auto-log PnL when triggered)
- Trade history already exists - this extends it with analytics
Priority
Nice to have but adds significant value:
- Basic PnL (init + current) = high value, low complexity
- Position tracking = medium complexity
- Charts/stats = lower priority, higher complexity
Start with basic PnL in a future release, iterate from there.
Example user flow:
# Day 1: Setup
$ slopesniper pnl init
✅ Baseline set: $100.00 (0.79 SOL)
# Trade some tokens
$ slopesniper buy BONK 25
$ slopesniper sell WIF all
# Check performance
$ slopesniper pnl
Portfolio: $112.50 (+12.50%)
Realized: +$8.00
Unrealized: +$4.50
Trades: 3 (2 closed, 1 open)Clean, simple, valuable. 📊