Commit Graph

136 Commits

Author SHA1 Message Date
ZhouYongyou
24999dea7b fix: 修復初始余額顯示錯誤(使用當前淨值而非配置值)
問題:
- 圖表顯示「初始余額 693.15 USDT」(實際應該是 600)
- 原因:使用 validHistory[0].total_equity(當前淨值)
- 導致初始余額隨著盈虧變化,數學邏輯錯誤

修復:
- 優先從 account.initial_balance 讀取真實配置值
- 備選方案:從歷史數據反推(淨值 - 盈虧)
- 默認值使用 1000(與創建交易員時的默認配置一致)

測試:
- 初始余額:600 USDT(固定)
- 當前淨值:693.15 USDT
- 盈虧:+93.15 USDT (+15.52%) ✓
2025-11-04 17:35:26 +08:00
Ember
cd9cd42267 feat: Add Binance setup guide with tutorial modal
- Add Binance configuration tutorial image (guide.png)
- Implement "View Guide" button in exchange configuration modal
- Add tutorial display modal with image viewer
- Add i18n support for guide-related text (EN/ZH)
- Button only appears when configuring Binance exchange

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 14:50:38 +08:00
Icyoung
24798a4fc6 Merge pull request #361 from Icyoung/beta
Beta bugfix
2025-11-04 02:14:54 +08:00
icy
14a0ef090e Add NOFX watermarks to charts and fix empty state internationalization
- Add NOFX watermark to ComparisonChart (competition page)
- Add NOFX watermark to EquityChart (dashboard page)
- Fix empty state handling and internationalization in CompetitionPage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 02:08:38 +08:00
icy
ab41d5a73d Fix ComparisonChart data display issue
The chart was not showing data because the API response format changed.
Fixed the calculation of PnL percentage by computing it from total_pnl
and balance values (initial_balance = balance - total_pnl).

Now the AI competition chart should properly display performance comparison data.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:54:21 +08:00
Icyoung
6f9510e458 Merge pull request #359 from Icyoung/beta
Beta Merge dev、Bug fix
2025-11-04 01:50:34 +08:00
icy
56a7115213 Merge branch 'dev' into beta 2025-11-04 01:45:21 +08:00
icy
e25b2bb763 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-04 01:45:15 +08:00
icy
088773eb53 Remove all test dependencies and configurations
- Removed test script from package.json
- Removed testing dependencies (@testing-library/react, vitest, jsdom)
- Deleted test directory and vitest.config.ts
- Updated package-lock.json to reflect changes
- Build still works perfectly without test dependencies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:44:40 +08:00
icy
b630cc5128 Remove unused test files
Removed App.test.tsx and AITradersPage.test.tsx that were causing TypeScript build issues and are not currently in use.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:43:02 +08:00
icy
8cbb02a3ff Fix TypeScript build error
Removed unused 'Zap' import from App.tsx that was causing build failure.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:42:25 +08:00
Luna Martinez
fad96e54d9 Merge pull request #329 from zhouyongyou/chore/peer-dependency-markers
chore(web): add peer dependency markers to package-lock.json
2025-11-03 12:39:24 -05:00
icy
f8427f7c91 Fix: Add proper top padding to prevent HeaderBar overlap on all main app pages
Match main app layout with proven working /competition route layout:
- Use px-6 py-6 pt-24 padding (same as /competition route)
- Ensures HeaderBar doesn't overlap content on /traders and /dashboard pages
- Provides consistent 6rem (96px) top clearance for fixed positioned HeaderBar
- Removes responsive padding variants that differed from competition page

This fixes header overlap issues across all main application routes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:29:39 +08:00
icy
2a99d12095 Fix: Unify all pages to use HeaderBar component consistently
Replace the inline header implementation in main app with HeaderBar component to match landing page:
- Remove duplicate inline header code (168 lines)
- Use HeaderBar component for all main app pages like landing page does
- Ensure consistent header design across all routes (/competition, /traders, /dashboard)
- Maintain proper onPageChange navigation handling
- Keep all header functionality (user info, admin mode, language toggle, logout)

