lighter_rust/models/
account.rs1use super::AccountTier;
2use chrono::{DateTime, Utc};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Account {
7 pub id: String,
8 pub address: String,
9 pub tier: AccountTier,
10 pub created_at: DateTime<Utc>,
11 pub updated_at: DateTime<Utc>,
12 pub balances: Vec<Balance>,
13 pub positions: Vec<Position>,
14 pub tier_switch_allowed_at: Option<DateTime<Utc>>,
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct Balance {
19 pub asset: String,
20 pub total: String,
21 pub available: String,
22 pub locked: String,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct Position {
27 pub symbol: String,
28 pub side: super::Side,
29 pub size: String,
30 pub entry_price: String,
31 pub mark_price: String,
32 pub unrealized_pnl: String,
33 pub margin_type: MarginType,
34 pub leverage: String,
35 pub created_at: DateTime<Utc>,
36 pub updated_at: DateTime<Utc>,
37}
38
39#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
40#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
41pub enum MarginType {
42 Cross,
43 Isolated,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
47pub struct AccountTierSwitchRequest {
48 pub target_tier: AccountTier,
49 pub signature: String,
50 pub nonce: u64,
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct AccountStats {
55 pub total_volume: String,
56 pub maker_volume: String,
57 pub taker_volume: String,
58 pub total_fees_paid: String,
59 pub total_trades: u64,
60 pub win_rate: String,
61 pub pnl: String,
62}