Initial commit: Polymarket copy trading bot
- Backend: Spring Boot + Kotlin implementation - Account management with private key import - Leader management - Copy trading configuration - Order synchronization - Balance and position queries via Polymarket API - Ethereum RPC integration for USDC balance - Proxy address calculation - Frontend: React + TypeScript - Account management UI - Mobile responsive design - Account import with private key/mnemonic support - Balance display and account details modal - Database: MySQL with Flyway migrations - API Integration: Polymarket CLOB API, Data API, Ethereum RPC
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* API 统一响应格式
|
||||
*/
|
||||
export interface ApiResponse<T> {
|
||||
code: number
|
||||
data: T | null
|
||||
msg: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户信息
|
||||
*/
|
||||
export interface Account {
|
||||
id: number
|
||||
walletAddress: string
|
||||
accountName?: string
|
||||
isDefault: boolean
|
||||
apiKeyConfigured: boolean
|
||||
apiSecretConfigured: boolean
|
||||
apiPassphraseConfigured: boolean
|
||||
balance?: string
|
||||
totalOrders?: number
|
||||
totalPnl?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户列表响应
|
||||
*/
|
||||
export interface AccountListResponse {
|
||||
list: Account[]
|
||||
total: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户导入请求
|
||||
*/
|
||||
export interface AccountImportRequest {
|
||||
privateKey: string
|
||||
walletAddress: string
|
||||
accountName?: string
|
||||
apiKey?: string
|
||||
apiSecret?: string
|
||||
apiPassphrase?: string
|
||||
isDefault?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户更新请求
|
||||
*/
|
||||
export interface AccountUpdateRequest {
|
||||
accountId: number
|
||||
accountName?: string
|
||||
apiKey?: string
|
||||
apiSecret?: string
|
||||
apiPassphrase?: string
|
||||
isDefault?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Leader 信息
|
||||
*/
|
||||
export interface Leader {
|
||||
id: number
|
||||
leaderAddress: string
|
||||
leaderName?: string
|
||||
accountId?: number
|
||||
category?: string
|
||||
enabled: boolean
|
||||
copyRatio: string
|
||||
totalOrders?: number
|
||||
totalPnl?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Leader 列表响应
|
||||
*/
|
||||
export interface LeaderListResponse {
|
||||
list: Leader[]
|
||||
total: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Leader 添加请求
|
||||
*/
|
||||
export interface LeaderAddRequest {
|
||||
leaderAddress: string
|
||||
leaderName?: string
|
||||
accountId?: number
|
||||
category?: string
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 跟单配置
|
||||
*/
|
||||
export interface CopyTradingConfig {
|
||||
copyMode: 'RATIO' | 'FIXED'
|
||||
copyRatio: string
|
||||
fixedAmount?: string
|
||||
maxOrderSize: string
|
||||
minOrderSize: string
|
||||
maxDailyLoss: string
|
||||
maxDailyOrders: number
|
||||
priceTolerance: string
|
||||
delaySeconds: number
|
||||
pollIntervalSeconds: number
|
||||
useWebSocket: boolean
|
||||
websocketReconnectInterval: number
|
||||
websocketMaxRetries: number
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 跟单订单
|
||||
*/
|
||||
export interface CopyOrder {
|
||||
id: number
|
||||
accountId: number
|
||||
leaderId: number
|
||||
leaderAddress: string
|
||||
leaderName?: string
|
||||
marketId: string
|
||||
category: string
|
||||
side: 'BUY' | 'SELL'
|
||||
price: string
|
||||
size: string
|
||||
copyRatio: string
|
||||
orderId?: string
|
||||
status: string
|
||||
filledSize: string
|
||||
pnl?: string
|
||||
createdAt: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表响应
|
||||
*/
|
||||
export interface OrderListResponse {
|
||||
list: CopyOrder[]
|
||||
total: number
|
||||
page: number
|
||||
limit: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计信息
|
||||
*/
|
||||
export interface Statistics {
|
||||
totalOrders: number
|
||||
totalPnl: string
|
||||
winRate: string
|
||||
avgPnl: string
|
||||
maxProfit: string
|
||||
maxLoss: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user