415 Commits

Author SHA1 Message Date
PorunC 2cb2366b01 Fix: Add comprehensive null safety checks to CompetitionPage component
Root cause analysis:
The previous fix (0cb1f37) only addressed App.tsx Debug Info section,
but missed CompetitionPage.tsx which also directly accesses trader data
fields without null safety checks.
When competition data is loading or incomplete, trader objects may exist
but contain undefined fields (total_pnl, total_equity, etc.), causing:
"TypeError: Cannot read properties of undefined (reading 'total_pnl')"
Fixed locations in CompetitionPage.tsx:
1. Line 76-77: Leader display in header (total_pnl, total_pnl_pct)
2. Line 142: Leaderboard total_equity display
3. Line 151-157: Leaderboard P&L section (total_pnl checks and displays)
4. Line 229-230: Head-to-Head comparison (total_pnl display)
Changes applied:
- Replace direct property access with optional chaining (?.)
- Use nullish coalescing (?? 0) for numeric comparisons
- Add fallback values ('0.00') for undefined fields
- Ensure consistent null safety across all trader data displays
This completes the null safety coverage for the entire frontend.
Fixes: TypeError in CompetitionPage at index-R21Yay1P.js:116:51447
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 20:46:08 +08:00
PorunC 6b82321e01 Fix: Add null safety checks to Debug Info section in frontend
Previously fixed StatCard components but missed the Debug Info section,
causing "Cannot read properties of undefined (reading 'total_pnl')" error
when account data is loading or incomplete.
Root cause:
- Frontend uses SWR with async data fetching (5s refresh interval)
- During initial load or API delays, account object may exist but fields undefined
- Previous fix (93e331a) only covered StatCard section (lines 369-384)
- Debug Info section (lines 360-362) still used direct property access
Changes:
- Add optional chaining (?.) to all account field accesses in Debug Info
- Add fallback values ('0.00') for undefined fields
- Ensures consistent null safety across all account data displays
This prevents runtime errors during data loading and API failures.
Fixes: TypeError: Cannot read properties of undefined (reading 'total_pnl')
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 20:39:28 +08:00
PorunC 36b75bbfc8 Fix: Improve frontend code quality and null safety
- Remove unused variables and imports
- Add null/undefined safety checks for account data display
- Use optional chaining and nullish coalescing for safer data access
- Remove unused "Input Prompt" display section (keeping CoT trace)
- Fix TypeScript warnings and improve type safety
Changes:
- App.tsx: Add null checks for account fields, remove unused stats prop and input prompt display
- ComparisonChart.tsx: Remove unused imports and variables
This improves code quality without affecting functionality.
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 20:30:17 +08:00
tinkle-community a7d0ca8835 Docs: Add Docker one-click deployment support for all languages
Complete Docker deployment solution with beginner-friendly documentation:
**New Docker Files:**
- `Dockerfile` - Multi-stage Go backend build with health checks
- `web/Dockerfile` - Frontend build with Nginx and API proxy
- `docker-compose.yml` - Full orchestration with service dependencies
- `.dockerignore` & `web/.dockerignore` - Build optimization
- `start.sh` - Convenient management script (start/stop/logs/status)
**Comprehensive Documentation:**
- `DOCKER_DEPLOY.md` (中文) - Complete Chinese deployment guide
- `DOCKER_DEPLOY.en.md` (English) - Complete English deployment guide
  - Prerequisites & Docker installation (macOS/Windows/Linux)
  - 3-step quick start (config → start → access)
  - Service management commands
  - Advanced configuration (ports, resources, env vars)
  - Data persistence & backups
  - Comprehensive troubleshooting
  - Security recommendations
  - Production deployment (Nginx, HTTPS, Docker Swarm)
  - Monitoring & logging setup
