polygon_client/
types.rs

1//! Data types associated with the REST interfaces.
2use serde;
3use serde::Deserialize;
4
5use std::collections::HashMap;
6use std::fmt;
7
8//
9// v3/reference/tickers
10//
11
12#[derive(Clone, Deserialize, Debug)]
13pub struct ReferenceTickersResponseTickerV3 {
14    pub ticker: String,
15    pub name: String,
16    pub market: String,
17    pub locale: String,
18    pub primary_exchange: String,
19    #[serde(rename = "type")]
20    pub ticker_type: Option<String>,
21    pub active: bool,
22    pub currency_name: String,
23    pub cik: Option<String>,
24    pub composite_figi: Option<String>,
25    pub share_class_figi: Option<String>,
26    pub last_updated_utc: String,
27}
28
29#[derive(Clone, Deserialize, Debug)]
30pub struct ReferenceTickersResponseV3 {
31    pub results: Vec<ReferenceTickersResponseTickerV3>,
32    pub status: String,
33    pub request_id: String,
34    pub count: u32,
35    pub next_url: Option<String>,
36}
37
38pub type ReferenceTickersResponse = ReferenceTickersResponseV3;
39
40//
41// v2/reference/types
42//
43
44#[derive(Clone, Deserialize, Debug)]
45pub struct ReferenceTickerTypesResultsV2 {
46    pub types: HashMap<String, String>,
47    #[serde(rename = "indexTypes")]
48    pub index_types: HashMap<String, String>,
49}
50
51#[derive(Clone, Deserialize, Debug)]
52pub struct ReferenceTickerTypesResponseV2 {
53    pub status: String,
54    pub results: ReferenceTickerTypesResultsV2,
55}
56
57pub type ReferenceTickerTypesResponse = ReferenceTickerTypesResponseV2;
58
59//
60// v1/meta/symbols/{stocksTicker}/company
61//
62
63#[derive(Clone, Deserialize, Debug)]
64pub struct ReferenceTickerDetailsResponseV1 {
65    pub logo: String,
66    pub exchange: String,
67    #[serde(rename = "exchangeSymbol")]
68    pub exchange_symbol: String,
69    #[serde(rename = "type")]
70    pub ticker_type: String,
71    pub name: String,
72    pub symbol: String,
73    pub listdate: String,
74    pub cik: String,
75    pub bloomberg: String,
76    pub fiji: Option<String>,
77    pub sic: u32,
78    pub country: String,
79    pub industry: String,
80    pub sector: String,
81    pub marketcap: u64,
82    pub employees: u64,
83    pub phone: String,
84    pub ceo: String,
85    pub url: String,
86    pub description: String,
87    pub hq_address: String,
88    pub hq_country: String,
89    pub similar: Vec<String>,
90    pub tags: Vec<String>,
91    pub updated: String,
92    pub active: bool,
93}
94
95pub type ReferenceTickerDetailsResponse = ReferenceTickerDetailsResponseV1;
96
97//
98// vX/reference/tickers/{ticker}
99//
100
101#[derive(Clone, Deserialize, Debug)]
102pub struct Address {
103    pub address1: String,
104    pub city: String,
105    pub state: String,
106}
107
108#[derive(Clone, Deserialize, Debug)]
109pub struct ReferenceTickerDetailsResultsVX {
110    pub ticker: String,
111    pub name: String,
112    pub market: String,
113    pub locale: String,
114    pub primary_exchange: String,
115    #[serde(rename = "type")]
116    pub ticker_type: String,
117    pub active: bool,
118    pub currency_name: String,
119    pub cik: String,
120    pub composite_fiji: Option<String>,
121    pub share_class_fiji: Option<String>,
122    pub last_updated_utc: String,
123    pub delisted_utc: Option<String>,
124    pub outstanding_shares: f64,
125    pub market_cap: f64,
126    pub phone_number: String,
127    pub address: Address,
128}
129
130#[derive(Clone, Deserialize, Debug)]
131pub struct ReferenceTickerDetailsResponseVX {
132    pub results: ReferenceTickerDetailsResultsVX,
133    pub status: String,
134    pub request_id: String,
135    pub count: u32,
136}
137
138//
139// v2/reference/news
140//
141
142#[derive(Clone, Deserialize, Debug)]
143pub struct Publisher {
144    pub name: String,
145    pub homepage_url: String,
146    pub logo_url: String,
147    pub favicon_url: String,
148}
149
150#[derive(Clone, Deserialize, Debug)]
151pub struct ReferenceTickerNewsResultsV2 {
152    pub id: String,
153    pub publisher: Publisher,
154    pub title: String,
155    pub author: String,
156    pub published_utc: String,
157    pub article_url: String,
158    pub tickers: Option<Vec<String>>,
159    pub amp_url: Option<String>,
160    pub image_url: Option<String>,
161    pub description: Option<String>,
162    pub keywords: Option<Vec<String>>,
163}
164
165#[derive(Clone, Deserialize, Debug)]
166pub struct ReferenceTickerNewsResponseV2 {
167    pub results: Vec<ReferenceTickerNewsResultsV2>,
168    pub status: String,
169    pub request_id: String,
170    pub count: u32,
171    pub next_url: Option<String>,
172}
173
174pub type ReferenceTickerNewsResponse = ReferenceTickerNewsResponseV2;
175
176//
177// v2/reference/markets
178//
179
180#[derive(Clone, Deserialize, Debug)]
181pub struct Market {
182    pub market: String,
183    pub desc: String,
184}
185
186#[derive(Clone, Deserialize, Debug)]
187pub struct ReferenceMarketsResponseV2 {
188    pub status: String,
189    pub results: Vec<Market>,
190}
191
192pub type ReferenceMarketsResponse = ReferenceMarketsResponseV2;
193
194//
195// v2/reference/locales
196//
197
198#[derive(Clone, Deserialize, Debug)]
199pub struct Locale {
200    pub locale: String,
201    pub name: String,
202}
203
204#[derive(Clone, Deserialize, Debug)]
205pub struct ReferenceLocalesResponseV2 {
206    pub status: String,
207    pub results: Vec<Locale>,
208}
209
210pub type ReferenceLocalesResponse = ReferenceLocalesResponseV2;
211
212//
213// v2/reference/splits/{stockTicker}
214//
215
216#[derive(Clone, Deserialize, Debug)]
217pub struct ReferenceStockSplitsResultV2 {
218    pub ticker: String,
219    #[serde(rename = "exDate")]
220    pub ex_date: String,
221    #[serde(rename = "paymentDate")]
222    pub payment_date: String,
223    #[serde(rename = "declaredDate")]
224    pub declared_date: Option<String>,
225    pub ratio: f64,
226    pub tofactor: Option<u32>,
227    pub forfactor: Option<u32>,
228}
229
230#[derive(Clone, Deserialize, Debug)]
231pub struct ReferenceStockSplitsResponseV2 {
232    pub status: String,
233    pub count: u32,
234    pub results: Vec<ReferenceStockSplitsResultV2>,
235}
236
237pub type ReferenceStockSplitsResponse = ReferenceStockSplitsResponseV2;
238
239//
240// v2/reference/dividends/{stocksTicker}
241//
242
243#[derive(Clone, Deserialize, Debug)]
244pub struct ReferenceStockDividendsResultV2 {
245    pub ticker: String,
246    #[serde(rename = "exDate")]
247    pub ex_date: String,
248    #[serde(rename = "paymentDate")]
249    pub payment_date: String,
250    #[serde(rename = "recordDate")]
251    pub record_date: String,
252    pub amount: f64,
253}
254
255#[derive(Clone, Deserialize, Debug)]
256pub struct ReferenceStockDividendsResponseV2 {
257    pub status: String,
258    pub count: u32,
259    pub results: Vec<ReferenceStockDividendsResultV2>,
260}
261
262pub type ReferenceStockDividendsResponse = ReferenceStockDividendsResponseV2;
263
264//
265// v2/reference/financials/{stocksTicker}
266//
267
268#[derive(Clone, Deserialize, Debug)]
269pub struct ReferenceStockFinancialsResultV2 {
270    pub ticker: String,
271    pub period: String,
272    #[serde(rename = "calendarDate")]
273    pub calendar_date: String,
274    #[serde(rename = "reportPeriod")]
275    pub report_period: String,
276    pub updated: String,
277    #[serde(rename = "accumulatedOtherComprehensiveIncome")]
278    pub accumulated_other_comprehensive_income: Option<i64>,
279    pub assets: Option<i64>,
280    #[serde(rename = "assetsAverage")]
281    pub assets_average: Option<i64>,
282    #[serde(rename = "assetsCurrent")]
283    pub assets_current: Option<i64>,
284    #[serde(rename = "assetTurnover")]
285    pub asset_turnover: Option<f64>,
286    #[serde(rename = "assetsNonCurrent")]
287    pub assets_non_current: Option<i64>,
288    #[serde(rename = "bookValuePerShare")]
289    pub book_value_per_share: Option<f64>,
290    #[serde(rename = "capitalExpenditure")]
291    pub capital_expenditure: Option<i64>,
292    #[serde(rename = "cashAndEquivalents")]
293    pub cash_and_equivalents: Option<i64>,
294    #[serde(rename = "cashAndEquivalentsUSD")]
295    pub cash_and_equivalents_usd: Option<i64>,
296    #[serde(rename = "costOfRevenue")]
297    pub cost_of_revenue: Option<i64>,
298    #[serde(rename = "consolidatedIncome")]
299    pub consolidated_income: Option<i64>,
300    #[serde(rename = "currentRatio")]
301    pub current_ratio: Option<f64>,
302    #[serde(rename = "debtToEquityRatio")]
303    pub debt_to_equity_ratio: Option<f64>,
304    pub debt: Option<u64>,
305    #[serde(rename = "debtCurrent")]
306    pub debt_current: Option<u64>,
307    #[serde(rename = "debtNonCurrent")]
308    pub debt_non_current: Option<u64>,
309    #[serde(rename = "debtUSD")]
310    pub debt_usd: Option<u64>,
311    #[serde(rename = "deferredRevenue")]
312    pub deferred_revenue: Option<u64>,
313    #[serde(rename = "depreciationAmortizationAndAccretion")]
314    pub depreciation_amortization_and_accretion: Option<i64>,
315    pub deposits: Option<u64>,
316    #[serde(rename = "dividendYield")]
317    pub dividend_yield: Option<f64>,
318    #[serde(rename = "dividendsPerBasicCommonShare")]
319    pub dividends_per_basic_common_share: Option<f64>,
320    #[serde(rename = "earningBeforeInterestTaxes")]
321    pub earning_before_interest_taxes: Option<i64>,
322    #[serde(rename = "earningBeforeInterestTaxesUSD")]
323    pub earning_before_interest_taxes_usd: Option<i64>,
324    #[serde(rename = "earningsBeforeInterestTaxesDepreciationAmortization")]
325    pub earnings_before_interest_taxes_drepreciation_amortization: Option<i64>,
326    #[serde(rename = "earningsBeforeInterestTaxesDepreciationAmortizationUSD")]
327    pub earnings_before_interest_taxes_drepreciation_amortization_usd: Option<i64>,
328    #[serde(rename = "earningsBeforeTax")]
329    pub earnings_before_tax: Option<i64>,
330    #[serde(rename = "earningsPerBasicShare")]
331    pub earnings_per_basic_share: Option<f64>,
332    #[serde(rename = "earningsPerBasicShareUSD")]
333    pub earnings_per_basic_share_usd: Option<f64>,
334    #[serde(rename = "earningsPerDilutedShare")]
335    pub earnings_per_diluted_share: Option<f64>,
336    #[serde(rename = "EBITDAMargin")]
337    pub ebitda_margin: Option<f64>,
338    #[serde(rename = "shareholdersEquity")]
339    pub shareholders_equity: Option<i64>,
340    #[serde(rename = "shareholdersEquityUSD")]
341    pub shareholders_equity_usd: Option<i64>,
342    #[serde(rename = "enterpriseValue")]
343    pub enterprise_value: Option<i64>,
344    #[serde(rename = "enterpriseValueOverEBIT")]
345    pub enterprise_value_over_ebit: Option<i64>,
346    #[serde(rename = "enterpriseValueOverEBITDA")]
347    pub enterprise_value_over_ebitda: Option<f64>,
348    #[serde(rename = "freeCashFlow")]
349    pub free_cash_flow: Option<i64>,
350    #[serde(rename = "freeCashFlowPerShare")]
351    pub free_cash_flow_per_share: Option<f64>,
352    #[serde(rename = "foreignCurrencyUSDExchangeRate")]
353    pub foreign_currency_usd_exchange_rate: Option<f64>,
354    #[serde(rename = "grossProfit")]
355    pub gross_profit: Option<i64>,
356    #[serde(rename = "grossMargin")]
357    pub gross_margin: Option<f64>,
358    #[serde(rename = "goodwillAndIntangibleAssets")]
359    pub goodwill_and_intangible_assets: Option<i64>,
360    #[serde(rename = "interestExpense")]
361    pub interest_expense: Option<i64>,
362    #[serde(rename = "investedCapital")]
363    pub invested_capital: Option<i64>,
364    pub inventory: Option<i64>,
365    pub investments: Option<i64>,
366    #[serde(rename = "investmentsCurrent")]
367    pub investments_current: Option<i64>,
368    #[serde(rename = "investmentsNonCurrent")]
369    pub investments_non_current: Option<i64>,
370    #[serde(rename = "totalLiabilities")]
371    pub total_liabilities: Option<i64>,
372    #[serde(rename = "currentLiabilities")]
373    pub current_liabilities: Option<i64>,
374    #[serde(rename = "liabilitiesNonCurrent")]
375    pub liabilities_non_current: Option<i64>,
376    #[serde(rename = "marketCapitalization")]
377    pub market_capitalization: Option<i64>,
378    #[serde(rename = "netCashFlow")]
379    pub net_cash_flow: Option<i64>,
380    #[serde(rename = "netCashFlowBusinessAcquisitionsDisposals")]
381    pub net_cash_flow_business_acquisitions_disposals: Option<i64>,
382    #[serde(rename = "issuanceEquityShares")]
383    pub issuance_equity_shares: Option<i64>,
384    #[serde(rename = "issuanceDebtSecurities")]
385    pub issuance_debt_securities: Option<i64>,
386    #[serde(rename = "paymentDividendsOtherCashDistributions")]
387    pub payment_dividends_other_cash_distributions: Option<i64>,
388    #[serde(rename = "netCashFlowFromFinancing")]
389    pub net_cash_flow_from_financing: Option<i64>,
390    #[serde(rename = "netCashFlowFromInvesting")]
391    pub net_cash_flow_from_investing: Option<i64>,
392    #[serde(rename = "netCashFlowInvestmentAcquisitionsDisposals")]
393    pub net_cash_flow_investment_acquisitions_disposals: Option<i64>,
394    #[serde(rename = "netCashFlowFromOperations")]
395    pub net_cash_flow_from_operations: Option<i64>,
396    #[serde(rename = "effectOfExchangeRateChangesOnCash")]
397    pub effect_of_exchange_rate_changes_on_cash: Option<i64>,
398    #[serde(rename = "netIncome")]
399    pub net_income: Option<i64>,
400    #[serde(rename = "netIncomeCommonStock")]
401    pub net_income_common_stock: Option<i64>,
402    #[serde(rename = "netIncomeCommonStockUSD")]
403    pub net_income_common_stock_usd: Option<i64>,
404    #[serde(rename = "netLossIncomeFromDiscontinuedOperations")]
405    pub net_loss_income_from_discontinued_operations: Option<i64>,
406    #[serde(rename = "netIncomeToNonControllingInterests")]
407    pub net_income_to_non_controlling_interests: Option<i64>,
408    #[serde(rename = "profitMargin")]
409    pub profit_margin: Option<f64>,
410    #[serde(rename = "operatingExpenses")]
411    pub operating_expenses: Option<i64>,
412    #[serde(rename = "operatingIncome")]
413    pub operating_income: Option<i64>,
414    #[serde(rename = "tradeAndNonTradePayables")]
415    pub trade_and_non_trade_payables: Option<i64>,
416    #[serde(rename = "payoutRatio")]
417    pub payout_ratio: Option<f64>,
418    #[serde(rename = "priceToBookValue")]
419    pub price_to_book_value: Option<f64>,
420    #[serde(rename = "priceEarnings")]
421    pub price_earnings: Option<f64>,
422    #[serde(rename = "priceToEarningsRatio")]
423    pub price_to_earnings_ratio: Option<f64>,
424    #[serde(rename = "propertyPlantEquipmentNet")]
425    pub property_plant_equipement_net: Option<i64>,
426    #[serde(rename = "preferredDividendsIncomeStatementImpact")]
427    pub preferred_dividends_income_statement_impact: Option<i64>,
428    #[serde(rename = "sharePriceAdjustedClose")]
429    pub share_price_adjusted_close: Option<f64>,
430    #[serde(rename = "priceSales")]
431    pub price_sales: Option<f64>,
432    #[serde(rename = "priceToSalesRatio")]
433    pub price_to_sales_ratio: Option<f64>,
434    #[serde(rename = "tradeAndNonTradeReceivables")]
435    pub trade_and_non_trade_receivables: Option<i64>,
436    #[serde(rename = "accumulatedRetainedEarningsDeficit")]
437    pub accumulated_retained_earnings_deficit: Option<i64>,
438    pub revenues: Option<i64>,
439    #[serde(rename = "revenuesUSD")]
440    pub revenues_usd: Option<i64>,
441    #[serde(rename = "researchAndDevelopmentExpense")]
442    pub research_and_development_expense: Option<i64>,
443    #[serde(rename = "returnOnAverageAssets")]
444    pub return_on_average_assets: Option<f64>,
445    #[serde(rename = "returnOnAverageEquity")]
446    pub return_on_average_equity: Option<f64>,
447    #[serde(rename = "returnOnInvestedCapital")]
448    pub return_on_invested_capital: Option<f64>,
449    #[serde(rename = "returnOnSales")]
450    pub return_on_sales: Option<f64>,
451    #[serde(rename = "shareBasedCompensation")]
452    pub share_based_compensation: Option<i64>,
453    #[serde(rename = "sellingGeneralAndAdministrativeExpense")]
454    pub selling_general_and_administrative_expense: Option<i64>,
455    #[serde(rename = "shareFactor")]
456    pub share_factor: Option<f64>,
457    pub shares: Option<u64>,
458    #[serde(rename = "weightedAverageShares")]
459    pub weighted_average_shares: Option<i64>,
460    #[serde(rename = "weightedAverageSharesDiluted")]
461    pub weighted_average_shares_diluted: Option<i64>,
462    #[serde(rename = "salesPerShare")]
463    pub sales_per_share: Option<f64>,
464    #[serde(rename = "tangibleAssetValue")]
465    pub tangible_asset_value: Option<i64>,
466    #[serde(rename = "taxAssets")]
467    pub tax_assets: Option<i64>,
468    #[serde(rename = "incomeTaxExpense")]
469    pub income_tax_expense: Option<i64>,
470    #[serde(rename = "taxLiabilities")]
471    pub tax_liabilities: Option<i64>,
472    #[serde(rename = "tangibleAssetsBookValuePerShare")]
473    pub tangible_assets_book_value_per_share: Option<f64>,
474    #[serde(rename = "workingCapital")]
475    pub working_capital: Option<i64>,
476}
477
478#[derive(Clone, Deserialize, Debug)]
479pub struct ReferenceStockFinancialsResponseV2 {
480    pub status: String,
481    pub results: Vec<ReferenceStockFinancialsResultV2>,
482}
483
484pub type ReferenceStockFinancialsResponse = ReferenceStockFinancialsResponseV2;
485
486//
487// vX/reference/financials
488//
489
490pub const FAC_ASSETS: &str = "assets";
491pub const FAC_BALANCE_SHEET_DATE: &str = "balance_sheet_date";
492pub const FAC_BALANCE_SHEET_FORMAT: &str = "balance_sheet_format";
493pub const FAC_BENEFITS_COSTS_EXPENSES: &str = "benefits_costs_expenses";
494pub const FAC_CAPITALIZATION: &str = "capitalization";
495pub const FAC_COMMITMENTS_AND_CONTINGENCIES: &str = "commitments_and_contingencies";
496pub const FAC_COMPREHENSIVE_INCOME_LOSS: &str = "comprehensive_income_loss";
497pub const FAC_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST: &str =
498    "comprehensive_income_loss_attributable_to_noncontrolling_interest";
499pub const FAC_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_PARENT: &str =
500    "comprehensive_income_loss_attributable_to_parent";
501pub const FAC_COSTS_AND_EXPENSES: &str = "costs_and_expenses";
502pub const FAC_COST_OF_REVENUE: &str = "cost_of_revenue";
503pub const FAC_COST_OF_REVENUE_GOODS: &str = "cost_of_revenue_goods";
504pub const FAC_COST_OF_REVENUE_SERVICES: &str = "cost_of_revenue_services";
505pub const FAC_CURRENT_ASSETS: &str = "current_assets";
506pub const FAC_CURRENT_LIABILITIES: &str = "current_liabilities";
507pub const FAC_DOCUMENT_TYPE: &str = "document_type";
508pub const FAC_ENTITY_CENTRAL_INDEX_KEY: &str = "entity_central_index_key";
509pub const FAC_ENTITY_FILER_CATEGORY: &str = "entity_filer_category";
510pub const FAC_ENTITY_REGISTRANT_NAME: &str = "entity_registrant_name";
511pub const FAC_EQUITY: &str = "equity";
512pub const FAC_EQUITY_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST: &str =
513    "equity_attributable_to_noncontrolling_interest";
514pub const FAC_EQUITY_ATTRIBUTABLE_TO_PARENT: &str = "equity_attributable_to_parent";
515pub const FAC_EXCHANGE_GAINS_LOSSES: &str = "exchange_gains_losses";
516pub const FAC_EXTRAORDINARY_ITEMS_OF_INCOME_EXPENSE_NET_OF_TAX: &str =
517    "extraordinary_items_of_income_expense_net_of_tax";
518pub const FAC_FISCAL_PERIOD_FOCUS: &str = "fiscal_period_focus";
519pub const FAC_FISCAL_YEAR_END: &str = "fiscal_year_end";
520pub const FAC_FISCAL_YEAR_FOCUS: &str = "fiscal_year_focus";
521pub const FAC_FIXED_ASSETS: &str = "fixed_assets";
522pub const FAC_GAIN_LOSS_ON_DISPOSITION_STOCK_IN_SUBSIDIARY_OR_EQUITY_METHOD_INVESTEE: &str =
523    "gain_loss_on_disposition_stock_in_subsidiary_or_equity_method_investee";
524pub const FAC_GAIN_LOSS_ON_SALE_PREVIOUSLY_UNISSUED_STOCK_BY_SUBSIDIARY_OR_EQUITY_INVESTEE_NONOPERATING_INCOME: &str = "gain_loss_on_sale_previously_unissued_stock_by_subsidiary_or_equity_investee_nonoperating_income";
525pub const FAC_GAIN_LOSS_ON_SALE_PROPERTIES_NET_TAX: &str = "gain_loss_on_sale_properties_net_tax";
526pub const FAC_GROSS_PROFIT: &str = "gross_profit";
527pub const FAC_INCOME_LOSS_BEFORE_EQUITY_METHOD_INVESTMENTS: &str =
528    "income_loss_before_equity_method_investments";
529pub const FAC_INCOME_LOSS_FROM_CONTINUING_OPERATIONS_AFTER_TAX: &str =
530    "income_loss_from_continuing_operations_after_tax";
531pub const FAC_INCOME_LOSS_FROM_CONTINUING_OPERATIONS_BEFORE_TAX: &str =
532    "income_loss_from_continuing_operations_before_tax";
533pub const FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX: &str =
534    "income_loss_from_discontinued_operations_net_of_tax";
535pub const FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_ADJUSTMENT_TO_PRIOR_YEAR_GAIN_LOSS_ON_DISPOSAL: &str = "income_loss_from_discontinued_operations_net_of_tax_adjustment_to_prior_year_gain_loss_on_disposal";
536pub const FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_DURING_PHASE_OUT: &str =
537    "income_loss_from_discontinued_operations_net_of_tax_during_phase_out";
538pub const FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_GAIN_LOSS_ON_DISPOSAL: &str =
539    "income_loss_from_discontinued_operations_net_of_tax_gain_loss_on_disposal";
540pub const FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_PROVISION_FOR_GAIN_LOSS_ON_DISPOSAL: &str = "income_loss_from_discontinued_operations_net_of_tax_provision_for_gain_loss_on_disposal";
541pub const FAC_INCOME_LOSS_FROM_EQUITY_METHOD_INVESTMENTS: &str =
542    "income_loss_from_equity_method_investments";
543pub const FAC_INCOME_STATEMENT_FORMAT: &str = "income_statement_format";
544pub const FAC_INCOME_STATEMENT_START_PERIOD_YEAR_TO_DATE: &str =
545    "income_statement_start_period_year_to_date";
546pub const FAC_INCOME_TAX_EXPENSE_BENEFIT: &str = "income_tax_expense_benefit";
547pub const FAC_INCOME_TAX_EXPENSE_BENEFIT_CURRENT: &str = "income_tax_expense_benefit_current";
548pub const FAC_INCOME_TAX_EXPENSE_BENEFIT_DEFERRED: &str = "income_tax_expense_benefit_deferred";
549pub const FAC_INDIRECT_OPERATING_NONOPERATING_COSTS_EXPENSES: &str =
550    "indirect_operating_nonoperating_costs_expenses";
551pub const FAC_INTEREST_AND_DEBT_EXPENSE: &str = "interest_and_debt_expense";
552pub const FAC_INTEREST_AND_DIVIDEND_INCOME_OPERATING: &str =
553    "interest_and_dividend_income_operating";
554pub const FAC_INTEREST_EXPENSE: &str = "interest_expense";
555pub const FAC_INTEREST_EXPENSE_OPERATING: &str = "interest_expense_operating";
556pub const FAC_INTEREST_INCOME_EXPENSE_AFTER_PROVISION_FOR_LOSSES: &str =
557    "interest_income_expense_after_provision_for_losses";
558pub const FAC_INTEREST_INCOME_EXPENSE_OPERATING_NET: &str = "interest_income_expense_operating_net";
559pub const FAC_LIABILITIES: &str = "liabilities";
560pub const FAC_LIABILITIES_AND_EQUITY: &str = "liabilities_and_equity";
561pub const FAC_LONG_TERM_DEBT: &str = "long_term_debt";
562pub const FAC_NET_CASH_FLOW: &str = "net_cash_flow";
563pub const FAC_NET_CASH_FLOW_CONTINUING: &str = "net_cash_flow_continuing";
564pub const FAC_NET_CASH_FLOW_DISCONTINUED: &str = "net_cash_flow_discontinued";
565pub const FAC_NET_CASH_FLOW_FROM_FINANCING_ACTIVITIES: &str =
566    "net_cash_flow_from_financing_activities";
567pub const FAC_NET_CASH_FLOW_FROM_FINANCING_ACTIVITIES_CONTINUING: &str =
568    "net_cash_flow_from_financing_activities_continuing";
569pub const FAC_NET_CASH_FLOW_FROM_FINANCING_ACTIVITIES_DISCONTINUED: &str =
570    "net_cash_flow_from_financing_activities_discontinued";
571pub const FAC_NET_CASH_FLOW_FROM_INVESTING_ACTIVITIES: &str =
572    "net_cash_flow_from_investing_activities";
573pub const FAC_NET_CASH_FLOW_FROM_INVESTING_ACTIVITIES_CONTINUING: &str =
574    "net_cash_flow_from_investing_activities_continuing";
575pub const FAC_NET_CASH_FLOW_FROM_INVESTING_ACTIVITIES_DISCONTINUED: &str =
576    "net_cash_flow_from_investing_activities_discontinued";
577pub const FAC_NET_CASH_FLOW_FROM_OPERATING_ACTIVITIES: &str =
578    "net_cash_flow_from_operating_activities";
579pub const FAC_NET_CASH_FLOW_FROM_OPERATING_ACTIVITIES_CONTINUING: &str =
580    "net_cash_flow_from_operating_activities_continuing";
581pub const FAC_NET_CASH_FLOW_FROM_OPERATING_ACTIVITIES_DISCONTINUED: &str =
582    "net_cash_flow_from_operating_activities_discontinued";
583pub const FAC_NET_INCOME_LOSS: &str = "net_income_loss";
584pub const FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST: &str =
585    "net_income_loss_attributable_to_noncontrolling_interest";
586pub const FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST_PLUS_PREFERRED_STOCK_DIVIDENDS_AND_OTHER_ADJUSTMENTS: &str = "net_income_loss_attributable_to_noncontrolling_interest_plus_preferred_stock_dividends_and_other_adjustments";
587pub const FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_NONREDEEMABLE_NONCONTROLLING_INTEREST: &str =
588    "net_income_loss_attributable_to_nonredeemable_noncontrolling_interest";
589pub const FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_PARENT: &str =
590    "net_income_loss_attributable_to_parent";
591pub const FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_REDEEMABLE_NONCONTROLLING_INTEREST: &str =
592    "net_income_loss_attributable_to_redeemable_noncontrolling_interest";
593pub const FAC_NET_INCOME_LOSS_AVAILABLE_TO_COMMON_STOCKHOLDERS_BASIC: &str =
594    "net_income_loss_available_to_common_stockholders_basic";
595pub const FAC_NONCURRENT_ASSETS: &str = "noncurrent_assets";
596pub const FAC_NONCURRENT_LIABILITIES: &str = "noncurrent_liabilities";
597pub const FAC_NONINTEREST_EXPENSE: &str = "noninterest_expense";
598pub const FAC_NONINTEREST_INCOME: &str = "noninterest_income";
599pub const FAC_NONOPERATING_GAINS_LOSSES: &str = "nonoperating_gains_losses";
600pub const FAC_NONOPERATING_INCOME_LOSS: &str = "nonoperating_income_loss";
601pub const FAC_NONOPERATING_INCOME_LOSS_PLUS_INTEREST_AND_DEBT_EXPENSE: &str =
602    "nonoperating_income_loss_plus_interest_and_debt_expense";
603pub const FAC_NONOPERATING_INCOME_PLUS_INTEREST_AND_DEBT_EXPENSE_PLUS_INCOME_FROM_EQUITY_METHOD_INVESTMENTS: &str = "nonoperating_income_plus_interest_and_debt_expense_plus_income_from_equity_method_investments";
604pub const FAC_OPERATING_AND_NONOPERATING_COSTS_AND_EXPENSES: &str =
605    "operating_and_nonoperating_costs_and_expenses";
606pub const FAC_OPERATING_AND_NONOPERATING_REVENUES: &str = "operating_and_nonoperating_revenues";
607pub const FAC_OPERATING_EXPENSES: &str = "operating_expenses";
608pub const FAC_OPERATING_INCOME_LOSS: &str = "operating_income_loss";
609pub const FAC_OTHER_COMPREHENSIVE_INCOME_LOSS: &str = "other_comprehensive_income_loss";
610pub const FAC_OTHER_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST: &str =
611    "other_comprehensive_income_loss_attributable_to_noncontrolling_interest";
612pub const FAC_OTHER_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_PARENT: &str =
613    "other_comprehensive_income_loss_attributable_to_parent";
614pub const FAC_OTHER_NONCURRENT_ASSETS_OF_REGULATED_ENTITY: &str =
615    "other_noncurrent_assets_of_regulated_entity";
616pub const FAC_OTHER_NONCURRENT_LIABILITIES_OF_REGULATED_ENTITY: &str =
617    "other_noncurrent_liabilities_of_regulated_entity";
618pub const FAC_OTHER_OPERATING_INCOME_EXPENSES: &str = "other_operating_income_expenses";
619pub const FAC_OTHER_THAN_FIXED_NONCURRENT_ASSETS: &str = "other_than_fixed_noncurrent_assets";
620pub const FAC_PARTICIPATING_SECURITIES_DISTRIBUTED_AND_UNDISTRIBUTED_EARNINGS_LOSS_BASIC: &str =
621    "participating_securities_distributed_and_undistributed_earnings_loss_basic";
622pub const FAC_PREFERRED_STOCK_DIVIDENDS_AND_OTHER_ADJUSTMENTS: &str =
623    "preferred_stock_dividends_and_other_adjustments";
624pub const FAC_PROVISION_FOR_LOAN_LEASE_AND_OTHER_LOSSES: &str =
625    "provision_for_loan_lease_and_other_losses";
626pub const FAC_PUBLIC_UTILITIES_PROPERTY_PLANT_AND_EQUIPMENT_NET: &str =
627    "public_utilities_property_plant_and_equipment_net";
628pub const FAC_REDEEMABLE_NONCONTROLLING_INTEREST: &str = "redeemable_noncontrolling_interest";
629pub const FAC_REDEEMABLE_NONCONTROLLING_INTEREST_COMMON: &str =
630    "redeemable_noncontrolling_interest_common";
631pub const FAC_REDEEMABLE_NONCONTROLLING_INTEREST_OTHER: &str =
632    "redeemable_noncontrolling_interest_other";
633pub const FAC_REDEEMABLE_NONCONTROLLING_INTEREST_PREFERRED: &str =
634    "redeemable_noncontrolling_interest_preferred";
635pub const FAC_RETURN_ON_ASSETS: &str = "return_on_assets";
636pub const FAC_RETURN_ON_EQUITY: &str = "return_on_equity";
637pub const FAC_RETURN_ON_SALES: &str = "return_on_sales";
638pub const FAC_REVENUES: &str = "revenues";
639pub const FAC_REVENUES_EXCLUDING_INTEREST_DIVIDENDS: &str = "revenues_excluding_interest_dividends";
640pub const FAC_REVENUES_NET_INTEREST_EXPENSE: &str = "revenues_net_interest_expense";
641pub const FAC_TEMPORARY_EQUITY: &str = "temporary_equity";
642pub const FAC_TEMPORARY_EQUITY_ATTRIBUTABLE_TO_PARENT: &str =
643    "temporary_equity_attributable_to_parent";
644pub const FAC_TRADING_SYMBOL: &str = "trading_symbol";
645pub const FAC_UNDISTRIBUTED_EARNINGS_LOSS_ALLOCATED_TO_PARTICIPATING_SECURITIES_BASIC: &str =
646    "undistributed_earnings_loss_allocated_to_participating_securities_basic";
647
648lazy_static! {
649    static ref FAC_LIST: Vec<&'static str> = {
650        let mut v = Vec::new();
651        v.push(FAC_ASSETS);
652        v.push(FAC_BALANCE_SHEET_DATE);
653        v.push(FAC_BALANCE_SHEET_FORMAT);
654        v.push(FAC_BENEFITS_COSTS_EXPENSES);
655        v.push(FAC_CAPITALIZATION);
656        v.push(FAC_COMMITMENTS_AND_CONTINGENCIES);
657        v.push(FAC_COMPREHENSIVE_INCOME_LOSS);
658        v.push(FAC_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST);
659        v.push(FAC_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_PARENT);
660        v.push(FAC_COSTS_AND_EXPENSES);
661        v.push(FAC_COST_OF_REVENUE);
662        v.push(FAC_COST_OF_REVENUE_GOODS);
663        v.push(FAC_COST_OF_REVENUE_SERVICES);
664        v.push(FAC_CURRENT_ASSETS);
665        v.push(FAC_CURRENT_LIABILITIES);
666        v.push(FAC_DOCUMENT_TYPE);
667        v.push(FAC_ENTITY_CENTRAL_INDEX_KEY);
668        v.push(FAC_ENTITY_FILER_CATEGORY);
669        v.push(FAC_ENTITY_REGISTRANT_NAME);
670        v.push(FAC_EQUITY);
671        v.push(FAC_EQUITY_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST);
672        v.push(FAC_EQUITY_ATTRIBUTABLE_TO_PARENT);
673        v.push(FAC_EXCHANGE_GAINS_LOSSES);
674        v.push(FAC_EXTRAORDINARY_ITEMS_OF_INCOME_EXPENSE_NET_OF_TAX);
675        v.push(FAC_FISCAL_PERIOD_FOCUS);
676        v.push(FAC_FISCAL_YEAR_END);
677        v.push(FAC_FISCAL_YEAR_FOCUS);
678        v.push(FAC_FIXED_ASSETS);
679        v.push(FAC_GAIN_LOSS_ON_DISPOSITION_STOCK_IN_SUBSIDIARY_OR_EQUITY_METHOD_INVESTEE);
680        v.push(FAC_GAIN_LOSS_ON_SALE_PREVIOUSLY_UNISSUED_STOCK_BY_SUBSIDIARY_OR_EQUITY_INVESTEE_NONOPERATING_INCOME);
681        v.push(FAC_GAIN_LOSS_ON_SALE_PROPERTIES_NET_TAX);
682        v.push(FAC_GROSS_PROFIT);
683        v.push(FAC_INCOME_LOSS_BEFORE_EQUITY_METHOD_INVESTMENTS);
684        v.push(FAC_INCOME_LOSS_FROM_CONTINUING_OPERATIONS_AFTER_TAX);
685        v.push(FAC_INCOME_LOSS_FROM_CONTINUING_OPERATIONS_BEFORE_TAX);
686        v.push(FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX);
687        v.push(FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_ADJUSTMENT_TO_PRIOR_YEAR_GAIN_LOSS_ON_DISPOSAL);
688        v.push(FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_DURING_PHASE_OUT);
689        v.push(FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_GAIN_LOSS_ON_DISPOSAL);
690        v.push(FAC_INCOME_LOSS_FROM_DISCONTINUED_OPERATIONS_NET_OF_TAX_PROVISION_FOR_GAIN_LOSS_ON_DISPOSAL);
691        v.push(FAC_INCOME_LOSS_FROM_EQUITY_METHOD_INVESTMENTS);
692        v.push(FAC_INCOME_STATEMENT_FORMAT);
693        v.push(FAC_INCOME_STATEMENT_START_PERIOD_YEAR_TO_DATE);
694        v.push(FAC_INCOME_TAX_EXPENSE_BENEFIT);
695        v.push(FAC_INCOME_TAX_EXPENSE_BENEFIT_CURRENT);
696        v.push(FAC_INCOME_TAX_EXPENSE_BENEFIT_DEFERRED);
697        v.push(FAC_INDIRECT_OPERATING_NONOPERATING_COSTS_EXPENSES);
698        v.push(FAC_INTEREST_AND_DEBT_EXPENSE);
699        v.push(FAC_INTEREST_AND_DIVIDEND_INCOME_OPERATING);
700        v.push(FAC_INTEREST_EXPENSE);
701        v.push(FAC_INTEREST_EXPENSE_OPERATING);
702        v.push(FAC_INTEREST_INCOME_EXPENSE_AFTER_PROVISION_FOR_LOSSES);
703        v.push(FAC_INTEREST_INCOME_EXPENSE_OPERATING_NET);
704        v.push(FAC_LIABILITIES);
705        v.push(FAC_LIABILITIES_AND_EQUITY);
706        v.push(FAC_LONG_TERM_DEBT);
707        v.push(FAC_NET_CASH_FLOW);
708        v.push(FAC_NET_CASH_FLOW_CONTINUING);
709        v.push(FAC_NET_CASH_FLOW_DISCONTINUED);
710        v.push(FAC_NET_CASH_FLOW_FROM_FINANCING_ACTIVITIES);
711        v.push(FAC_NET_CASH_FLOW_FROM_FINANCING_ACTIVITIES_CONTINUING);
712        v.push(FAC_NET_CASH_FLOW_FROM_FINANCING_ACTIVITIES_DISCONTINUED);
713        v.push(FAC_NET_CASH_FLOW_FROM_INVESTING_ACTIVITIES);
714        v.push(FAC_NET_CASH_FLOW_FROM_INVESTING_ACTIVITIES_CONTINUING);
715        v.push(FAC_NET_CASH_FLOW_FROM_INVESTING_ACTIVITIES_DISCONTINUED);
716        v.push(FAC_NET_CASH_FLOW_FROM_OPERATING_ACTIVITIES);
717        v.push(FAC_NET_CASH_FLOW_FROM_OPERATING_ACTIVITIES_CONTINUING);
718        v.push(FAC_NET_CASH_FLOW_FROM_OPERATING_ACTIVITIES_DISCONTINUED);
719        v.push(FAC_NET_INCOME_LOSS);
720        v.push(FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST);
721        v.push(FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST_PLUS_PREFERRED_STOCK_DIVIDENDS_AND_OTHER_ADJUSTMENTS);
722        v.push(FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_NONREDEEMABLE_NONCONTROLLING_INTEREST);
723        v.push(FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_PARENT);
724        v.push(FAC_NET_INCOME_LOSS_ATTRIBUTABLE_TO_REDEEMABLE_NONCONTROLLING_INTEREST);
725        v.push(FAC_NET_INCOME_LOSS_AVAILABLE_TO_COMMON_STOCKHOLDERS_BASIC);
726        v.push(FAC_NONCURRENT_ASSETS);
727        v.push(FAC_NONCURRENT_LIABILITIES);
728        v.push(FAC_NONINTEREST_EXPENSE);
729        v.push(FAC_NONINTEREST_INCOME);
730        v.push(FAC_NONOPERATING_GAINS_LOSSES);
731        v.push(FAC_NONOPERATING_INCOME_LOSS);
732        v.push(FAC_NONOPERATING_INCOME_LOSS_PLUS_INTEREST_AND_DEBT_EXPENSE);
733        v.push(FAC_NONOPERATING_INCOME_PLUS_INTEREST_AND_DEBT_EXPENSE_PLUS_INCOME_FROM_EQUITY_METHOD_INVESTMENTS);
734        v.push(FAC_OPERATING_AND_NONOPERATING_COSTS_AND_EXPENSES);
735        v.push(FAC_OPERATING_AND_NONOPERATING_REVENUES);
736        v.push(FAC_OPERATING_EXPENSES);
737        v.push(FAC_OPERATING_INCOME_LOSS);
738        v.push(FAC_OTHER_COMPREHENSIVE_INCOME_LOSS);
739        v.push(FAC_OTHER_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_NONCONTROLLING_INTEREST);
740        v.push(FAC_OTHER_COMPREHENSIVE_INCOME_LOSS_ATTRIBUTABLE_TO_PARENT);
741        v.push(FAC_OTHER_NONCURRENT_ASSETS_OF_REGULATED_ENTITY);
742        v.push(FAC_OTHER_NONCURRENT_LIABILITIES_OF_REGULATED_ENTITY);
743        v.push(FAC_OTHER_OPERATING_INCOME_EXPENSES);
744        v.push(FAC_OTHER_THAN_FIXED_NONCURRENT_ASSETS);
745        v.push(FAC_PARTICIPATING_SECURITIES_DISTRIBUTED_AND_UNDISTRIBUTED_EARNINGS_LOSS_BASIC);
746        v.push(FAC_PREFERRED_STOCK_DIVIDENDS_AND_OTHER_ADJUSTMENTS);
747        v.push(FAC_PROVISION_FOR_LOAN_LEASE_AND_OTHER_LOSSES);
748        v.push(FAC_PUBLIC_UTILITIES_PROPERTY_PLANT_AND_EQUIPMENT_NET);
749        v.push(FAC_REDEEMABLE_NONCONTROLLING_INTEREST);
750        v.push(FAC_REDEEMABLE_NONCONTROLLING_INTEREST_COMMON);
751        v.push(FAC_REDEEMABLE_NONCONTROLLING_INTEREST_OTHER);
752        v.push(FAC_REDEEMABLE_NONCONTROLLING_INTEREST_PREFERRED);
753        v.push(FAC_RETURN_ON_ASSETS);
754        v.push(FAC_RETURN_ON_EQUITY);
755        v.push(FAC_RETURN_ON_SALES);
756        v.push(FAC_REVENUES);
757        v.push(FAC_REVENUES_EXCLUDING_INTEREST_DIVIDENDS);
758        v.push(FAC_REVENUES_NET_INTEREST_EXPENSE);
759        v.push(FAC_TEMPORARY_EQUITY);
760        v.push(FAC_TEMPORARY_EQUITY_ATTRIBUTABLE_TO_PARENT);
761        v.push(FAC_TRADING_SYMBOL);
762        v.push(FAC_UNDISTRIBUTED_EARNINGS_LOSS_ALLOCATED_TO_PARTICIPATING_SECURITIES_BASIC);
763        v
764    };
765}
766
767#[derive(Clone, Deserialize, Debug)]
768pub struct FundamentalAccountingConcept {
769    pub formula: Option<String>,
770    pub label: Option<String>,
771    pub order: Option<u32>,
772    pub unit: Option<String>,
773    pub value: Option<f64>,
774}
775#[derive(Clone, Deserialize, Debug)]
776pub struct FinancialDimensions {
777    pub balance_sheet: HashMap<String, FundamentalAccountingConcept>,
778    pub cash_flow_statement: HashMap<String, FundamentalAccountingConcept>,
779    pub comprehensive_income: HashMap<String, FundamentalAccountingConcept>,
780    pub income_statement: HashMap<String, FundamentalAccountingConcept>,
781}
782
783#[derive(Clone, Deserialize, Debug)]
784pub struct ReferenceStockFinancialsVXResult {
785    pub cik: String,
786    pub company_name: String,
787    pub end_date: Option<String>,
788    pub financials: FinancialDimensions,
789    pub fiscal_period: String,
790    pub fiscal_year: String,
791    pub source_filing_file_url: String,
792    pub start_date: Option<String>,
793}
794
795#[derive(Clone, Deserialize, Debug)]
796pub struct ReferenceStockFinancialsVXResponse {
797    pub count: u32,
798    pub next_url: String,
799    pub request_id: String,
800    pub results: Vec<ReferenceStockFinancialsVXResult>,
801    pub status: String,
802}
803
804//
805// v1/marketstatus/upcoming
806//
807
808#[derive(Clone, Deserialize, Debug)]
809pub struct MarketStatusUpcoming {
810    pub exchange: String,
811    pub name: String,
812    pub date: String,
813    pub status: String,
814    pub open: Option<String>,
815    pub close: Option<String>,
816}
817
818pub type ReferenceMarketStatusUpcomingResponse = Vec<MarketStatusUpcoming>;
819
820//
821// v1/marketstatus/now
822//
823
824#[derive(Clone, Deserialize, Debug)]
825pub struct ReferenceMarketStatusNowResponseV1 {
826    pub market: String,
827    #[serde(rename = "earlyHours")]
828    pub early_hours: bool,
829    #[serde(rename = "afterHours")]
830    pub after_hours: bool,
831    #[serde(rename = "serverTime")]
832    pub server_time: String,
833    pub exchanges: HashMap<String, String>,
834    pub currencies: HashMap<String, String>,
835}
836
837pub type ReferenceMarketStatusNowResponse = ReferenceMarketStatusNowResponseV1;
838
839//
840// v1/meta/exchanges
841//
842
843#[derive(Clone, Deserialize, Debug)]
844pub struct StockEquitiesExchangeV1 {
845    pub id: u64,
846    #[serde(rename = "type")]
847    pub exchange_type: String,
848    pub market: String,
849    pub mic: Option<String>,
850    pub name: String,
851    pub tape: Option<String>,
852    pub code: Option<String>,
853}
854
855pub type StockEquitiesExchangesResponse = Vec<StockEquitiesExchangeV1>;
856
857//
858// v1/meta/conditions/{ticktype}
859//
860
861#[derive(Debug)]
862pub enum TickType {
863    Trades,
864    Quotes,
865}
866
867impl fmt::Display for TickType {
868    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
869        write!(f, "{:?}", self)
870    }
871}
872
873pub type StockEquitiesConditionMappingsResponse = HashMap<u32, String>;
874
875//
876// v1/meta/crypto-exchanges
877//
878
879#[derive(Clone, Deserialize, Debug)]
880pub struct CryptoExchange {
881    pub id: u32,
882    #[serde(rename = "type")]
883    pub exchange_type: Option<String>,
884    pub market: String,
885    pub name: String,
886    pub url: String,
887    pub locale: Option<String>,
888    pub tier: Option<String>,
889}
890
891pub type CryptoCryptoExchangesResponse = Vec<CryptoExchange>;
892
893//
894// v2/last/trade/{ticker}
895//
896
897#[allow(non_snake_case)]
898#[derive(Clone, Deserialize, Debug)]
899pub struct StockEquitiesHistoricTrade {
900    pub T: Option<String>,
901    pub f: Option<u64>,
902    pub q: Option<u64>,
903    pub t: Option<u64>,
904    pub y: Option<u64>,
905    pub c: Option<Vec<u64>>,
906    pub e: Option<u64>,
907    pub i: Option<String>,
908    pub p: Option<f64>,
909    pub r: Option<u64>,
910    pub s: Option<f64>,
911    pub x: Option<u64>,
912    pub z: Option<u64>,
913}
914
915#[derive(Clone, Deserialize, Debug)]
916pub struct StockEquitiesHistoricTradesV2Response {
917    pub request_id: String,
918    pub status: String,
919    pub results: StockEquitiesHistoricTrade,
920}
921
922pub type StockEquitiesHistoricTradesResponse = StockEquitiesHistoricTradesV2Response;
923
924//
925// v2/last/nbbo/{ticker}
926//
927
928#[derive(Clone, Deserialize, Debug)]
929pub struct StockEquitiesLastQuoteForASymbolV2Response {
930    pub request_id: String,
931    pub status: String,
932    pub results: StockEquitiesHistoricTrade,
933}
934
935pub type StockEquitiesLastQuoteForASymbolResponse = StockEquitiesLastQuoteForASymbolV2Response;
936
937//
938// v1/open-close/{ticker}/{date}
939//
940
941#[derive(Clone, Deserialize, Debug)]
942pub struct StockEquitiesDailyOpenCloseResponse {
943    #[serde(rename = "afterHours")]
944    pub after_hours: f64,
945    pub close: f64,
946    pub from: String,
947    pub high: f64,
948    pub low: f64,
949    pub open: f64,
950    #[serde(rename = "preMarket")]
951    pub pre_market: f64,
952    pub status: String,
953    pub symbol: String,
954    pub volume: f64,
955}
956
957//
958// v2/aggs/ticker/{ticker}/range/{multiplier}/{timespan}/{from}/{to}
959//
960
961#[allow(non_snake_case)]
962#[derive(Clone, Deserialize, Debug)]
963pub struct StockEquitiesAggregates {
964    pub T: Option<String>,
965    pub av: Option<u64>,
966    pub c: f64,
967    pub h: f64,
968    pub l: f64,
969    pub n: Option<f64>,
970    pub o: f64,
971    pub t: Option<u64>,
972    pub v: f64,
973    pub vw: Option<f64>,
974}
975
976#[derive(Clone, Deserialize, Debug)]
977pub struct StockEquitiesAggregatesResponse {
978    pub ticker: String,
979    pub adjusted: bool,
980    #[serde(rename = "queryCount")]
981    pub query_count: u32,
982    pub request_id: String,
983    #[serde(rename = "resultsCount")]
984    pub results_count: u32,
985    pub count: u32,
986    pub status: String,
987    pub results: Vec<StockEquitiesAggregates>,
988}
989
990//
991// v2/aggs/grouped/locale/{locale}/market/{market}/{date}
992//
993
994#[derive(Clone, Deserialize, Debug)]
995pub struct StockEquitiesGroupedDailyResponse {
996    pub adjusted: bool,
997    #[serde(rename = "queryCount")]
998    pub query_count: u32,
999    #[serde(rename = "resultsCount")]
1000    pub results_count: u32,
1001    pub status: String,
1002    pub results: Vec<StockEquitiesAggregates>,
1003}
1004
1005//
1006// v2/aggs/ticker/{ticker}/prev
1007//
1008
1009#[derive(Clone, Deserialize, Debug)]
1010pub struct StockEquitiesPreviousCloseResponse {
1011    pub ticker: String,
1012    pub adjusted: bool,
1013    #[serde(rename = "queryCount")]
1014    pub query_count: u32,
1015    #[serde(rename = "resultsCount")]
1016    pub results_count: u32,
1017    pub count: u32,
1018    pub status: String,
1019    pub results: Vec<StockEquitiesAggregates>,
1020}
1021
1022//
1023// v2/snapshot/locale/{locale}/markets/{market}/tickers
1024//
1025
1026#[allow(non_snake_case)]
1027#[derive(Clone, Deserialize, Debug)]
1028pub struct StockEquitiesQuote {
1029    pub P: f64,
1030    pub S: u64,
1031    pub p: f64,
1032    pub s: u64,
1033    pub t: u64,
1034}
1035
1036#[derive(Clone, Deserialize, Debug)]
1037pub struct StockEquitiesTickerSnapshot {
1038    pub day: StockEquitiesAggregates,
1039    #[serde(rename = "lastQuote")]
1040    pub last_quote: StockEquitiesQuote,
1041    #[serde(rename = "lastTrade")]
1042    pub last_trade: StockEquitiesHistoricTrade,
1043    pub min: StockEquitiesAggregates,
1044    #[serde(rename = "prevDay")]
1045    pub prev_day: StockEquitiesAggregates,
1046    pub ticker: String,
1047    #[serde(rename = "todaysChange")]
1048    pub todays_change: f64,
1049    #[serde(rename = "todaysChangePerc")]
1050    pub todays_change_perc: f64,
1051    pub updated: u64,
1052}
1053
1054#[derive(Clone, Deserialize, Debug)]
1055pub struct StockEquitiesSnapshotAllTickersResponse {
1056    pub count: u32,
1057    pub status: String,
1058    pub tickers: Vec<StockEquitiesTickerSnapshot>,
1059}
1060
1061//
1062// v2/snapshot/locale/us/markets/stocks/{direction}
1063//
1064
1065#[derive(Clone, Deserialize, Debug)]
1066pub struct StockEquitiesSnapshotGainersLosersResponse {
1067    pub status: String,
1068    pub tickers: Vec<StockEquitiesTickerSnapshot>,
1069}
1070
1071//
1072// v2/aggs/ticker/{ticker}/range/{multiplier}/{timespan}/{from}/{to}
1073//
1074
1075#[allow(non_snake_case)]
1076#[derive(Clone, Deserialize, Debug)]
1077pub struct ForexEquitiesAggregates {
1078    pub T: Option<String>,
1079    pub c: f64,
1080    pub h: f64,
1081    pub l: f64,
1082    pub n: Option<f64>,
1083    pub o: f64,
1084    pub t: Option<u64>,
1085    pub v: f64,
1086    pub vw: Option<f64>,
1087}
1088
1089#[derive(Clone, Deserialize, Debug)]
1090pub struct ForexCurrenciesAggregatesResponse {
1091    pub ticker: String,
1092    #[serde(rename = "queryCount")]
1093    pub query_count: u32,
1094    #[serde(rename = "resultsCount")]
1095    pub results_count: u32,
1096    pub results: Vec<ForexEquitiesAggregates>,
1097    pub status: String,
1098    pub request_id: String,
1099    pub count: u32,
1100}
1101
1102//
1103// v2/aggs/grouped/locale/global/market/fx/{date}
1104//
1105
1106#[derive(Clone, Deserialize, Debug)]
1107pub struct ForexCurrenciesGroupedDailyResponse {
1108    #[serde(rename = "queryCount")]
1109    pub query_count: u32,
1110    #[serde(rename = "resultsCount")]
1111    pub results_count: u32,
1112    pub adjusted: bool,
1113    pub results: Vec<ForexEquitiesAggregates>,
1114    pub status: String,
1115    pub request_id: String,
1116    pub count: u32,
1117}
1118
1119//
1120// v2/aggs/ticker/{forex_ticker}/prev
1121//
1122
1123#[derive(Clone, Deserialize, Debug)]
1124pub struct ForexCurrenciesPreviousCloseResponse {
1125    pub ticker: String,
1126    #[serde(rename = "queryCount")]
1127    pub query_count: u32,
1128    #[serde(rename = "resultsCount")]
1129    pub results_count: u32,
1130    pub adjusted: bool,
1131    pub results: Vec<ForexEquitiesAggregates>,
1132    pub status: String,
1133    pub request_id: String,
1134    pub count: u32,
1135}
1136
1137//
1138// v1/open-close/crypto/{from}/{to}/{date}
1139//
1140
1141#[derive(Clone, Deserialize, Debug)]
1142pub struct CryptoOpenTrades {
1143    pub x: u32,
1144    pub p: f64,
1145    pub s: f64,
1146    pub c: Vec<u32>,
1147    pub i: String,
1148    pub t: u64,
1149}
1150
1151#[derive(Clone, Deserialize, Debug)]
1152pub struct CryptoDailyOpenCloseResponse {
1153    pub symbol: String,
1154    #[serde(rename = "isUTC")]
1155    pub is_utc: bool,
1156    pub day: String,
1157    pub open: f64,
1158    pub close: f64,
1159    #[serde(rename = "openTrades")]
1160    pub open_trades: Vec<CryptoOpenTrades>,
1161}
1162
1163//
1164// v2/aggs/ticker/{cryptoTicker}/range/{multiplier}/{timespan}/{from}/{to}
1165//
1166
1167#[allow(non_snake_case)]
1168#[derive(Clone, Deserialize, Debug)]
1169pub struct CryptoAggregates {
1170    pub T: Option<String>,
1171    pub c: f64,
1172    pub h: f64,
1173    pub l: f64,
1174    pub n: Option<f64>,
1175    pub o: f64,
1176    pub t: Option<u64>,
1177    pub v: f64,
1178    pub vw: Option<f64>,
1179}
1180
1181#[derive(Clone, Deserialize, Debug)]
1182pub struct CryptoAggregatesResponse {
1183    pub ticker: String,
1184    #[serde(rename = "queryCount")]
1185    pub query_count: u32,
1186    #[serde(rename = "resultsCount")]
1187    pub results_count: u32,
1188    pub results: Vec<CryptoAggregates>,
1189    pub status: String,
1190    pub request_id: String,
1191    pub count: u32,
1192}
1193
1194//
1195// v2/aggs/grouped/locale/global/market/crypto/{date}
1196//
1197
1198#[derive(Clone, Deserialize, Debug)]
1199pub struct CryptoGroupedDailyResponse {
1200    #[serde(rename = "queryCount")]
1201    pub query_count: u32,
1202    #[serde(rename = "resultsCount")]
1203    pub results_count: u32,
1204    pub adjusted: bool,
1205    pub results: Vec<CryptoAggregates>,
1206    pub status: String,
1207    pub request_id: String,
1208    pub count: u32,
1209}
1210
1211//
1212// v2/aggs/ticker/{crypto_ticker}/prev
1213//
1214
1215#[derive(Clone, Deserialize, Debug)]
1216pub struct CryptoPreviousCloseResponse {
1217    pub ticker: String,
1218    #[serde(rename = "queryCount")]
1219    pub query_count: u32,
1220    #[serde(rename = "resultsCount")]
1221    pub results_count: u32,
1222    pub adjusted: bool,
1223    pub results: Vec<CryptoAggregates>,
1224    pub status: String,
1225    pub request_id: String,
1226    pub count: u32,
1227}