mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-12 23:36:55 +08:00
feat: add position history API and frontend integration
- Add /positions/history API endpoint - Add position history types and API client - Add translations for position history page - Integrate PositionHistory component in App
This commit is contained in:
@@ -29,6 +29,7 @@ import type {
|
||||
DebateMessage,
|
||||
DebateVote,
|
||||
DebatePersonalityInfo,
|
||||
PositionHistoryResponse,
|
||||
} from '../types'
|
||||
import { CryptoService } from './crypto'
|
||||
import { httpClient } from './httpClient'
|
||||
@@ -775,4 +776,13 @@ export const api = {
|
||||
const token = localStorage.getItem('auth_token')
|
||||
return new EventSource(`${API_BASE}/debates/${debateId}/stream?token=${token}`)
|
||||
},
|
||||
|
||||
// Position History API
|
||||
async getPositionHistory(traderId: string, limit: number = 100): Promise<PositionHistoryResponse> {
|
||||
const result = await httpClient.get<PositionHistoryResponse>(
|
||||
`${API_BASE}/positions/history?trader_id=${traderId}&limit=${limit}`
|
||||
)
|
||||
if (!result.success) throw new Error('获取历史仓位失败')
|
||||
return result.data!
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user