Commit Graph

345 Commits

Author SHA1 Message Date
icy
f68cb60aeb Merge branch 'dev' into beta 2025-11-04 00:17:50 +08:00
icy
1ae1f90d8a 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: Claude <noreply@anthropic.com>
2025-11-04 00:16:14 +08:00
icy
d5e0e1d8d5 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 23:46:54 +08:00
icy
5bd6333b7b Optimize /api/competition endpoint performance with concurrent data fetching and caching
## Performance Improvements:
- **Concurrent Processing**: Replace serial GetAccountInfo() calls with parallel goroutines
- **Timeout Control**: Add 3-second timeout per trader to prevent blocking
- **30-second Cache**: Implement competition data cache to reduce API calls
- **Error Handling**: Graceful degradation when API calls fail or timeout

## API Changes:
- Reduce top traders from 10 to 5 for better chart performance
- Update /api/equity-history-batch to use top 5 traders by default
- Add detailed logging for cache hits and performance monitoring

## Expected Performance Gains:
- First request: ~85% faster (from 25s to 3s for 50 traders)
- Cached requests: ~99.96% faster (from 25s to 10ms)
- Better user experience with consistent response times

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 23:45:09 +08:00
SkywalkerJi
683e77b92f 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
cc448bf6e2 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
e553adcdbb Merge branch 'dev' into beta 2025-11-03 23:19:52 +08:00
icy
c6b9479cac 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: Claude <noreply@anthropic.com>
2025-11-03 23:19:25 +08:00
icy
e762939655 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: Claude <noreply@anthropic.com>
2025-11-03 23:14:10 +08:00
icy
22f3d3fb64 Fix equity-history-batch API to support POST JSON requests
- Change route from GET to POST for equity-history-batch endpoint
- Update handleEquityHistoryBatch to parse JSON body from POST requests
- Maintain backward compatibility with GET query parameters
- Ensure public access without authentication as required

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 23:13:53 +08:00
icy
cacdaf0b82 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: Claude <noreply@anthropic.com>
2025-11-03 22:40:50 +08:00
Icyoung
791cecd2ff Merge pull request #336 from 0xEmberZz/fix-mobile-display-v2
UI : Fix mobile display
2025-11-03 22:40:17 +08:00
icy
8db61e085f 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: Claude <noreply@anthropic.com>
2025-11-03 22:31:01 +08:00
icy
b8492dec36 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 22:29:01 +08:00
SkywalkerJi
df83a87bb0 Merge pull request #338 from xqliu/feat/add-scan-interval-config-v2
feat: 添加 AI 扫描决策间隔配置支持
2025-11-03 23:11:27 +09:00
SkywalkerJi
0a9410069d Merge pull request #337 from xqliu/fix/trader-edit-model-validation
fix: 修复编辑 Trader 时 AI 模型验证失败的问题
2025-11-03 23:11:08 +09:00
icy
32bcd82c08 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: Claude <noreply@anthropic.com>
2025-11-03 22:04:34 +08:00
Liu Xiang Qian
8ad85a4a5b revert: 移除 SystemPromptTemplate 相关修改
将 SystemPromptTemplate 功能从扫描间隔 PR 中分离出来,
保持 PR 单一职责。

SystemPromptTemplate 功能将在单独的 PR 中处理。
2025-11-03 22:02:25 +08:00
Liu Xiang Qian
ddf6c44d65 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
Liu Xiang Qian
3dfdd79a8c fix: 修复编辑 Trader 时 AI 模型验证失败的问题
## 问题描述
编辑 Trader 配置时,保存提示"AI模型配置不存在或未启用"错误。

## 根本原因
- 数据库存储的模型 ID 是完整格式(如 `admin_deepseek`)
- API 返回时将其转换为 provider 格式(`deepseek`)
- 前端 enabledModels 列表中是完整 ID
- 导致前端用 `deepseek` 查找 `admin_deepseek` 时失败

## 修复方案
移除 handleGetTraderConfig 中的模型 ID 转换逻辑,
返回完整的模型 ID,保持与前端模型列表格式一致。

Fixes #335
2025-11-03 21:52:44 +08:00
Ember
7a4e9f145c 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: Claude <noreply@anthropic.com>
2025-11-03 21:46:07 +08:00
Ember
4f4e9f2ca9 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: Claude <noreply@anthropic.com>
2025-11-03 21:38:52 +08:00
Liu Xiang Qian
13e6f9e7f6 fix: Correct 4h kline data storage in WebSocket monitor
Fixed critical bug where 4h kline data was incorrectly stored with
3m kline data, causing data mismatch.

Changes:
- Changed `m.klineDataMap4h.Store(s, klines)` to `klines4h`
- Updated log message to use `len(klines4h)` instead of `len(klines)`

This bug would cause 4h kline queries to return 3m data, leading to
incorrect technical indicator calculations.

