rhood_core/models/user.rs
1//! User profile and day trade model types.
2
3use serde::{Deserialize, Serialize};
4
5/// Robinhood user profile.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct UserProfile {
8 /// Robinhood user ID.
9 pub id: Option<String>,
10 /// Username (usually email).
11 pub username: Option<String>,
12 /// First name.
13 pub first_name: Option<String>,
14 /// Last name.
15 pub last_name: Option<String>,
16 /// Email address.
17 pub email: Option<String>,
18 /// When the account was created.
19 pub created_at: Option<String>,
20}
21
22/// A recent day trade record.
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct DayTrade {
25 /// Instrument URL.
26 pub instrument: Option<String>,
27 /// Ticker symbol.
28 pub symbol: Option<String>,
29 /// Trade date.
30 pub date: Option<String>,
31 /// Trade settlement date.
32 pub settlement_date: Option<String>,
33}
34
35/// Day-trade status: the recent equity/option day trades, a count, and the
36/// pattern-day-trader flag (derived from the account's margin balances).
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct DayTradeCheck {
39 /// Recent equity day trades (raw API objects).
40 pub equity_day_trades: Vec<serde_json::Value>,
41 /// Recent option day trades (raw API objects).
42 pub option_day_trades: Vec<serde_json::Value>,
43 /// Total number of recent day trades (equity + option).
44 pub day_trade_count: i64,
45 /// Whether the account is flagged as a pattern day trader.
46 pub flagged_as_pattern_day_trader: bool,
47}