yfinance_rs/news/
wire.rs

1use serde::Deserialize;
2
3#[derive(Deserialize)]
4pub struct NewsEnvelope {
5    pub(crate) data: Option<NewsData>,
6}
7
8#[derive(Deserialize)]
9pub struct NewsData {
10    #[serde(rename = "tickerStream")]
11    pub(crate) ticker_stream: Option<TickerStream>,
12}
13
14#[derive(Deserialize)]
15pub struct TickerStream {
16    pub(crate) stream: Option<Vec<StreamItem>>,
17}
18
19#[derive(Deserialize)]
20pub struct StreamItem {
21    pub(crate) id: String,
22    pub(crate) content: Option<Content>,
23    // The python 'ad' check might be for a field at this level.
24    pub(crate) ad: Option<serde_json::Value>,
25}
26
27#[derive(Deserialize)]
28pub struct Content {
29    pub(crate) title: Option<String>,
30    #[serde(rename = "pubDate")]
31    pub(crate) pub_date: Option<String>,
32    pub(crate) provider: Option<Provider>,
33    #[serde(rename = "canonicalUrl")]
34    pub(crate) canonical_url: Option<CanonicalUrl>,
35}
36
37#[derive(Deserialize)]
38pub struct Provider {
39    #[serde(rename = "displayName")]
40    pub(crate) display_name: Option<String>,
41}
42
43#[derive(Deserialize)]
44pub struct CanonicalUrl {
45    pub(crate) url: Option<String>,
46}