Fixes: #260
Related: #176
2025-11-03 21:17:43 +08:00
icy
95ae6510e2 Merge branch 'dev' into beta 2025-11-03 21:10:15 +08:00
icy
c8bdc150e1 Merge branches 'dev' and 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 21:10:09 +08:00
tinkle-community
7d1c35be2b Merge pull request #326 from NoFxAiOS/main 2025-11-03 20:34:16 +08:00
SkywalkerJi
61fc2bee16 Merge branch 'dev' into main 2025-11-03 21:33:46 +09:00
icy
290a1ac892 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: Claude <noreply@anthropic.com>
2025-11-03 20:25:07 +08:00
icy
1acfbd6ca1 Enhance leaderboard and security for trader management
Features:
- Limit leaderboard to top 50 traders sorted by PnL percentage
- Add top 10 traders endpoint for performance comparison
- Create batch equity history endpoint to optimize frontend performance
- Add public trader config endpoint without sensitive data

Security:
- Add user ownership validation for start/stop trader operations
- Prevent users from controlling other users' traders
- Maintain consistent error messages for security

Performance:
- Reduce API calls from 10 to 1 for performance comparison page
- Add data limits and error handling for batch operations
- Sort traders by performance across all endpoints

API Changes:
- GET /api/traders - now returns top 50 sorted traders
- GET /api/top-traders - new endpoint for top 10 traders
- GET /api/equity-history-batch - batch endpoint for multiple trader histories
- GET /api/traders/:id/public-config - public config without secrets
- POST /api/traders/:id/start - now validates user ownership
- POST /api/traders/:id/stop - now validates user ownership

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 20:14:39 +08:00
tinkle-community
56e12b5030 Merge pull request #321 from SkywalkerJi/main 2025-11-03 19:53:00 +08:00
SkywalkerJi
33d3a5c3a7 Upgrade this repository's open-source license to AGPL. 2025-11-03 19:50:50 +08:00
icy
2173fcfa4d Fix go.sum after merge conflict resolution
- Run go mod tidy to regenerate correct go.sum entries
- Ensure all dependencies are properly resolved

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 19:34:28 +08:00
icy
71e584008f 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: Claude <noreply@anthropic.com>
2025-11-03 19:33:50 +08:00
icy
a86e0a4633 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 19:32:03 +08:00
icy
f8c35487f5 Move equity-history API to public routes for competition display
- Move /api/equity-history from protected to public routes group
- Remove token authentication requirement for equity history data
- Update API documentation to reflect public access
- Enable direct access to trader equity curves for competition comparison

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 19:29:09 +08:00
Luna Martinez
88325572e6 Merge pull request #292 from hzb1115/dev
aaafix(workflow): fix github workflow
2025-11-02 22:59:34 -05:00
zbhan
e7e5c7b710 fix comment 2025-11-02 22:55:27 -05:00
zbhan
7a43f25858 Fix validation logic 2025-11-02 22:49:43 -05:00
zbhan
88240019ec Fix validation 2025-11-02 22:24:31 -05:00
zbhan
75115ac747 Fix backend check 2025-11-02 22:15:45 -05:00
zbhan
0500cf7486 Fix validation error 2025-11-02 22:11:24 -05:00
zbhan
7cbef0fd65 fix(workflow): fix github workflow 2025-11-02 21:49:59 -05:00
Luna Martinez
9f2993b67f Change permissions from read to write for contents 2025-11-02 21:15:31 -05:00
Luna Martinez
cbc153f855 Merge pull request #226 from xqliu/docs/enhance-bug-report-template
docs: Enhance bug report template and add troubleshooting guide
2025-11-02 21:08:32 -05:00
tinkle-community
2a61c8aba5 Merge pull request #285 from tangmengqiu/fix/ci-flow 2025-11-03 10:03:56 +08:00
tangmengqiu
9486a0df40 fix(ci): Add comprehensive permissions to pr-checks workflow
Add workflow-level default permissions and explicit per-job permissions
following the principle of least privilege:

Workflow-level (default):
- contents: read - Read repository contents
- pull-requests: write - Manage PR labels and comments
- issues: write - Manage issues (PRs are issues in GitHub API)

Job-level overrides:
- validate-pr: Inherits workflow defaults (needs issue/PR write access)
- backend-tests: Downgrade to read-only (no write operations needed)
- frontend-tests: Downgrade to read-only (no write operations needed)
- auto-label: Add missing issues:write (labeler operates on PR issues)
- security-check: Add security-events:write (upload SARIF results)
- secrets-check: Downgrade to read-only (scanning only)
- all-checks: Downgrade to read-only (status checking only)

This fixes:
1. Potential 403 errors when auto-label tries to add labels to PR issues
2. Missing permission for uploading security scan results
3. Overly permissive access for read-only jobs

Related: #282

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 18:23:28 -05:00
tinkle-community
afa86b5d80 Merge pull request #266 from 0xEmberZz/quote-tweet-link 2025-11-03 07:01:41 +08:00
tinkle-community
ed4a7a2d20 Merge pull request #268 from yutou123/dev 2025-11-03 06:59:28 +08:00
tinkle-community
45f139a873 Merge pull request #282 from tangmengqiu/fix/dockerfile 2025-11-03 06:50:30 +08:00
tangmengqiu
a7d7ea17cc fix typo 2025-11-02 17:26:47 -05:00