Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
a567587
Revert "Merge dev to main: Login fix for default admin password"
CryptoGnome Oct 12, 2025
e1013f4
feat(auth): skip password requirement for default "admin" password
CryptoGnome Oct 12, 2025
4ed3f50
feat: add TradingView charts with liquidation database management
birdbathd Nov 18, 2025
bb0a7b6
feat: add infinite historical data loading to chart
birdbathd Nov 18, 2025
0046305
fix: remove duplicate prependHistoricalKlines function
birdbathd Nov 18, 2025
f0b82f3
fix: resolve chart initialization issues with historical data loading
birdbathd Nov 18, 2025
b6299c0
fix: preserve chart view position after user interaction
birdbathd Nov 18, 2025
5c6973e
fix: Add WebSocket keepalive and inactivity monitoring to Hunter
birdbathd Nov 18, 2025
e6aa8c7
feat: Add TP/SL toggle and reorganize chart controls
birdbathd Nov 19, 2025
3a21847
Merge branch 'dev' into feature/tradingview-charts
birdbathd Nov 19, 2025
8d9aad1
fix: prevent duplicate liquidations from accumulated event listeners
birdbathd Nov 19, 2025
57ebca2
feat: add configurable auto-refresh interval for chart (5s to 5min op…
birdbathd Nov 19, 2025
c09577f
perf: optimize auto-refresh to fetch only latest 2 candles instead of…
birdbathd Nov 19, 2025
3aeb2a5
Add volume histogram to TradingView chart with toggle
birdbathd Nov 19, 2025
0164ead
Fix ReferenceError and reduce WebSocket console spam
birdbathd Nov 19, 2025
42657ff
Add debug logging to track Hunter event listener accumulation
birdbathd Nov 19, 2025
de4a230
Revert "Add volume histogram to TradingView chart with toggle"
birdbathd Nov 19, 2025
56556b4
Reduce WebSocket broadcast spam and add eventTime logging
birdbathd Nov 19, 2025
bcc201c
fix: prevent duplicate liquidations with database UNIQUE constraint
birdbathd Nov 20, 2025
87ea43c
chore: restore tranche implementation and docs accidentally deleted b…
birdbathd Nov 20, 2025
6bb2ce2
docs: merge back with dev - restore tranche documentation
birdbathd Nov 20, 2025
2159acc
fix: prevent duplicate liquidation events from inflating threshold co…
birdbathd Nov 21, 2025
0303219
refactor: improve WebSocket reconnection logic to prevent reconnectio…
birdbathd Nov 21, 2025
703fe2f
feat: enable tranche management UI configuration
birdbathd Nov 23, 2025
f045004
feat: enable tranche management system (untested)
birdbathd Nov 23, 2025
c527762
feat: implement protective orders system
birdbathd Nov 23, 2025
2d97d31
Add timestamps to logs UI and initialize ProtectiveOrderService
birdbathd Nov 23, 2025
6882f5b
Remove per-symbol protective order config and fix duplicate service s…
birdbathd Nov 23, 2025
218f606
Fix ProtectiveOrderService initialization check in API
birdbathd Nov 23, 2025
0e07ed4
feat: Transform trailing stop to trailing TP with break-even protecti…
birdbathd Nov 23, 2025
f3a080d
Mobile responsive improvements and performance optimizations
birdbathd Nov 23, 2025
ec6fa3b
Fix desktop layout spacing for better space utilization
birdbathd Nov 23, 2025
673f3b0
Consolidate Recent Orders header into single row
birdbathd Nov 23, 2025
e213fec
chore: add .db-shm files to gitignore
birdbathd Nov 23, 2025
7346ba7
feat: mobile responsiveness and UX improvements
birdbathd Nov 24, 2025
3d6cf0f
fix: trailing take profit activation and minimum profit logic
birdbathd Nov 24, 2025
8dba823
feat: Complete paper trading system with live PnL updates and bot ini…
birdbathd Nov 24, 2025
1d6d9c0
feat: complete paper trading with live PnL and bot initialization fixes
birdbathd Nov 24, 2025
fe4a2e5
feat: complete paper trading with live PnL and bot initialization fixes
birdbathd Nov 24, 2025
c1d60ef
Fix PM2 logs for multi-instance setups
birdbathd Nov 24, 2025
6fd4670
Merge remote-tracking branch 'origin/fix/ui-ux-mobile-optimization' i…
birdbathd Nov 24, 2025
a5c8501
Fix build: resolve linting errors and add build ignore flags
birdbathd Nov 24, 2025
c9e5c99
Fix React Hooks rules violations and build errors
birdbathd Nov 24, 2025
8516d11
Fix auth redirect to use actual host instead of hardcoded localhost
birdbathd Nov 24, 2025
343cf5c
fix: onboarding state now persists server-side instead of localStorage
birdbathd Nov 25, 2025
ca55908
CRITICAL FIX: onboarding config preservation and setup escape
birdbathd Nov 25, 2025
1a3a8ac
fix: comprehensive authentication, security, and onboarding improvements
birdbathd Nov 25, 2025
8bf9d57
chore: remove unused imports and variables per Copilot review
birdbathd Nov 25, 2025
433fc0c
feat: Add historical VWAP line and magnet mode toggle to chart
birdbathd Nov 25, 2025
4f21639
Merge branch 'feature/tradingview-charts' into feature/backtester
birdbathd Nov 25, 2025
2f7bd88
fix: Match VWAP timeframe to chart timeframe to prevent skinny candles
birdbathd Nov 25, 2025
9a10459
fix: Match VWAP timeframe to chart timeframe to prevent skinny candles
birdbathd Nov 25, 2025
c8da385
Fix: Restore desktop layout by adjusting PullToRefresh wrapper position
birdbathd Nov 25, 2025
7741e7e
Merge feature/backtester: Add mobile gestures and fix desktop layout
birdbathd Nov 25, 2025
ea4c12d
feat: Add NumberInput component and position sizing foundation
birdbathd Nov 25, 2025
a97e2e5
refactor: Reorganize position sizing UI for better flow
birdbathd Nov 25, 2025
92cf3c6
feat: Implement dynamic position sizing with auto-update
birdbathd Nov 25, 2025
1c8fbe1
fix: Show saved threshold time window and cooldown values correctly
birdbathd Nov 25, 2025
df4bc78
fix: Show 'Idle' instead of 'Disconnected' on non-dashboard pages
birdbathd Nov 25, 2025
0e8bdac
Merge feature/tradingview-charts: VWAP historical line, magnet mode, …
birdbathd Nov 25, 2025
25cb6d5
fix: Store ALL liquidations in database, not just configured symbols
birdbathd Nov 26, 2025
517431e
feat: Add liquidation discovery page with symbol analysis
birdbathd Nov 26, 2025
353e2cc
fix: Remove shortTradeSize/longTradeSize from config when separate si…
Nov 27, 2025
4d0eb3b
fix: Default discovery to 30d, prevent background tab queue buildup
birdbathd Nov 27, 2025
4ff426f
feat: Add trade quality scoring system with VWAP regime detection, FT…
birdbathd Nov 30, 2025
f7b84f5
Merge feature/liquidation-discovery: Discovery page, database liquida…
birdbathd Nov 30, 2025
affbf7f
Merge feature/protective-orders: Trailing TP with break-even protection
birdbathd Nov 30, 2025
2b41043
Merge feature/paper-trading-improvements: Paper trading PnL and mobil…
birdbathd Nov 30, 2025
503137d
Trade quality scoring: passive mode support, database persistence, UI…
birdbathd Nov 30, 2025
5a316dc
feat(discovery): Restore whale indicators and sentiment analysis from…
birdbathd Nov 30, 2025
b06db2f
fix: TradeQualityPanel now shows VWAP blocks distinctly from quality …
birdbathd Nov 30, 2025
c384eaa
fix: Trade quality service now uses VWAP streamer for spike detection
birdbathd Nov 30, 2025
79f5b23
fix: Trade quality now tracks ALL liquidations and loads historical data
birdbathd Dec 1, 2025
a54c182
feat: Add tooltips to Trade Quality Panel and improve Overview layout
birdbathd Dec 1, 2025
e20e869
fix: Minor syntax fixes in TradeQualityPanel
birdbathd Dec 1, 2025
b9c5c3c
fix: spike detection velocity threshold and real-time price stream
birdbathd Dec 1, 2025
e0e6a8c
feat: add signal price display and MAE/MFE tracking
birdbathd Dec 2, 2025
ec884a4
Replace NextAuth with simple JWT auth, fix WebSocket host auto-detection
birdbathd Dec 4, 2025
b32f1d0
Remove NextAuth, use custom JWT auth
birdbathd Dec 5, 2025
90a7f66
Fix trade quality multiplier in passive mode, remove exchange min fal…
birdbathd Dec 5, 2025
884d854
Add market depth feature to Discovery, fix ws bundling
birdbathd Dec 6, 2025
f8fd5d0
Fix secure cookie only when actually using HTTPS
birdbathd Dec 6, 2025
00b19ed
Add logging for invalid prices from book ticker and liquidation events
birdbathd Dec 7, 2025
73f22a4
Fix stale data on tab visibility and improve error handling
birdbathd Dec 9, 2025
7afb865
SECURITY: Upgrade Next.js to 15.5.7 (CVE-2025-66478)
birdbathd Dec 9, 2025
a4a3e2a
Cleanup and improve defaults
birdbathd Dec 10, 2025
0e95707
Fix bot startup without API keys
birdbathd Dec 10, 2025
a93f4cc
Fix onboarding trade sizes - use USDT margin values
birdbathd Dec 10, 2025
e7ee9f4
Remove accidental doc
birdbathd Dec 10, 2025
6ab65d8
Fix threshold toggle visibility and reduce startup noise
birdbathd Dec 10, 2025
ba58e9a
Remove deprecated @types/uuid and @types/sqlite3 stub packages
birdbathd Dec 10, 2025
1ea8746
Fix FTA Exit Service log spam - add throttling and config toggle
birdbathd Dec 10, 2025
6df5034
Update PR description with FTA fix
birdbathd Dec 10, 2025
eb622e0
Remove ecosystem.config.js from tracking (contains secrets)
birdbathd Dec 10, 2025
37788fd
Fix maxOpenPositions to allow adding to existing positions
birdbathd Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ next-env.d.ts
data/*.db
data/*.db-journal
data/*.db-wal
data/*.db-shm

# user configuration
config.user*
Expand All @@ -54,3 +55,10 @@ data/optimizer-jobs.json
# claude code local settings and agents
.claude/settings.local.json
.claude/agents/

# local development files (not for commit)
[WEB]
ecosystem.config.js
scripts/aster-notifier.cjs
*.swp
.*.swp
232 changes: 232 additions & 0 deletions PR_DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# Major Feature Update: Comprehensive Dashboard Overhaul

## ⚠️ Important Notes

**This is a significant codebase update** with 90 commits, 154 files changed, +31,495/-2,951 lines. It represents several months of development and includes many new features, architectural changes, and bug fixes.

**This PR supersedes the following open PRs:**
- #75 - TradingView Chart with Real-time Updates
- #79 - Protective orders with trailing take profit
- #80 - UI/UX improvements and mobile optimization

Those features are included in this PR along with many additional improvements.

**⚠️ Expect bugs** - This is a substantial rewrite with many new features. Thorough testing is recommended before production use.

---

## 🔐 Breaking Changes

### Authentication System Replaced
- **Removed NextAuth** - Replaced with custom JWT-based authentication using `jose` + `bcryptjs`
- **Password hashing** - Dashboard passwords are now bcrypt hashed (plain text still supported for migration)
- **Cookie changed** - Auth cookie is now `auth-token` instead of `next-auth.session-token`
- **Why**: NextAuth had URL mismatch issues when accessing from different IPs/domains, and compared plain text to hashed passwords incorrectly

### Configuration Changes
- New fields in `config.default.json`: `debugMode`, `websocketPath`, `setupComplete`, `liquidationDatabase`
- `setupComplete` tracks onboarding state server-side (no longer relies on localStorage)
- Default `paperMode: false` and `useTradeQualityScoring: false`

---

## ✨ New Features

### 1. TradingView-Style Interactive Charts
- Full candlestick charting with OHLCV data
- Real-time price updates via WebSocket
- VWAP overlay with historical line
- Liquidation markers on chart
- Order lines for active positions
- Multiple timeframes (1m, 5m, 15m, 1h, 4h, 1d)
- Mobile gesture support (pinch zoom, pan)
- Magnet mode for precise order placement

<!-- TODO: Add screenshot of TradingView chart -->

### 2. Liquidation Discovery Page (`/discovery`)
- Analyze liquidation patterns across ALL symbols
- Volume analysis, frequency metrics, whale detection
- Symbol recommendations based on activity
- Market depth visualization
- Configurable data retention (default 90 days)
- Add symbols directly to config from discovery

<!-- TODO: Add screenshot of Discovery page -->

### 3. Trade Quality Scoring System
- VWAP regime detection (above/below VWAP)
- Spike velocity analysis
- Volume trend scoring
- Quality scores 0-3 affect position sizing (0.5x-1.5x)
- Passive mode: records scores without filtering trades
- Historical tracking with SQLite persistence
- **Disabled by default** - enable in Global Settings

<!-- TODO: Add screenshot of Trade Quality panel -->

### 4. Protective Orders with Trailing Take Profit
- Automatic SL/TP order placement
- Trailing TP that moves to break-even after partial profit
- Configurable activation thresholds
- Works with both long and short positions

### 5. Dynamic Position Sizing
- Percentage of balance mode
- Auto-calculates trade size based on account balance
- Min/max position limits
- Quality-adjusted sizing when trade scoring enabled

### 6. Multi-Tranche Position Management
- Isolate losing positions while continuing to trade
- Track multiple entries separately per symbol
- Configurable max tranches and isolation thresholds
- **Experimental/untested** - use with caution

### 7. Paper Trading Mode
- Virtual balance simulation
- No real trades executed
- Track P&L without risk
- **Experimental** - not thoroughly tested

### 8. Improved Onboarding Flow
- Step-by-step setup wizard for new users
- API key configuration
- Symbol selection with presets (Conservative/Balanced/Aggressive)
- Dashboard tour
- State persists server-side (works across devices)

<!-- TODO: Add screenshot of Onboarding wizard -->

---

## 🔧 Improvements

### WebSocket Reliability
- **Auto-detect host from browser** - No more hardcoded localhost issues
- Works correctly when accessing via IP, domain, or localhost
- Better reconnection handling
- Tab visibility detection - refreshes data when returning to tab

### UI/UX Enhancements
- Mobile-responsive design throughout
- Pull-to-refresh on mobile
- Dark/light theme support
- Improved error notifications
- Rate limit visualization
- Session performance tracking

<!-- TODO: Add screenshot of main dashboard -->

### Configuration
- Per-symbol threshold system toggle (now always visible)
- Liquidation database retention settings
- Trade size validation against exchange minimums
- Safe defaults ($1 USDT trade size for new symbols)

<!-- TODO: Add screenshot of Config page -->

### Security
- Next.js upgraded to 15.5.7 (CVE-2025-66478 fix)
- Bcrypt password hashing
- Secure cookie handling
- Session-based error tracking

---

## 🐛 Bug Fixes

- Fixed stale data when returning to browser tab
- Fixed WebSocket not connecting from non-localhost access
- Fixed authentication comparing plain text to hashed passwords
- Fixed threshold settings not displaying unless already in config
- Fixed liquidation database settings not persisting
- Fixed onboarding trade sizes using wrong units (was coin, now USDT)
- Fixed secure cookies only when actually using HTTPS
- Fixed FTA Exit Service spamming logs every second (now throttled to 5 min intervals, disabled by default)
- Fixed various React hooks rule violations
- Removed deprecated type stub packages

---

## 📋 Known Issues / TODO

- **Risk Percentage setting** - UI exists but not yet implemented in bot logic
- **Paper Trading** - Not thoroughly tested
- **Tranche System** - Experimental, needs more testing
- **Trade Quality Scoring** - May need tuning for different market conditions

---

## 🧪 Testing Recommendations

1. **Fresh install test** - Delete `config.user.json` and go through onboarding
2. **Migration test** - Existing users should verify config loads correctly
3. **Multi-device test** - Access from different IPs/browsers
4. **Paper mode test** - Verify no real trades execute
5. **Discovery page** - Check liquidation data collection

---

## 📤 Upgrade Guide for Existing Users

1. **Backup your data:**
- `config.user.json` - Your API keys and symbol settings
- `data/` folder - Contains liquidation history database

2. **Recommended: Rebuild config from new defaults**
- Many new settings won't appear in the UI unless they exist in your config
- Start fresh with the onboarding wizard, then re-add your API keys and symbols
- This ensures all new features are accessible

3. **Alternative: Keep existing config**
- Your existing config will still work
- New fields will be added automatically with defaults
- Some UI elements may not appear until you re-save settings

4. **After upgrade:**
- Clear browser cache/cookies (auth system changed)
- Re-login with your dashboard password
- Verify WebSocket connects (check browser console)

---

## 📦 Dependencies

- Upgraded: `next` 15.5.4 → 15.5.7
- Added: `jose`, `bcryptjs`, `lightweight-charts`
- Removed: `@types/uuid`, `@types/sqlite3` (now included in packages)

---

## 🔄 Running with PM2 (Optional)

PM2 is **optional** but recommended for production use. It provides:
- Process management and auto-restart on crash
- **System Logs feature** in the dashboard (requires PM2)
- Easy start/stop/restart via dashboard controls

### Install PM2
```bash
npm install -g pm2
```

### Start with PM2
```bash
pm2 start ecosystem.config.js
```

### Without PM2
The bot runs fine without PM2 using:
```bash
npm run dev # Development mode
npm run start # Production mode
```

**Note:** The System Logs section in the dashboard will show "PM2 not detected" if running without PM2. All other features work normally.

---

## 🙏 Credits

Built on top of the excellent [Aster Lick Hunter](https://github.com/CryptoGnome/aster_lick_hunter_node) by CryptoGnome.
Empty file added [WEB]
Empty file.
38 changes: 14 additions & 24 deletions config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,24 @@
"apiKey": "",
"secretKey": ""
},
"symbols": {
"ASTERUSDT": {
"longVolumeThresholdUSDT": 1000,
"shortVolumeThresholdUSDT": 2500,
"tradeSize": 0.69,
"shortTradeSize": 0.69,
"maxPositionMarginUSDT": 200,
"leverage": 10,
"tpPercent": 1,
"slPercent": 20,
"orderType": "LIMIT",
"forceMarketEntry": false,
"vwapProtection": true,
"vwapTimeframe": "5m",
"vwapLookback": 200,
"useThreshold": false,
"thresholdTimeWindow": 60000,
"thresholdCooldown": 30000
}
},
"symbols": {},
"global": {
"riskPercent": 90,
"paperMode": true,
"riskPercent": 5,
"paperMode": false,
"positionMode": "HEDGE",
"maxOpenPositions": 5,
"maxOpenPositions": 10,
"useThresholdSystem": false,
"useTradeQualityScoring": false,
"useFTAExitAnalysis": false,
"debugMode": false,
"server": {
"dashboardPassword": "admin",
"dashboardPort": 3000,
"websocketPort": 8080,
"useRemoteWebSocket": false,
"websocketHost": null
"websocketHost": null,
"websocketPath": null,
"setupComplete": false
},
"rateLimit": {
"maxRequestWeight": 2400,
Expand All @@ -46,6 +32,10 @@
"deduplicationWindowMs": 1000,
"parallelProcessing": true,
"maxConcurrentRequests": 3
},
"liquidationDatabase": {
"retentionDays": 90,
"cleanupIntervalHours": 24
}
},
"version": "1.1.0"
Expand Down
Binary file added data/backtest.db-shm
Binary file not shown.
Loading
Loading