This fixes the header inconsistency where different pages used different header implementations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:04:16 +08:00
Liu Xiang Qian
98d3466836 Revert "Merge pull request #229 from xqliu/test/add-ut-infrastructure"
This reverts commit 683e77b92f, reversing
changes made to 791cecd2ff.
2025-11-04 00:58:12 +08:00
icy
055d227342 Merge branch 'dev' into beta 2025-11-04 00:17:50 +08:00
icy
c64d315110 Limit performance comparison chart to top 5 traders
Frontend changes to ensure equity-history-batch API only requests data for top 5 performers:
- Modify CompetitionPage to pass only top 5 traders to ComparisonChart component
- Update API comments to reflect the change from top 10 to top 5
- Optimize chart performance by reducing data volume and API calls

This ensures the performance comparison chart shows only the most relevant traders while improving load times.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 00:16:14 +08:00
icy
04dcb9a980 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 23:46:54 +08:00
SkywalkerJi
d6daad5708 Merge pull request #229 from xqliu/test/add-ut-infrastructure
test: Add minimal UT infrastructure and fix Issue #227
2025-11-04 00:28:34 +09:00
Liu Xiang Qian
53122c14c1 fix: Remove unused variables in AITradersPage.test.tsx to fix TypeScript compilation
Fixed TypeScript compilation errors by removing unused imports and variables:
- Removed unused 'screen' import from test-utils
- Removed unused 'fetcher' parameter from SWR mock
- Removed unused 'mockTrader' variable
- Removed unused 'TraderInfo' type import

All tests still pass (5/5) and frontend now compiles successfully.
2025-11-03 23:20:55 +08:00
icy
3f49616c26 Merge branch 'dev' into beta 2025-11-03 23:19:52 +08:00
icy
9a9725db12 Merge branch 'tinkle-nofx/dev' with conflict resolution
- Resolve UI layout conflicts in App.tsx
- Keep modern Binance-style header with authentication logic
- Maintain responsive design and user interface improvements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 23:19:25 +08:00
icy
3a23e73312 Prevent my-traders API calls when user is not logged in
- Add authentication checks to SWR calls in App.tsx and AITradersPage.tsx
- Only call api.getTraders when user and token are available
- Modify loadConfigs to skip authenticated API calls when not logged in
- Load only public supported models/exchanges for unauthenticated users
- Update useEffect dependencies to include user and token

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 23:14:10 +08:00
icy
837d886b51 Add internationalization for AI scan interval configuration
- Add aiScanInterval and scanIntervalRecommend translation keys to translations.ts
- Update TraderConfigModal to use internationalized text instead of hardcoded Chinese
- Support language switching for scan interval labels and recommendations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 22:40:50 +08:00
Icyoung
e20a1232bb Merge pull request #336 from 0xEmberZz/fix-mobile-display-v2
UI : Fix mobile display
2025-11-03 22:40:17 +08:00
icy
0690233b7f Merge dev branch with conflict resolution
- Resolve TypeScript interface formatting conflict in CommunitySection.tsx
- Include updates from dev branch

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 22:31:01 +08:00
icy
60e0c8043f Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 22:29:01 +08:00
icy
aea9dc25ac Optimize frontend to use batch API for equity history requests
- Add batch API methods (getEquityHistoryBatch, getTopTraders, getPublicTraderConfig) to api.ts
- Update ComparisonChart to use batch endpoint instead of individual calls
- Reduce network requests from 10 to 1 for performance comparison page
- Maintain backward compatibility with existing data structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 22:04:34 +08:00
Liu Xiang Qian
f6b3972847 feat: 添加 AI 扫描决策间隔配置支持
## 功能描述

在创建和编辑 Trader 时,支持配置 AI 扫描决策间隔(scan_interval_minutes),允许用户自定义 AI 决策的频率。

## 修改内容

### 后端修改 (api/server.go)

1. **CreateTraderRequest** 添加 `ScanIntervalMinutes` 字段
2. **UpdateTraderRequest** 添加 `ScanIntervalMinutes` 字段和 `SystemPromptTemplate` 字段
3. **handleCreateTrader** 处理扫描间隔默认值(默认 3 分钟)
4. **handleUpdateTrader** 支持更新扫描间隔
5. **handleGetTraderConfig** 返回中添加 `scan_interval_minutes` 字段

