webull_rs/models/
account.rs1use serde::{Deserialize, Serialize};
2use chrono::{DateTime, Utc};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Account {
7 pub id: String,
9
10 pub account_number: String,
12
13 pub account_type: AccountType,
15
16 pub status: AccountStatus,
18
19 pub created_at: DateTime<Utc>,
21
22 pub currency: String,
24
25 pub paper_trading: bool,
27}
28
29#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
31#[serde(rename_all = "UPPERCASE")]
32pub enum AccountType {
33 Cash,
35
36 Margin,
38
39 Ira,
41
42 Other,
44}
45
46#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
48#[serde(rename_all = "UPPERCASE")]
49pub enum AccountStatus {
50 Active,
52
53 Closed,
55
56 Pending,
58
59 Suspended,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct AccountBalance {
66 pub cash: f64,
68
69 pub buying_power: f64,
71
72 pub market_value: f64,
74
75 pub total_value: f64,
77
78 pub unrealized_profit_loss: f64,
80
81 pub unrealized_profit_loss_percentage: f64,
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize)]
87pub struct Position {
88 pub symbol: String,
90
91 pub quantity: f64,
93
94 pub cost_basis: f64,
96
97 pub market_value: f64,
99
100 pub unrealized_profit_loss: f64,
102
103 pub unrealized_profit_loss_percentage: f64,
105
106 pub current_price: f64,
108
109 pub opened_at: DateTime<Utc>,
111}