Skip to main content

rusty_fmp/
endpoint.rs

1//! Stable API endpoint descriptors for confirmed FMP paths.
2//!
3//! All endpoints are flat [`Endpoint`] values. Query shape (symbol-only,
4//! date-range, annual statement, etc.) is supplied by the caller using the
5//! corresponding [`FmpClient`](crate::FmpClient) shape method.
6
7/// Default period used by annual statement-style endpoints.
8pub const ANNUAL_PERIOD: &str = "annual";
9
10/// Quarterly period value accepted by statement-style endpoints.
11pub const QUARTER_PERIOD: &str = "quarter";
12
13/// Default row limit for annual statement-style endpoints.
14pub const ANNUAL_LIMIT: u16 = 5;
15
16/// Default item limit for news and other limited list endpoints.
17pub const NEWS_LIMIT: u16 = 10;
18
19/// Default page for paginated endpoints.
20pub const PAGE: u16 = 0;
21
22/// Stable API endpoint path.
23#[derive(Clone, Copy, Debug, Eq, PartialEq)]
24pub struct Endpoint {
25    path: &'static str,
26}
27
28impl Endpoint {
29    /// Creates a descriptor for an FMP stable API path.
30    #[must_use]
31    pub const fn new(path: &'static str) -> Self {
32        Self { path }
33    }
34
35    /// Returns the stable API path.
36    #[must_use]
37    pub const fn path(self) -> &'static str {
38        self.path
39    }
40}
41
42/// Symbol search endpoint.
43pub const SEARCH_SYMBOL: Endpoint = Endpoint::new("search-symbol");
44/// Company profile endpoint.
45pub const PROFILE: Endpoint = Endpoint::new("profile");
46/// Key executives endpoint.
47pub const KEY_EXECUTIVES: Endpoint = Endpoint::new("key-executives");
48/// Quote endpoint.
49pub const QUOTE: Endpoint = Endpoint::new("quote");
50/// Batch quote endpoint (multiple symbols as comma-separated `?symbols=`).
51pub const BATCH_QUOTE: Endpoint = Endpoint::new("batch-quote");
52/// Historical end-of-day price endpoint.
53pub const HISTORICAL_PRICE_EOD_FULL: Endpoint = Endpoint::new("historical-price-eod/full");
54/// Cryptocurrency list endpoint.
55pub const CRYPTOCURRENCY_LIST: Endpoint = Endpoint::new("cryptocurrency-list");
56/// Stock peers endpoint.
57pub const STOCK_PEERS: Endpoint = Endpoint::new("stock-peers");
58/// Stock list endpoint.
59pub const STOCK_LIST: Endpoint = Endpoint::new("stock-list");
60/// ETF holdings endpoint.
61pub const ETF_HOLDINGS: Endpoint = Endpoint::new("etf/holdings");
62/// Historical dividends endpoint.
63pub const DIVIDENDS: Endpoint = Endpoint::new("dividends");
64/// Historical stock splits endpoint.
65pub const SPLITS: Endpoint = Endpoint::new("splits");
66/// SEC filings search by symbol endpoint.
67pub const SEC_FILINGS_SEARCH_SYMBOL: Endpoint = Endpoint::new("sec-filings-search/symbol");
68/// Earnings calendar endpoint.
69pub const EARNINGS_CALENDAR: Endpoint = Endpoint::new("earnings-calendar");
70/// Treasury rates endpoint.
71pub const TREASURY_RATES: Endpoint = Endpoint::new("treasury-rates");
72/// Simple moving average technical indicator endpoint.
73pub const TECHNICAL_SMA: Endpoint = Endpoint::new("technical-indicators/sma");
74/// Stock price change endpoint.
75pub const STOCK_PRICE_CHANGE: Endpoint = Endpoint::new("stock-price-change");
76/// Shares float endpoint.
77pub const SHARES_FLOAT: Endpoint = Endpoint::new("shares-float");
78/// Financial report dates endpoint.
79pub const FINANCIAL_REPORTS_DATES: Endpoint = Endpoint::new("financial-reports-dates");
80/// Annual report form JSON endpoint.
81pub const FINANCIAL_REPORTS_JSON: Endpoint = Endpoint::new("financial-reports-json");
82/// Annual income statement endpoint.
83pub const INCOME_STATEMENT: Endpoint = Endpoint::new("income-statement");
84/// Annual income statement as reported endpoint.
85pub const INCOME_STATEMENT_AS_REPORTED: Endpoint = Endpoint::new("income-statement-as-reported");
86/// Annual balance sheet endpoint.
87pub const BALANCE_SHEET_STATEMENT: Endpoint = Endpoint::new("balance-sheet-statement");
88/// Annual cash flow statement endpoint.
89pub const CASH_FLOW_STATEMENT: Endpoint = Endpoint::new("cash-flow-statement");
90/// Annual financial ratios endpoint.
91pub const RATIOS: Endpoint = Endpoint::new("ratios");
92/// Annual key metrics endpoint.
93pub const KEY_METRICS: Endpoint = Endpoint::new("key-metrics");
94/// Annual income statement growth endpoint.
95pub const INCOME_STATEMENT_GROWTH: Endpoint = Endpoint::new("income-statement-growth");
96/// Annual balance sheet statement growth endpoint.
97pub const BALANCE_SHEET_STATEMENT_GROWTH: Endpoint =
98    Endpoint::new("balance-sheet-statement-growth");
99/// Annual cash flow statement growth endpoint.
100pub const CASH_FLOW_STATEMENT_GROWTH: Endpoint = Endpoint::new("cash-flow-statement-growth");
101/// Annual enterprise values endpoint.
102pub const ENTERPRISE_VALUES: Endpoint = Endpoint::new("enterprise-values");
103/// Financial scores endpoint.
104pub const FINANCIAL_SCORES: Endpoint = Endpoint::new("financial-scores");
105/// Annual analyst estimates endpoint.
106pub const ANALYST_ESTIMATES: Endpoint = Endpoint::new("analyst-estimates");
107/// Analyst grades endpoint.
108pub const GRADES: Endpoint = Endpoint::new("grades");
109/// Price target consensus endpoint.
110pub const PRICE_TARGET_CONSENSUS: Endpoint = Endpoint::new("price-target-consensus");
111/// Price target summary endpoint.
112pub const PRICE_TARGET_SUMMARY: Endpoint = Endpoint::new("price-target-summary");
113/// Analyst grades consensus endpoint.
114pub const GRADES_CONSENSUS: Endpoint = Endpoint::new("grades-consensus");
115/// Historical company rating endpoint.
116pub const RATINGS_HISTORICAL: Endpoint = Endpoint::new("ratings-historical");
117/// Latest insider trading endpoint.
118pub const INSIDER_TRADING_LATEST: Endpoint = Endpoint::new("insider-trading/latest");
119/// Insider trading search endpoint (by symbol).
120pub const INSIDER_TRADING_SEARCH: Endpoint = Endpoint::new("insider-trading/search");
121/// Economic indicators endpoint.
122pub const ECONOMIC_INDICATORS: Endpoint = Endpoint::new("economic-indicators");
123/// Stock news endpoint.
124pub const STOCK_NEWS: Endpoint = Endpoint::new("news/stock");
125/// General news endpoint.
126pub const GENERAL_NEWS: Endpoint = Endpoint::new("news/general-latest");
127/// FMP articles endpoint.
128pub const FMP_ARTICLES: Endpoint = Endpoint::new("fmp-articles");
129/// Forex news endpoint.
130pub const FOREX_NEWS: Endpoint = Endpoint::new("news/forex-latest");
131/// Crypto news endpoint.
132pub const CRYPTO_NEWS: Endpoint = Endpoint::new("news/crypto-latest");
133/// Analyst upgrades and downgrades endpoint.
134pub const UPGRADES_DOWNGRADES: Endpoint = Endpoint::new("upgrades-downgrades");
135/// Ratings snapshot endpoint.
136pub const RATINGS_SNAPSHOT: Endpoint = Endpoint::new("ratings-snapshot");
137/// Earnings surprises endpoint.
138pub const EARNINGS_SURPRISES: Endpoint = Endpoint::new("earnings-surprises");
139/// Company outlook endpoint.
140pub const COMPANY_OUTLOOK: Endpoint = Endpoint::new("company-outlook");
141/// ETF list endpoint.
142pub const ETF_LIST: Endpoint = Endpoint::new("etf-list");
143/// Delisted companies endpoint.
144pub const DELISTED_COMPANIES: Endpoint = Endpoint::new("delisted-companies");
145/// Symbol-based earnings endpoint.
146pub const EARNINGS: Endpoint = Endpoint::new("earnings");
147/// Real-time quote endpoint.
148pub const REALTIME_QUOTE: Endpoint = Endpoint::new("quote");
149/// Price target endpoint.
150pub const PRICE_TARGET: Endpoint = Endpoint::new("price-target");
151/// Consolidated financial statement growth endpoint.
152pub const FINANCIAL_STATEMENT_GROWTH: Endpoint = Endpoint::new("financial-growth");
153/// ETF info endpoint.
154pub const ETF_INFO: Endpoint = Endpoint::new("etf/info");
155/// Market risk premium endpoint.
156pub const MARKET_RISK_PREMIUM: Endpoint = Endpoint::new("market-risk-premium");
157/// Market hours endpoint.
158pub const MARKET_HOURS: Endpoint = Endpoint::new("all-exchange-market-hours");
159/// Aftermarket quote endpoint.
160pub const AFTERMARKET_QUOTE: Endpoint = Endpoint::new("aftermarket-quote");
161/// Aftermarket trade endpoint.
162pub const AFTERMARKET_TRADE: Endpoint = Endpoint::new("aftermarket-trade");