### 前端修改

#### web/src/types.ts
- `CreateTraderRequest` 添加 `scan_interval_minutes?` 可选字段
- `TraderConfigData` 添加 `scan_interval_minutes` 必填字段

#### web/src/components/TraderConfigModal.tsx
- 本地 `TraderConfigData` 接口添加 `scan_interval_minutes`
- 初始状态设置默认值为 3 分钟
- 添加 UI 输入框(范围 1-60 分钟)
- Label 优化为 "AI 扫描决策间隔 (分钟)"

#### web/src/components/AITradersPage.tsx
- `handleSaveEditTrader` 的更新请求中添加 `scan_interval_minutes`

#### web/src/components/landing/CommunitySection.tsx
- 修复 TypeScript 编译错误:定义 `CardProps` 接口
- 修正 `TestimonialCard` 组件的 prop 名称(author → authorName)

## 功能特性

-  支持 1-60 分钟的自定义间隔
-  默认值为 3 分钟
-  UI 提示建议范围:3-10 分钟
-  创建和编辑时均支持配置
-  后端验证和处理默认值

## 测试步骤

1. 创建新 Trader,设置自定义扫描间隔(如 10 分钟)
2. 验证 Trader 创建成功
3. 编辑现有 Trader,修改扫描间隔
4. 验证修改保存成功
5. 确认 AI 决策按照新的间隔执行
2025-11-03 21:55:26 +08:00
Ember
1dce565309 feat(web): comprehensive mobile responsive optimization for AI Traders and Competition pages
Optimized mobile display for AITradersPage:
- Header: Reduced padding (px-3 on mobile), smaller icons and text
- Action buttons: Smaller on mobile (px-3, text-xs) with horizontal scroll support
- Configuration cards: Responsive padding (p-3 on mobile), smaller gaps
- Model/Exchange items: Smaller icons (w-7 on mobile), truncate text overflow
- Trader list: Stack vertically on mobile, smaller buttons with wrapping support
- Empty states: Smaller icons and text on mobile

Maintained all i18n translations and preserved Binance design style.

Addresses #311

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 21:46:07 +08:00
Ember
2eaadc40d8 fix: improve mobile responsive layout for header and comparison chart
This is a partial fix for issue #311 mobile display problems.

Changes in this commit:
- Add responsive header layout with separate mobile/desktop views in App.tsx
- Fix language selector visibility on mobile (no longer hidden by menu)
- Add responsive breakpoints to ComparisonChart stats grid (2 cols on mobile, 4 on desktop)
- Adjust padding and text sizes for mobile screens
- Preserve all i18n (internationalization) functionality from upstream

Note: Additional components (CompetitionPage, AITradersPage) will need similar mobile
responsive improvements in follow-up commits.

Related to #311

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 21:38:52 +08:00
ZhouYongyou
f1cbdf7f65 chore(web): add peer dependency markers to package-lock.json
npm v7+ automatically marks packages as peer dependencies when they are
declared in peerDependencies of installed packages. This commit adds
these markers to ensure consistent dependency resolution across all
development environments and CI/CD pipelines.

Affected packages (10):
- @babel/core (dev peer)
- @types/react (devOptional peer)
- browserslist
- jiti (dev peer)
- postcss
- react
- react-dom
- picomatch (2 instances, dev peer)
- vite (dev peer)

