1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct ApiResponse<T> {
10 pub data: T,
11 pub timestamp: String,
12 pub status: String,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct ApiError {
18 pub error: String,
19 pub status: u16,
20 pub message: String,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct HealthStatus {
27 pub status: String,
28 pub uptime: Option<f64>,
29 pub version: Option<String>,
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct DetailedHealth {
34 pub status: String,
35 pub uptime: Option<f64>,
36 pub version: Option<String>,
37 pub solana_rpc: Option<String>,
38 pub database: Option<String>,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
44pub struct Market {
45 pub id: String,
46 pub name: String,
47 pub base_token: String,
48 pub quote_token: String,
49 pub price: f64,
50 pub volume_24h: Option<f64>,
51 pub open_interest: Option<f64>,
52 pub max_leverage: Option<u8>,
53 pub status: Option<String>,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct MarketStats {
58 pub market_id: String,
59 pub volume_24h: f64,
60 pub trades_24h: u64,
61 pub high_24h: f64,
62 pub low_24h: f64,
63 pub price_change_24h: f64,
64 pub open_interest: f64,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
70pub struct Trade {
71 pub trade_id: String,
72 pub market_id: String,
73 pub trader: String,
74 pub side: String,
75 pub size: f64,
76 pub price: f64,
77 pub leverage: Option<u8>,
78 pub pnl: Option<f64>,
79 pub fee: Option<f64>,
80 pub timestamp: String,
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize)]
86pub struct Portfolio {
87 pub wallet: String,
88 pub total_balance: f64,
89 pub unrealized_pnl: f64,
90 pub realized_pnl: f64,
91 pub positions: Vec<PortfolioPosition>,
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
95pub struct PortfolioPosition {
96 pub market_id: String,
97 pub side: String,
98 pub size: f64,
99 pub entry_price: f64,
100 pub current_price: f64,
101 pub pnl: f64,
102 pub leverage: u8,
103 pub liquidation_price: f64,
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
107pub struct PortfolioHistory {
108 pub wallet: String,
109 pub entries: Vec<HistoryEntry>,
110}
111
112#[derive(Debug, Clone, Serialize, Deserialize)]
113pub struct HistoryEntry {
114 pub timestamp: String,
115 pub balance: f64,
116 pub pnl: f64,
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize)]
120pub struct PortfolioStats {
121 pub wallet: String,
122 pub total_trades: u64,
123 pub win_rate: f64,
124 pub avg_pnl: f64,
125 pub best_trade: f64,
126 pub worst_trade: f64,
127 pub total_volume: f64,
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
133pub struct LeaderboardEntry {
134 pub rank: u32,
135 pub wallet: String,
136 pub pnl: f64,
137 pub win_rate: f64,
138 pub total_trades: u64,
139 pub volume: f64,
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
145pub struct Token {
146 pub symbol: String,
147 pub name: String,
148 pub mint: Option<String>,
149 pub decimals: Option<u8>,
150 pub price: Option<f64>,
151 pub market_cap: Option<f64>,
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
157pub struct PlatformStats {
158 pub total_volume: f64,
159 pub total_trades: u64,
160 pub total_users: u64,
161 pub open_interest: f64,
162 pub total_fees: f64,
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
166pub struct MarketOverview {
167 pub markets: Vec<MarketStats>,
168 pub total_markets: u32,
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
172pub struct ExchangeMetrics {
173 pub volume_24h: f64,
174 pub trades_24h: u64,
175 pub active_users_24h: u64,
176 pub liquidations_24h: u64,
177 pub fees_24h: f64,
178}