feat: add exchange account states and refine beginner trader creation flow (#1450)

* feat: implement exchange account state management and UI updates

- Added functionality to invalidate exchange account state cache on exchange config updates, creation, and deletion.
- Introduced new API endpoint to fetch exchange account states.
- Updated frontend components to display exchange account states, including status and balance information.
- Enhanced user experience by refreshing exchange account states after relevant actions.

* feat: enhance trader creation readiness in AITradersPage and BeginnerGuideCards

---------

Co-authored-by: Dean <afei.wuhao@gmail.com>
This commit is contained in:
deanokk
2026-04-01 16:26:04 +08:00
committed by GitHub
parent 9937542020
commit 9a80f1d88d
10 changed files with 551 additions and 186 deletions

View File

@@ -41,6 +41,30 @@ export interface Exchange {
lighterApiKeyIndex?: number
}
export type ExchangeAccountStatus =
| 'ok'
| 'disabled'
| 'missing_credentials'
| 'invalid_credentials'
| 'permission_denied'
| 'unavailable'
export interface ExchangeAccountState {
exchange_id: string
status: ExchangeAccountStatus
display_balance?: string
asset?: string
total_equity?: number
available_balance?: number
checked_at: string
error_code?: string
error_message?: string
}
export interface ExchangeAccountStateResponse {
states: Record<string, ExchangeAccountState>
}
export interface CreateExchangeRequest {
exchange_type: string // "binance", "bybit", "okx", "hyperliquid", "aster", "lighter"
account_name: string // User-defined account name