feat: add Bitget futures trading support

- Add BitgetTrader with full trading implementation
- Support one-way position mode with proper API parameters
- Add Bitget to all exchange switch statements
- Update exchange icons (Bybit, OKX, Bitget, Lighter)
- Add Bitget to frontend exchange config modal
This commit is contained in:
tinkle-community
2025-12-12 18:59:09 +08:00
parent 76574aacb2
commit dcc16fec82
10 changed files with 1253 additions and 39 deletions

View File

@@ -21,6 +21,7 @@ const SUPPORTED_EXCHANGE_TEMPLATES = [
{ exchange_type: 'binance', name: 'Binance Futures', type: 'cex' as const },
{ exchange_type: 'bybit', name: 'Bybit Futures', type: 'cex' as const },
{ exchange_type: 'okx', name: 'OKX Futures', type: 'cex' as const },
{ exchange_type: 'bitget', name: 'Bitget Futures', type: 'cex' as const },
{ exchange_type: 'hyperliquid', name: 'Hyperliquid', type: 'dex' as const },
{ exchange_type: 'aster', name: 'Aster DEX', type: 'dex' as const },
{ exchange_type: 'lighter', name: 'Lighter', type: 'dex' as const },
@@ -123,6 +124,7 @@ export function ExchangeConfigModal({
binance: { url: 'https://www.binance.com/join?ref=NOFXENG', hasReferral: true },
okx: { url: 'https://www.okx.com/join/1865360', hasReferral: true },
bybit: { url: 'https://partner.bybit.com/b/83856', hasReferral: true },
bitget: { url: 'https://www.bitget.com/referral/register?from=referral&clacCode=c8a43172', hasReferral: true },
hyperliquid: { url: 'https://app.hyperliquid.xyz/join/AITRADING', hasReferral: true },
aster: { url: 'https://www.asterdex.com/en/referral/fdfc0e', hasReferral: true },
lighter: { url: 'https://lighter.xyz', hasReferral: false },
@@ -282,6 +284,9 @@ export function ExchangeConfigModal({
} else if (currentExchangeType === 'okx') {
if (!apiKey.trim() || !secretKey.trim() || !passphrase.trim()) return
await onSave(exchangeId, exchangeType, trimmedAccountName, apiKey.trim(), secretKey.trim(), passphrase.trim(), testnet)
} else if (currentExchangeType === 'bitget') {
if (!apiKey.trim() || !secretKey.trim() || !passphrase.trim()) return
await onSave(exchangeId, exchangeType, trimmedAccountName, apiKey.trim(), secretKey.trim(), passphrase.trim(), testnet)
} else if (currentExchangeType === 'hyperliquid') {
if (!apiKey.trim() || !hyperliquidWalletAddr.trim()) return // 验证私钥和钱包地址
await onSave(
@@ -533,10 +538,11 @@ export function ExchangeConfigModal({
{selectedTemplate && (
<>
{/* Binance/Bybit/OKX 的输入字段 */}
{/* Binance/Bybit/OKX/Bitget 的输入字段 */}
{(currentExchangeType === 'binance' ||
currentExchangeType === 'bybit' ||
currentExchangeType === 'okx') && (
currentExchangeType === 'okx' ||
currentExchangeType === 'bitget') && (
<>
{/* 币安用户配置提示 (D1 方案) */}
{currentExchangeType === 'binance' && (
@@ -681,7 +687,7 @@ export function ExchangeConfigModal({
/>
</div>
{currentExchangeType === 'okx' && (
{(currentExchangeType === 'okx' || currentExchangeType === 'bitget') && (
<div>
<label
className="block text-sm font-semibold mb-2"
@@ -1184,6 +1190,10 @@ export function ExchangeConfigModal({
(!apiKey.trim() ||
!secretKey.trim() ||
!passphrase.trim())) ||
(currentExchangeType === 'bitget' &&
(!apiKey.trim() ||
!secretKey.trim() ||
!passphrase.trim())) ||
(currentExchangeType === 'hyperliquid' &&
(!apiKey.trim() || !hyperliquidWalletAddr.trim())) || // 验证私钥和钱包地址
(currentExchangeType === 'aster' &&
@@ -1201,6 +1211,7 @@ export function ExchangeConfigModal({
currentExchangeType !== 'binance' &&
currentExchangeType !== 'bybit' &&
currentExchangeType !== 'okx' &&
currentExchangeType !== 'bitget' &&
(!apiKey.trim() || !secretKey.trim()))
}
className="flex-1 px-4 py-2 rounded text-sm font-semibold disabled:opacity-50"