1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! Watchlist model types.
use serde::{Deserialize, Serialize};
/// A user watchlist from the Robinhood midlands lists API.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Watchlist {
/// Unique list identifier.
pub id: Option<String>,
/// Display name of the watchlist.
pub display_name: Option<String>,
/// Display description of the watchlist.
pub display_description: Option<String>,
/// Owner type (e.g., `"custom"`).
pub owner_type: Option<String>,
/// Owner user ID.
pub owner: Option<String>,
/// Emoji icon for the watchlist.
pub icon_emoji: Option<String>,
/// Number of items in the watchlist.
pub item_count: Option<i64>,
/// Whether the user follows this watchlist.
pub followed: Option<bool>,
/// Whether the list is expanded by default in the UI.
pub default_expanded: Option<bool>,
/// Read permission level (e.g., `"private"`).
pub read_permission: Option<String>,
/// Sort direction for child items (e.g., `"ascending"`).
pub child_sort_direction: Option<String>,
/// Sort order for child items (e.g., `"custom"`).
pub child_sort_order: Option<String>,
/// Object types allowed in this watchlist.
pub allowed_object_types: Option<Vec<String>>,
/// Child info with item type and inline children.
pub child_info: Option<WatchlistChildInfo>,
/// IDs of parent lists.
pub parent_lists: Option<Vec<String>>,
/// IDs of related lists.
pub related_lists: Option<Vec<String>>,
/// Hero images for the list (schema varies).
pub hero_images: Option<serde_json::Value>,
/// Timestamp when the watchlist was created.
pub created_at: Option<String>,
/// Timestamp when the watchlist was last updated.
pub updated_at: Option<String>,
}
/// Child info metadata for a watchlist.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WatchlistChildInfo {
/// Type of children (e.g., `"item"`).
pub child_type: Option<String>,
/// Inline children (may be empty; full items come from the items endpoint).
pub children: Option<Vec<WatchlistItem>>,
}
/// An enriched watchlist item from the discovery API.
///
/// Contains both the list membership metadata and live market data
/// for the instrument.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WatchlistItem {
/// Unique item identifier.
pub id: Option<String>,
/// Parent watchlist ID.
pub list_id: Option<String>,
/// Instrument UUID (object_id in the API).
pub object_id: Option<String>,
/// Object type (e.g., "instrument", "currency_pair").
pub object_type: Option<String>,
/// Owner type (e.g., "custom").
pub owner_type: Option<String>,
/// Sort weight within the list.
pub weight: Option<String>,
/// Ticker symbol.
pub symbol: Option<String>,
/// Company display name.
pub name: Option<String>,
/// Current price.
pub price: Option<f64>,
/// Current bid price.
pub bid_price: Option<f64>,
/// Current ask price.
pub ask_price: Option<f64>,
/// Previous session close price.
pub previous_close: Option<f64>,
/// Dollar change from previous close.
pub one_day_dollar_change: Option<f64>,
/// Percent change from previous close.
pub one_day_percent_change: Option<f64>,
/// Rolling dollar change.
pub one_day_rolling_dollar_change: Option<f64>,
/// Rolling percent change.
pub one_day_rolling_percent_change: Option<f64>,
/// Session high price.
pub high: Option<f64>,
/// Session low price.
pub low: Option<f64>,
/// Trading volume.
pub volume: Option<f64>,
/// Average trading volume.
pub average_volume: Option<f64>,
/// Market capitalization.
pub market_cap: Option<f64>,
/// 52-week high.
pub high_52_weeks: Option<f64>,
/// 52-week low.
pub low_52_weeks: Option<f64>,
/// Price-to-earnings ratio.
pub pe_ratio: Option<f64>,
/// Opening price.
pub open_price: Option<f64>,
/// Opening price direction.
pub open_price_direction: Option<String>,
/// Number of open positions the user holds.
pub open_positions: Option<i64>,
/// Whether the user currently holds this instrument.
pub holdings: Option<bool>,
/// Total return percentage for user's position.
pub total_return_percentage: Option<f64>,
/// Instrument state (e.g., "active").
pub state: Option<String>,
/// IPO access status.
pub ipo_access_status: Option<String>,
/// US tradability status.
pub us_tradability: Option<String>,
/// UK tradability status.
pub uk_tradability: Option<String>,
/// Timestamp when the item was added to the list.
pub created_at: Option<String>,
/// Timestamp when the item was last updated.
pub updated_at: Option<String>,
}