mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-07 11:17:56 +08:00
518339474f
## Problem The codebase contains mixed Traditional Chinese (繁體中文) and Simplified Chinese (简体中文) in comments and error messages, causing: - Inconsistent code style - Reduced readability for mainland Chinese developers - Maintenance overhead when reviewing diffs ### Affected Files - **trader/hyperliquid_trader.go**: 8 occurrences - **trader/binance_futures.go**: 2 occurrences ## Solution Convert all Traditional Chinese characters to Simplified Chinese to unify code style. ### Conversion Map | Traditional | Simplified | Context | |-------------|-----------|---------| | 處理 | 处理 | "正確處理" → "正确处理" | | 總資產 | 总资产 | "總資產" → "总资产" | | 餘額 | 余额 | "可用餘額" → "可用余额" | | 實現 | 实现 | "未實現盈虧" → "未实现盈亏" | | 來 | 来 | "僅來自" → "仅来自" | | 現貨 | 现货 | "現貨餘額" → "现货余额" | | 單獨 | 单独 | "單獨返回" → "单独返回" | | 開倉 | 开仓 | "開倉金額" → "开仓金额" | | 數量 | 数量 | "開倉數量" → "开仓数量" | | 過 | 过 | "過小" → "过小" | | 為 | 为 | "後為" → "后为" | | 後 | 后 | "格式化後" → "格式化后" | | 建議 | 建议 | "建議增加" → "建议增加" | | 選擇 | 选择 | "選擇價格" → "选择价格" | | 幣種 | 币种 | "幣種" → "币种" | ## Changes ### trader/hyperliquid_trader.go (8 locations) **Line 173-181**: Balance calculation comments ```diff -// ✅ Step 5: 正確處理 Spot + Perpetuals 余额 -// 重要:Spot 只加到總資產,不加到可用餘額 +// ✅ Step 5: 正确处理 Spot + Perpetuals 余额 +// 重要:Spot 只加到总资产,不加到可用余额 -result["totalWalletBalance"] = totalWalletBalance // 總資產(Perp + Spot) -result["availableBalance"] = availableBalance // 可用餘額(僅 Perpetuals,不含 Spot) -result["totalUnrealizedProfit"] = totalUnrealizedPnl // 未實現盈虧(僅來自 Perpetuals) -result["spotBalance"] = spotUSDCBalance // Spot 現貨餘額(單獨返回) +result["totalWalletBalance"] = totalWalletBalance // 总资产(Perp + Spot) +result["availableBalance"] = availableBalance // 可用余额(仅 Perpetuals,不含 Spot) +result["totalUnrealizedProfit"] = totalUnrealizedPnl // 未实现盈亏(仅来自 Perpetuals) +result["spotBalance"] = spotUSDCBalance // Spot 现货余额(单独返回) ``` **Line 189-191**: Log output messages ```diff -log.Printf(" • Perpetuals 可用余额: %.2f USDC (可直接用於開倉)", availableBalance) -log.Printf(" • 總資產 (Perp+Spot): %.2f USDC", totalWalletBalance) +log.Printf(" • Perpetuals 可用余额: %.2f USDC (可直接用于开仓)", availableBalance) +log.Printf(" • 总资产 (Perp+Spot): %.2f USDC", totalWalletBalance) ``` ### trader/binance_futures.go (2 locations) **Line 301, 355**: Error messages for insufficient quantity ```diff -return nil, fmt.Errorf("开倉數量過小,格式化後為 0 (原始: %.8f → 格式化: %s)。建議增加開倉金額或選擇價格更低的幣種", quantity, quantityStr) +return nil, fmt.Errorf("开仓数量过小,格式化后为 0 (原始: %.8f → 格式化: %s)。建议增加开仓金额或选择价格更低的币种", quantity, quantityStr) ``` ## Testing - ✅ Compilation: Passes `go build` - ✅ Verification: No Traditional Chinese characters remain in trader/*.go - ✅ Functionality: No logic changes, only text updates ## Impact - ✅ Unified code style (100% Simplified Chinese) - ✅ Improved readability and maintainability - ✅ Easier code review for Chinese developers - ✅ No functional changes or behavior modifications --- Co-authored-by: tinkle-community <tinklefund@gmail.com>