Feature/okx trading (#1177)

* feat: add OKX exchange trading support
- Add OKX trader client with full trading API integration
- Support API Key, Secret Key, and Passphrase authentication
- Add OKX icon and frontend configuration modal
- Update exchange store and types for OKX fields
* fix: add passphrase column migration and fix exchange type mapping
* fix: show OKX input fields in exchange config modal
* fix: ensure all supported exchanges exist for user when listing
* fix: simplify exchange type check condition for OKX
* debug: add visible debug info for exchange id
* fix: remove debug info from exchange config modal
* fix: add OKX to exchange type condition in AITradersPage
* feat: complete OKX trading support and fix exchange config issues
- Add LIGHTER exchange UI support in AITradersPage
- Add passphrase field to UpdateExchangeConfigRequest type
- Fix OKX HTTP client to bypass proxy (disable system proxy)
- Auto-fetch initial balance from exchange when not set
- Support multiple balance field names for different exchanges
- Add detailed error messages when trader fails to load
- Add lighter_api_key_private_key field to exchange store
This commit is contained in:
tinkle-community
2025-12-06 18:04:59 +08:00
committed by GitHub
parent 5d1d0b6842
commit 1e5ece947c
11 changed files with 1489 additions and 68 deletions

View File

@@ -80,6 +80,28 @@ const BybitIcon: React.FC<IconProps> = ({
</svg>
)
// OKX SVG 图标组件
const OKXIcon: React.FC<IconProps> = ({
width = 24,
height = 24,
className,
}) => (
<svg
width={width}
height={height}
viewBox="0 0 200 200"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<rect width="200" height="200" rx="24" fill="#000"/>
<rect x="40" y="40" width="50" height="50" rx="8" fill="#fff"/>
<rect x="110" y="40" width="50" height="50" rx="8" fill="#fff"/>
<rect x="40" y="110" width="50" height="50" rx="8" fill="#fff"/>
<rect x="110" y="110" width="50" height="50" rx="8" fill="#fff"/>
</svg>
)
// Aster SVG 图标组件
const AsterIcon: React.FC<IconProps> = ({
width = 24,
@@ -168,11 +190,13 @@ export const getExchangeIcon = (
? 'binance'
: exchangeType.toLowerCase().includes('bybit')
? 'bybit'
: exchangeType.toLowerCase().includes('hyperliquid')
? 'hyperliquid'
: exchangeType.toLowerCase().includes('aster')
? 'aster'
: exchangeType.toLowerCase()
: exchangeType.toLowerCase().includes('okx')
? 'okx'
: exchangeType.toLowerCase().includes('hyperliquid')
? 'hyperliquid'
: exchangeType.toLowerCase().includes('aster')
? 'aster'
: exchangeType.toLowerCase()
const iconProps = {
width: props.width || 24,
@@ -185,6 +209,8 @@ export const getExchangeIcon = (
return <BinanceIcon {...iconProps} />
case 'bybit':
return <BybitIcon {...iconProps} />
case 'okx':
return <OKXIcon {...iconProps} />
case 'hyperliquid':
case 'dex':
return <HyperliquidIcon {...iconProps} />