**README Updates (All 4 Languages):**
- README.md (English)
- README.zh-CN.md (中文)
- README.uk.md (Українська)
- README.ru.md (Русский)
Added prominent "Option A: Docker One-Click Deployment" section at the
beginning of Quick Start in all languages. Clearly marked as EASIEST
method for beginners. Shows 3 simple steps with command examples and
links to detailed DOCKER_DEPLOY docs.
**Key Features:**
- One-command deployment: `./start.sh start --build`
- Auto-handles all dependencies (Go, Node.js, TA-Lib)
- Health checks for both services
- Data persistence (logs, cache, config)
- Log rotation (10MB × 3 files)
- Easy service management
- Beginner-friendly for complete newcomers
**User Benefits:**
- No need to install Go, Node.js, or TA-Lib manually
- Works on macOS, Windows, Linux
- Perfect for non-developers
- Production-ready with best practices
This makes NOFX truly accessible to beginners as requested: "真就让小白都能一键开始"
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 18:29:49 +08:00
tinkle-community b9ea3f68ea Fix: Correct Profit Factor calculation and display units in AI Learning
Backend changes (logger/decision_logger.go):
- Fixed Profit Factor to use standard formula (total profit / total loss)
- Previously used average values which was incorrect when win/loss counts differ
- Now saves total amounts before calculating averages for accurate ratio
Frontend changes (web/src/components/AILearning.tsx):
- Fixed display units: changed USDT amounts from "%" to "USDT"
- Updated avg_win and avg_loss to show "USDT Average" instead of "%"
- Updated best/worst performer displays to show "USDT" instead of "%"
- Added "(USDT)" labels to table headers for clarity
- Removed "%" from all table data cells showing monetary amounts
This ensures accurate performance metrics and eliminates user confusion
between percentage values and absolute USDT amounts.
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 17:59:19 +08:00
tinkle-community 6b3959b611 sync: Sync codebase from nofx internal version
- Update .gitignore to align with nofx configuration
- Sync README files across all languages (EN/ZH/RU/UK)
- Update web/package-lock.json with latest dependencies
This commit synchronizes the open-nofx repository with the latest
changes from the internal nofx version to maintain consistency.
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 11:15:08 +08:00
tinkle-community f7e22d0a07 fix 2025-10-29 10:59:14 +08:00
tinkle-community f3720699eb chore: Remove unnecessary files from open-nofx repository
Remove node_modules directory and update .gitignore:
- Remove all web/node_modules files from git tracking
- Add node_modules/, web/dist/, web/.vite/ to .gitignore
- Remove backup files (*.bak) and empty directories (web/web/)
- Align open-nofx repository structure with nofx internal version
This cleanup ensures the open-source version only contains necessary
source files and proper gitignore configuration.
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 10:44:27 +08:00
tinkle-community 691def7b17 Refactor: Improve comparison chart data synchronization
Major improvements:
- Replace useState+useEffect with useMemo for better performance
- Use timestamp-based grouping instead of cycle_number
- Fix data alignment issues when backend resets cycles
- Add detailed console logging for debugging
- Optimize data merging logic with Map structures
Chart updates:
- Display sequence number instead of cycle number on X-axis
- Improve tooltip to show actual time and sequence
- Better handling of multi-trader data synchronization
- More reliable data point matching across traders
Performance:
- Reduce unnecessary re-renders with useMemo
- More efficient data processing with Maps
- Better dependency tracking in hooks
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 05:31:15 +08:00
tinkle-community 6c87a51303 UI: Enhance AI learning dashboard visual design
Improvements:
- Add gradient background with glowing effects
- Redesign header section with larger icon and enhanced typography
- Improve card layouts with modern shadows and hover effects
- Optimize Sharpe ratio and profit factor display sections
- Add better visual hierarchy and spacing
- Enhance color schemes for better readability
- Remove unused decision record fetching code
- Clean up comments for better code clarity
Visual enhancements:
- Glassmorphism effects with backdrop blur
- Animated gradient backgrounds
- Enhanced metric cards with better contrast
- Improved symbol performance table design
- Modernized trade history cards with gradients
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 04:54:53 +08:00
tinkle-community ceaedca253 Refactor: Improve AI decision system and Sharpe ratio calculation
Major improvements:
- Use period-level Sharpe ratio (range -2 to +2) instead of annualized
- Save full user prompt in decision logs for debugging
- Format complete market data (3m + 4h candles) for AI analysis
- Prevent position stacking with duplicate position checks
- Update Sharpe ratio interpretation thresholds
Market data enhancements:
- Display full technical indicators in user prompt
- Include 3-minute and 4-hour timeframe data
- Add OI (Open Interest) change and funding rate signals
Risk control:
- Block opening duplicate positions (same symbol + direction)
- Suggest close action first before opening new position
- Prevent margin usage from exceeding limits
UI improvements:
- Update multi-language translations
- Refine AI learning dashboard display
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 04:44:17 +08:00
tinkle-community 0dca506cfc Feature: Add Sharpe ratio for AI self-evolution
- Implement Sharpe ratio calculation in decision logger
- Add adaptive behavior recommendations based on Sharpe ratio
- Display Sharpe ratio in AI learning dashboard with visual indicators
- Enable AI to adjust trading strategy based on risk-adjusted returns
- Color-coded performance levels (red/yellow/green) for easy monitoring
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-10-29 02:31:15 +08:00
tinkle-community 8a26b8161b Feature: Add multi-language support and UI improvements
- Add language context and translation system (Chinese/English)
- Enhance UI components with i18n support
- Update AILearning, EquityChart, and CompetitionPage
- Add language toggle in header
- Improve user experience with localized text
2025-10-28 22:25:36 +08:00
tinkle-community a726702302 Update: Merge nofx improvements
- Frontend trading records and UI enhancements
- Optimized AI prompts and decision engine
- Performance analysis and comparison features
- Binance-style UI improvements
2025-10-28 21:45:28 +08:00
tinkle-community 5aa50d35d7 Initial commit: NOFX AI Trading System
- Multi-AI competition mode (Qwen vs DeepSeek)
- Binance Futures integration
- AI self-learning mechanism
- Professional web dashboard
- Complete risk management system
2025-10-28 15:47:34 +08:00