fix(bybit): complete Bybit integration by adding API layer support #1149
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.
Problem
PR #1100 added Bybit Futures trader implementation but missed the API layer integration, causing:
Root Cause
While PR #1100 successfully implemented:
trader/bybit_trader.go- complete Bybit tradermanager/trader_manager.go- API key configurationtrader/auto_trader.go- Bybit case in AutoTraderlogger/decision_logger.go- 0.055% fee rateIt missed the API server layer integration in
api/server.go, which prevents users from actually using Bybit.Solution
Add Bybit case in two critical switch statements in
api/server.go:handleCreateTrader()(line ~565) - Balance query when creating a new traderhandleSyncBalance()(line ~946) - Manual balance sync functionalityBoth locations now properly create a Bybit trader instance for balance queries:
Testing
✅ Tested on local fork (the-dev-z/nofx, z-dev-v3 branch):
Impact
This fix completes the Bybit integration from PR #1100, enabling users to:
中文說明
問題描述
PR #1100 實現了 Bybit Futures 交易器,但遺漏了 API 層的集成,導致:
根本原因
雖然 PR #1100 成功實現了:
trader/bybit_trader.go- 完整的 Bybit 交易器邏輯manager/trader_manager.go- API 密鑰配置trader/auto_trader.go- AutoTrader 中的 Bybit caselogger/decision_logger.go- 0.055% 手續費率但遺漏了
api/server.go中的 API 伺服器層集成,這導致用戶實際上無法使用 Bybit。解決方案
在
api/server.go的兩個關鍵 switch 語句中添加 Bybit case:handleCreateTrader()(約第 565 行) - 創建新交易員時的餘額查詢handleSyncBalance()(約第 946 行) - 手動餘額同步功能兩個位置現在都正確創建了 Bybit 交易器實例用於餘額查詢。
測試驗證
✅ 已在個人 fork (the-dev-z/nofx, z-dev-v3 分支) 上測試:
影響範圍
此修復完成了 PR #1100 的 Bybit 集成,使用戶能夠:
Related: #1100 (original Bybit PR)
Fixes: Incomplete Bybit integration
🤖 Generated with Claude Code