-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Beta merge from dev #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Beta merge from dev #535
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**Problem**: - GetTraderConfig was missing 9 critical fields in SELECT statement - Missing corresponding Scan variables - Caused trader edit UI to show 0 for leverage and empty trading_symbols **Root Cause**: Database query only selected basic fields (id, name, balance, etc.) but missed leverage, trading_symbols, prompts, and all custom configs **Fix**: - Added missing fields to SELECT: * btc_eth_leverage, altcoin_leverage * trading_symbols * use_coin_pool, use_oi_top * custom_prompt, override_base_prompt * system_prompt_template * is_cross_margin * AI model custom_api_url, custom_model_name - Added corresponding Scan variables to match SELECT order **Impact**: ✅ Trader edit modal now displays correct leverage values ✅ Trading symbols list properly populated ✅ All custom configurations preserved and displayed ✅ API endpoint /traders/:id/config returns complete data **Testing**: - ✅ Go compilation successful - ✅ All fields aligned (31 SELECT = 31 Scan) - ✅ API layer verified (api/server.go:887-904) Reported by: 寒江孤影 Issue: Trader config edit modal showing 0 leverage and empty symbols 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fix(workflow): add title and size validation comments
fix(readme): update readme and pr reviewer
…ssing-fields fix(database): GetTraderConfig missing critical fields causes edit to fail
Fix:fix the main branch history issue from November 3rd.
Merge pull request NoFxAiOS#395 from NoFxAiOS/beta fix:fix the main branch history issue from November 3rd.
Enable automatic wallet address generation from private key for Hyperliquid exchange, simplifying user onboarding and reducing configuration errors. Backend Changes (trader/hyperliquid_trader.go): - Import crypto/ecdsa package for ECDSA public key operations - Enable wallet address auto-generation when walletAddr is empty - Use crypto.PubkeyToAddress() to derive address from private key - Add logging for both auto-generated and manually provided addresses Frontend Changes (web/src/components/AITradersPage.tsx): - Remove wallet address required validation (only private key required) - Update button disabled state to only check private key - Add "Optional" label to wallet address field - Add dynamic placeholder with bilingual hint - Show context-aware helper text based on input state - Remove HTML required attribute from input field Translation Updates (web/src/i18n/translations.ts): - Add 'optional' translation (EN: "Optional", ZH: "可选") - Add 'hyperliquidWalletAddressAutoGenerate' translation EN: "Leave blank to automatically generate wallet address from private key" ZH: "留空将自动从私钥生成钱包地址" Benefits: ✅ Simplified UX - Users only need to provide private key ✅ Error prevention - Auto-generated address always matches private key ✅ Backward compatible - Manual address input still supported ✅ Better UX - Clear visual indicators for optional fields Technical Details: - Uses Ethereum standard ECDSA public key to address conversion - Implementation was already present but commented out (lines 37-43) - No database schema changes required (hyperliquid_wallet_addr already nullable) - Fallback behavior: manual input > auto-generation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- 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: Claude <[email protected]>
feat: Add Binance setup guide with tutorial modal
- Create view_pg_data.sh for easy database data inspection - Display table record counts, AI models, exchanges, and system config - Include beta codes and user statistics - Auto-detect docker-compose vs docker compose commands 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Problem: - Users could input arbitrary initial balance when creating traders - This didn't reflect the actual available balance in exchange account - Could lead to incorrect position sizing and risk calculations Solution: - Before creating trader, query exchange API for actual balance - Use GetBalance() from respective trader implementation: * Binance: NewFuturesTrader + GetBalance() * Hyperliquid: NewHyperliquidTrader + GetBalance() * Aster: NewAsterTrader + GetBalance() - Extract 'available_balance' or 'balance' from response - Override user input with actual balance - Fallback to user input if query fails Changes: - Added 'nofx/trader' import - Query GetExchanges() to find matching exchange config - Create temporary trader instance based on exchange type - Call GetBalance() to fetch actual available balance - Use actualBalance instead of req.InitialBalance - Comprehensive error handling with fallback logic Benefits: - ✅ Ensures accurate initial balance matches exchange account - ✅ Prevents user errors in balance input - ✅ Improves position sizing accuracy - ✅ Maintains data integrity between system and exchange Example logs: ✓ 查询到交易所实际余额: 150.00 USDT (用户输入: 100.00 USDT)⚠️ 查询交易所余额失败,使用用户输入的初始资金: connection timeout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fixed compilation error caused by variable name mismatch: - Line 404: defined as 'trader' - Line 425: was using 'traderRecord' (undefined) This aligns with upstream dev branch naming convention.
新增功能: - update_stop_loss: 调整止损价格(追踪止损) - update_take_profit: 调整止盈价格(技术位优化) - partial_close: 部分平仓(分批止盈) 实现细节: - Decision struct 新增字段:NewStopLoss, NewTakeProfit, ClosePercentage - 新增执行函数:executeUpdateStopLossWithRecord, executeUpdateTakeProfitWithRecord, executePartialCloseWithRecord - 修复持仓字段获取 bug(使用 "side" 并转大写) - 更新 adaptive.txt 文档,包含详细使用示例和策略建议 - 优先级排序:平仓 > 调整止盈止损 > 开仓 命名统一: - 与社区 PR NoFxAiOS#197 保持一致,使用 update_* 而非 adjust_* - 独有功能:partial_close(部分平仓) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
問題根因: - auto_trader.go 已實現 update_stop_loss/update_take_profit/partial_close 處理 - adaptive.txt 已描述這些功能 - 但 validateDecision 的 validActions map 缺少這三個動作 - 導致 AI 生成的決策在驗證階段被拒絕:「无效的action:update_stop_loss」 修復內容: 1. validActions 添加三個新動作 2. 為每個新動作添加參數驗證: - update_stop_loss: 驗證 NewStopLoss > 0 - update_take_profit: 驗證 NewTakeProfit > 0 - partial_close: 驗證 ClosePercentage 在 0-100 之間 3. 修正註釋:adjust_* → update_* 測試狀態:feature 分支,等待測試確認
問題: - 調整止損/止盈時,直接調用 SetStopLoss/SetTakeProfit 會創建新訂單 - 但舊的止損/止盈單仍然存在,導致多個訂單共存 - 可能造成意外觸發或訂單衝突 解決方案(參考 PR NoFxAiOS#197): 1. 在 Trader 接口添加 CancelStopOrders 方法 2. 為三個交易所實現: - binance_futures.go: 過濾 STOP_MARKET/TAKE_PROFIT_MARKET 類型 - aster_trader.go: 同樣邏輯 - hyperliquid_trader.go: 過濾 trigger 訂單(有 triggerPx) 3. 在 executeUpdateStopLossWithRecord 和 executeUpdateTakeProfitWithRecord 中: - 先調用 CancelStopOrders 取消舊單 - 然後設置新止損/止盈 - 取消失敗不中斷執行(記錄警告) 優勢: - ✅ 避免多個止損單同時存在 - ✅ 保留我們的價格驗證邏輯 - ✅ 保留執行價格記錄 - ✅ 詳細錯誤信息 - ✅ 取消失敗時繼續執行(更健壯) 測試建議: - 開倉後調整止損,檢查舊止損單是否被取消 - 連續調整兩次,確認只有最新止損單存在 致謝:參考 PR NoFxAiOS#197 的實現思路
问题:部分平仓时,历史记录显示的是全仓位盈利,而非实际平仓部分的盈利 根本原因: - AnalyzePerformance 使用开仓总数量计算部分平仓的盈利 - 应该使用 action.Quantity(实际平仓数量)而非 openPos["quantity"](总数量) 修复: - 添加 actualQuantity 变量区分完整平仓和部分平仓 - partial_close 使用 action.Quantity - 所有相关计算(PnL、PositionValue、MarginUsed)都使用 actualQuantity 影响范围:logger/decision_logger.go:428-465 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- OpenOrder 結構不暴露 trigger 字段 - 改為取消該幣種的所有掛單(安全做法)
- This PR should only contain backend core functionality - prompts/adaptive.txt v2.0 is already in upstream - Prompt enhancements will be in separate PR (Batch 3)
更新內容:
1. DecisionAction 註釋:添加 update_stop_loss, update_take_profit, partial_close
2. GetStatistics:partial_close 計入 TotalClosePositions
3. AnalyzePerformance 預填充邏輯:處理 partial_close(不刪除持倉記錄)
4. AnalyzePerformance 分析邏輯:
- partial_close 正確判斷持倉方向
- 記錄部分平倉的盈虧統計
- 保留持倉記錄(因為還有剩餘倉位)
說明:partial_close 會記錄盈虧,但不刪除 openPositions,
因為還有剩餘倉位可能繼續交易
…ve.txt Add detailed guidance chapter for dynamic TP/SL management and partial close operations. ## Changes - New chapter: "动态止盈止损与部分平仓指引" (Dynamic TP/SL & Partial Close Guidance) - Inserted between "可用动作" (Actions) and "决策流程" (Decision Flow) sections - 4 key guidance points covering: 1. Partial close best practices (use clear percentages like 25%/50%/75%) 2. Reassessing remaining position after partial exit 3. Proper use cases for update_stop_loss / update_take_profit 4. Multi-stage exit strategy requirements ## Benefits - ✅ Provides concrete operational guidelines for AI decision-making - ✅ Clarifies when and how to use partial_close effectively - ✅ Emphasizes remaining position management (prevents "orphan" positions) - ✅ Aligns with existing backend support for partial_close action ## Background While adaptive.txt already lists partial_close as an available action, it lacked detailed operational guidance. This enhancement fills that gap by providing specific percentages, use cases, and multi-stage exit examples. Backend (decision/engine.go) already validates partial_close with close_percentage field, so this is purely a prompt enhancement with no code changes required. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
## Problem GetCurrentKlines had two critical bugs causing price data to become stale: 1. Incorrect return logic: returned error even when data fetch succeeded 2. Race condition: returned slice reference instead of deep copy, causing concurrent data corruption ## Impact - BTC price stuck at 106xxx while actual market price was 107xxx+ - LLM calculated take-profit based on stale prices → orders failed validation - Statistics showed incorrect P&L (0.00%) due to corrupted historical data - Alt-coins filtered out due to failed market data fetch ## Solution 1. Fixed return logic: only return error when actual failure occurs 2. Return deep copy instead of reference to prevent race conditions 3. Downgrade subscription errors to warnings (non-blocking) ## Test Results ✅ Price updates in real-time ✅ Take-profit orders execute successfully ✅ P&L calculations accurate ✅ Alt-coins now tradeable Related: Price feed mechanism, concurrent data access
…rofit-separation fix(trader): separate stop-loss and take-profit order cancellation to prevent accidental deletions
…erwrite fix(margin): correct position sizing formula to prevent insufficient margin errors
…on-mode fix(binance): initialize dual-side position mode to prevent code=-4061 errors
fix(ui): prevent system_prompt_template overwrite when value is empty string
fix(margin): correct position sizing formula to prevent insufficient margin errors
feat: 增加持仓最高收益缓存和自动止盈机制
…sets-api-error fix: 智能处理币安多资产模式和统一账户API错误
…n-notional fix(trader+decision): prevent quantity=0 error with minimum notional validation
* ci(docker): 添加Docker镜像构建和推送的GitHub Actions工作流 - 支持在main和develop分支及版本标签的push事件触发 - 支持Pull Request事件及手动触发工作流 - 配置了backend和frontend两个镜像的构建策略 - 使用QEMU和Docker Buildx实现多平台构建(amd64和arm64) - 集成GitHub Container Registry和Docker Hub登录 - 自动生成镜像元数据和多标签支持 - 支持基于GitHub Actions缓存提升构建速度 - 实现根据事件类型自动决定是否推送镜像 - 输出构建完成的镜像摘要信息 * Update Docker Hub login condition in workflow * Fix Docker Hub login condition in workflow * Simplify Docker Hub login step Removed conditional check for Docker Hub username. * Change branch names in Docker build workflow * Update docker-build.yml
* Fix Binance futures server time sync * Fix Binance server time sync; clean up logging and restore decision sorting --------- Co-authored-by: tinkle-community <[email protected]>
* feat: add frontend warnings for zero candidate coins 当候选币种数量为0时,在前端添加详细的错误提示和诊断信息 主要改动: 1. 决策日志中显示候选币种数量,为0时标红警告 2. 候选币种为0时显示详细警告卡片,包含可能原因和解决方案 3. 交易员列表页面添加信号源未配置的全局警告 4. 更新TraderInfo类型定义,添加use_coin_pool和use_oi_top字段 详细说明: - 在App.tsx的账户状态摘要中添加候选币种显示 - 当候选币种为0时,显示详细的警告卡片,列出: * 可能原因(API未配置、连接超时、数据为空等) * 解决方案(配置自定义币种、配置API、禁用选项等) - 在AITradersPage中添加信号源配置检查 * 当交易员启用了币种池但未配置API时显示全局警告 * 提供"立即配置信号源"快捷按钮 - 不改变任何后端逻辑,纯UI层面的用户提示改进 影响范围: - web/src/App.tsx: 决策记录卡片中的警告显示 - web/src/components/AITradersPage.tsx: 交易员列表页警告 - web/src/types.ts: TraderInfo类型定义更新 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: import AlertTriangle from lucide-react in App.tsx 修复TypeScript编译错误:Cannot find name 'AlertTriangle' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
* Change SQLite driver in database configuration Replace SQLite driver from 'github.com/mattn/go-sqlite3' to 'modernc.org/sqlite'. * Update go.mod --------- Co-authored-by: tinkle-community <[email protected]>
- Add 13 translation keys for candidate coins warnings in both English and Chinese - Update App.tsx to use t() function for all warning text - Update AITradersPage.tsx to use t() function for signal source warnings - Ensure proper internationalization for all user-facing messages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
…NoFxAiOS#520) Added functionality to display server public IP address for users to configure exchange API whitelists, specifically for Binance integration. Backend changes (api/server.go): - Add GET /api/server-ip endpoint requiring authentication - Implement getPublicIPFromAPI() with fallback to multiple IP services - Implement getPublicIPFromInterface() for local network interface detection - Add isPrivateIP() helper to filter private IP addresses - Import net package for IP address handling Frontend changes (web/): - Add getServerIP() API method in api.ts - Display server IP in ExchangeConfigModal for Binance - Add IP copy-to-clipboard functionality - Load and display server IP when Binance exchange is selected - Add i18n translations (en/zh) for whitelist IP messages: - whitelistIP, whitelistIPDesc, serverIPAddresses - copyIP, ipCopied, loadingServerIP User benefits: - Simplifies Binance API whitelist configuration - Shows exact server IP to add to exchange whitelist - One-click IP copy for convenience 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
## 问题描述 Docker Compose 首次启动时,config.db 被创建为目录而非文件, 导致 SQLite 数据库初始化失败,容器不断重启。 错误信息: "unable to open database file: is a directory" ## 发现时间 2025-11-02 00:14 (UTC+8) ## 根本原因 docker-compose.yml 中的卷挂载配置: - ./config.db:/app/config.db 当本地 config.db 不存在时,Docker 会自动创建同名**目录**。 ## 临时解决方案 1. docker-compose down 2. rm -rf config.db 3. touch config.db 4. docker-compose up -d ## 修复时间 2025-11-02 00:22 (UTC+8) ## 新增文件 - BUGFIX_CONFIG_DB_2025-11-02.md: 详细的 bug 修复报告 ## 建议改进 - 在 DOCKER_DEPLOY.md 中添加预启动步骤说明 - 考虑在 Dockerfile 中添加自动初始化脚本 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: shy <[email protected]> Co-authored-by: Claude <[email protected]>
This reverts commit 7dd669a.
* docs: add Japanese README * docs: Update README.ja.md * docs: add DOCKER_DEPLOY.ja.md --------- Co-authored-by: Ikko Ashimine <[email protected]>
# Conflicts: # web/src/components/AITradersPage.tsx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request | PR 提交
📝 Description | 描述
English: | 中文:
🎯 Type of Change | 变更类型
🔗 Related Issues | 相关 Issue
📋 Changes Made | 具体变更
English: | 中文:
🧪 Testing | 测试
✅ Checklist | 检查清单
Code Quality | 代码质量
Documentation | 文档
Git
devbranch | 已 rebase 到最新dev分支📚 Additional Notes | 补充说明
English: | 中文:
By submitting this PR, I confirm | 提交此 PR,我确认:
🌟 Thank you for your contribution! | 感谢你的贡献!