Benefits:
- Prevents duplicate installations of peer dependencies
- Ensures consistent package versions across the project
- Improves npm install performance
- Reduces package-lock.json conflicts
2025-11-03 20:47:25 +08:00
icy
f23ad9ba4c Fix TypeScript error in CommunitySection component
- Add missing CardProps interface definition
- Update TestimonialCard component to use correct prop types
- Fix authorName prop usage instead of author
- Resolve build error: Cannot find name 'CardProps'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 20:25:07 +08:00
icy
f77b5b0aba Resolve merge conflicts in go.sum
- Keep newer version of go-sqlite3 (v1.14.32)
- Complete merge from dev branch

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-03 19:33:50 +08:00
icy
6b754d2708 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 19:32:03 +08:00
Ember
84f002c3a4 Merge branch 'dev' into quote-tweet-link 2025-11-02 23:56:46 +08:00
Ember
44ac82ad3a chore(landing): add lightweight AnimatedSection wrapper for main-based branch 2025-11-02 23:52:15 +08:00
Ember
a75bda7dd2 chore(landing): add lightweight AnimatedSection wrapper for main-based branch 2025-11-02 23:49:23 +08:00
Ember
da2559290b feat(landing): integrate real community tweets in CommunitySection with author avatars and links 2025-11-02 23:48:25 +08:00
icy
78b3ce69da Merge branch 'dev' into beta
# Conflicts:
#	config/database.go
#	main.go
2025-11-02 22:11:07 +08:00
icy
279b447c2f Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-02 21:54:02 +08:00
SkywalkerJi
d2ce83c239 Google Tag Manager 2025-11-02 21:44:53 +08:00
Liu Xiang Qian
7e07285706 fix: Update model validation in handleSaveModelConfig to support both configured and supported models
- Change validation to check allModels first, then supportedModels
- This allows saving new model configurations without "model does not exist" error
- Fixes issue where users couldn't save AI model config after selecting from dropdown

Fixes #245

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 18:08:25 +08:00
Liu Xiang Qian
1fdf8142da test: Add minimal UT infrastructure and fix Issue #227
This commit sets up a minimal, KISS-principle testing infrastructure
for both backend and frontend, and includes the fix for Issue #227.

Backend Changes:
- Add Makefile with test commands (test, test-backend, test-frontend, test-coverage)
- Add example test: config/database_test.go
- Fix Go 1.25 printf format string warnings in trader/auto_trader.go
  (Changed log.Printf to log.Print for non-format strings)
- All backend tests pass ✓

Frontend Changes:
- Add Vitest configuration: web/vitest.config.ts (minimal setup)
- Add test utilities: web/src/test/test-utils.tsx
- Add example test: web/src/App.test.tsx
- Add dependencies: vitest, jsdom, @testing-library/react
- All frontend tests pass ✓

Issue #227 Fix:
- Fix AITradersPage to allow editing traders with disabled models/exchanges
- Change validation to use allModels/allExchanges instead of enabledModels/enabledExchanges
- Add comprehensive tests in web/src/components/AITradersPage.test.tsx
- Fixes: https://github.com/tinkle-community/nofx/issues/227

CI/CD:
- Add GitHub Actions workflow: .github/workflows/test.yml
- Non-blocking tests (continue-on-error: true)
- Runs on push/PR to main and dev branches

Test Results:
- Backend: 1 test passing
- Frontend: 5 tests passing (including 4 for Issue #227)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 10:58:31 +08:00
icy
47b35b3796 fix: resolve merge conflicts in RegisterPage.tsx
- Remove merge conflict markers
- Keep HeaderBar import instead of ArrowLeft
- Remove duplicate betaMode state declaration
- Remove duplicate useEffect hook
- Update translation keys to use authStep* variants
- Ensure proper beta mode functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 07:05:07 +08:00
icy
b01ed69fd7 fix: use CSS variables for form background in RegisterPage
Replace hardcoded colors with CSS variables:
- background: var(--panel-bg)
- border: var(--panel-border)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 06:43:39 +08:00
icy
1cf1dd70a4 fix: restore header bar and fix layout in RegisterPage
- Add HeaderBar component to registration page
- Change background to use CSS variables (var(--brand-black))
- Remove "back to home" button
- Update layout structure to match LoginPage pattern
- Fix container padding and spacing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 06:42:51 +08:00
icy
ef197a3f93 fix: resolve all TypeScript build errors
- Remove unused imports (LoginModal, Zap) and variables
- Fix Language type mismatches across components
- Update HeaderBar interface to use Language type
- Remove unused onLoginClick parameter
- Fix duplicate translation keys by renaming auth steps
- Remove invalid language prop from CommunitySection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 06:39:23 +08:00
icy
4efa6cc148 fix: add beta_mode property to SystemConfig interface
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 06:31:51 +08:00
icy
650ba58992 fix: remove extra closing div tag in RegisterPage JSX
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 06:25:09 +08:00