feat(exchange): add Bybit Futures support (#1100)

* feat(exchange): add Bybit Futures support
- Add Bybit Go SDK dependency (github.com/bybit-exchange/bybit.go.api)
- Create trader/bybit_trader.go implementing Trader interface for USDT perpetual futures
- Update config/database.go to include Bybit in default exchanges
- Update manager/trader_manager.go to handle Bybit API key configuration
- Update trader/auto_trader.go to add BybitAPIKey/BybitSecretKey fields and bybit case
- Add Bybit icon to frontend ExchangeIcons.tsx
Bybit uses standard API Key/Secret Key authentication (similar to Binance).
Only USDT perpetual futures (category=linear) are supported.
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
* test(bybit): add comprehensive unit tests for Bybit trader
- Add BybitTraderTestSuite following existing test patterns
- Interface compliance test (Trader interface)
- Symbol format validation tests
- FormatQuantity tests with 3-decimal precision
- API response parsing tests (success, error, permission denied)
- Position side conversion tests (Buy->long, Sell->short)
- Cache duration verification test
- Mock server integration tests for API endpoints
All 12 Bybit tests pass.
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
* fix(frontend): add Bybit support to exchange config forms
修復前端對 Bybit 交易所的支持:
- 添加 Bybit 到 API Key/Secret Key 輸入欄位顯示邏輯
- 添加 Bybit 的表單驗證邏輯
- 修復 ExchangeConfigModal.tsx 和 AITradersPage.tsx
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
---------
Co-authored-by: the-dev-z <the-dev-z@users.noreply.github.com>
Co-authored-by: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
0xYYBB | ZYY | Bobo
2025-11-23 19:23:53 +08:00
committed by GitHub
parent 0002f36dc8
commit ded86d831f
10 changed files with 1186 additions and 11 deletions

View File

@@ -404,8 +404,9 @@ export function ExchangeConfigModal({
{selectedExchange && (
<>
{/* Binance 和其他 CEX 交易所的字段 */}
{/* Binance/Bybit 和其他 CEX 交易所的字段 */}
{(selectedExchange.id === 'binance' ||
selectedExchange.id === 'bybit' ||
selectedExchange.type === 'cex') &&
selectedExchange.id !== 'hyperliquid' &&
selectedExchange.id !== 'aster' && (
@@ -1012,11 +1013,14 @@ export function ExchangeConfigModal({
!asterPrivateKey.trim())) ||
(selectedExchange.id === 'lighter' &&
(!lighterWalletAddr.trim() || !lighterPrivateKey.trim())) ||
(selectedExchange.id === 'bybit' &&
(!apiKey.trim() || !secretKey.trim())) ||
(selectedExchange.type === 'cex' &&
selectedExchange.id !== 'hyperliquid' &&
selectedExchange.id !== 'aster' &&
selectedExchange.id !== 'lighter' &&
selectedExchange.id !== 'binance' &&
selectedExchange.id !== 'bybit' &&
selectedExchange.id !== 'okx' &&
(!apiKey.trim() || !secretKey.trim()))
}