Skip to main content

fmp_rust_sdk/models/
company.rs

1//! Search, directory, and company information responses.
2
3use chrono::{NaiveDate, NaiveDateTime};
4use serde::{Deserialize, Serialize};
5
6/// A match from `search-symbol` or `search-name`.
7#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
8#[serde(rename_all = "camelCase")]
9pub struct SearchResult {
10    #[serde(deserialize_with = "super::non_empty_string")]
11    pub symbol: String,
12    #[serde(deserialize_with = "super::non_empty_string")]
13    pub name: String,
14    pub currency: Option<String>,
15    pub exchange_full_name: Option<String>,
16    pub exchange: Option<String>,
17}
18
19/// A symbol and name from `stock-list`, `etf-list`, or `actively-trading-list`.
20#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
21pub struct DirectorySymbol {
22    #[serde(deserialize_with = "super::non_empty_string")]
23    pub symbol: String,
24    pub name: String,
25}
26
27/// Company information returned by the Stable `profile` endpoint.
28#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
29#[serde(rename_all = "camelCase")]
30pub struct Profile {
31    #[serde(deserialize_with = "super::non_empty_string")]
32    pub symbol: String,
33    #[serde(deserialize_with = "super::non_empty_string")]
34    pub company_name: String,
35    pub price: Option<f64>,
36    pub market_cap: Option<f64>,
37    pub beta: Option<f64>,
38    pub last_dividend: Option<f64>,
39    pub range: Option<String>,
40    pub change: Option<f64>,
41    pub change_percentage: Option<f64>,
42    pub volume: Option<f64>,
43    pub average_volume: Option<f64>,
44    pub currency: Option<String>,
45    pub cik: Option<String>,
46    pub isin: Option<String>,
47    pub cusip: Option<String>,
48    pub exchange_full_name: Option<String>,
49    pub exchange: Option<String>,
50    pub industry: Option<String>,
51    pub website: Option<String>,
52    pub description: Option<String>,
53    pub ceo: Option<String>,
54    pub sector: Option<String>,
55    pub country: Option<String>,
56    /// FMP reports the employee count as a string.
57    pub full_time_employees: Option<String>,
58    pub phone: Option<String>,
59    pub address: Option<String>,
60    pub city: Option<String>,
61    pub state: Option<String>,
62    pub zip: Option<String>,
63    pub image: Option<String>,
64    #[serde(default, deserialize_with = "super::optional_date")]
65    pub ipo_date: Option<NaiveDate>,
66    pub default_image: Option<bool>,
67    pub is_etf: Option<bool>,
68    pub is_actively_trading: Option<bool>,
69    pub is_adr: Option<bool>,
70    pub is_fund: Option<bool>,
71}
72
73/// A comparable company from `stock-peers`.
74#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
75#[serde(rename_all = "camelCase")]
76pub struct Peer {
77    #[serde(deserialize_with = "super::non_empty_string")]
78    pub symbol: String,
79    pub company_name: String,
80    pub price: Option<f64>,
81    #[serde(rename = "mktCap")]
82    pub market_cap: Option<f64>,
83}
84
85/// A daily market capitalization from `market-capitalization` or its historical endpoint.
86#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
87#[serde(rename_all = "camelCase")]
88pub struct MarketCapitalization {
89    #[serde(deserialize_with = "super::non_empty_string")]
90    pub symbol: String,
91    pub date: NaiveDate,
92    pub market_cap: f64,
93}
94
95/// Share ownership and available float from `shares-float`.
96#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
97#[serde(rename_all = "camelCase")]
98pub struct ShareFloat {
99    #[serde(deserialize_with = "super::non_empty_string")]
100    pub symbol: String,
101    #[serde(with = "super::timestamp")]
102    pub date: NaiveDateTime,
103    pub free_float: Option<f64>,
104    pub float_shares: Option<f64>,
105    pub outstanding_shares: Option<f64>,
106    pub source: Option<String>,
107}