1use serde::{Deserialize, Serialize};
2
3pub mod screeners {
5 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
10 pub enum Screener {
11 AggressiveSmallCaps,
14 DayGainers,
16 DayLosers,
18 GrowthTechnologyStocks,
20 MostActives,
22 MostShortedStocks,
24 SmallCapGainers,
26 UndervaluedGrowthStocks,
28 UndervaluedLargeCaps,
30 ConservativeForeignFunds,
33 HighYieldBond,
35 PortfolioAnchors,
37 SolidLargeGrowthFunds,
39 SolidMidcapGrowthFunds,
41 TopMutualFunds,
43 }
44
45 impl Screener {
46 pub fn as_scr_id(&self) -> &'static str {
48 match self {
49 Screener::AggressiveSmallCaps => "aggressive_small_caps",
50 Screener::DayGainers => "day_gainers",
51 Screener::DayLosers => "day_losers",
52 Screener::GrowthTechnologyStocks => "growth_technology_stocks",
53 Screener::MostActives => "most_actives",
54 Screener::MostShortedStocks => "most_shorted_stocks",
55 Screener::SmallCapGainers => "small_cap_gainers",
56 Screener::UndervaluedGrowthStocks => "undervalued_growth_stocks",
57 Screener::UndervaluedLargeCaps => "undervalued_large_caps",
58 Screener::ConservativeForeignFunds => "conservative_foreign_funds",
59 Screener::HighYieldBond => "high_yield_bond",
60 Screener::PortfolioAnchors => "portfolio_anchors",
61 Screener::SolidLargeGrowthFunds => "solid_large_growth_funds",
62 Screener::SolidMidcapGrowthFunds => "solid_midcap_growth_funds",
63 Screener::TopMutualFunds => "top_mutual_funds",
64 }
65 }
66
67 pub fn parse(s: &str) -> Option<Self> {
77 s.parse().ok()
78 }
79
80 pub fn valid_types() -> &'static str {
82 "aggressive-small-caps, day-gainers, day-losers, growth-technology-stocks, \
83 most-actives, most-shorted-stocks, small-cap-gainers, undervalued-growth-stocks, \
84 undervalued-large-caps, conservative-foreign-funds, high-yield-bond, \
85 portfolio-anchors, solid-large-growth-funds, solid-midcap-growth-funds, \
86 top-mutual-funds"
87 }
88
89 pub fn all() -> &'static [Screener] {
91 &[
92 Screener::AggressiveSmallCaps,
93 Screener::DayGainers,
94 Screener::DayLosers,
95 Screener::GrowthTechnologyStocks,
96 Screener::MostActives,
97 Screener::MostShortedStocks,
98 Screener::SmallCapGainers,
99 Screener::UndervaluedGrowthStocks,
100 Screener::UndervaluedLargeCaps,
101 Screener::ConservativeForeignFunds,
102 Screener::HighYieldBond,
103 Screener::PortfolioAnchors,
104 Screener::SolidLargeGrowthFunds,
105 Screener::SolidMidcapGrowthFunds,
106 Screener::TopMutualFunds,
107 ]
108 }
109 }
110
111 impl std::str::FromStr for Screener {
112 type Err = ();
113
114 fn from_str(s: &str) -> Result<Self, Self::Err> {
115 match s.to_lowercase().replace('_', "-").as_str() {
116 "aggressive-small-caps" => Ok(Screener::AggressiveSmallCaps),
117 "day-gainers" | "gainers" => Ok(Screener::DayGainers),
118 "day-losers" | "losers" => Ok(Screener::DayLosers),
119 "growth-technology-stocks" | "growth-tech" => Ok(Screener::GrowthTechnologyStocks),
120 "most-actives" | "actives" => Ok(Screener::MostActives),
121 "most-shorted-stocks" | "most-shorted" => Ok(Screener::MostShortedStocks),
122 "small-cap-gainers" => Ok(Screener::SmallCapGainers),
123 "undervalued-growth-stocks" | "undervalued-growth" => {
124 Ok(Screener::UndervaluedGrowthStocks)
125 }
126 "undervalued-large-caps" | "undervalued-large" => {
127 Ok(Screener::UndervaluedLargeCaps)
128 }
129 "conservative-foreign-funds" => Ok(Screener::ConservativeForeignFunds),
130 "high-yield-bond" => Ok(Screener::HighYieldBond),
131 "portfolio-anchors" => Ok(Screener::PortfolioAnchors),
132 "solid-large-growth-funds" => Ok(Screener::SolidLargeGrowthFunds),
133 "solid-midcap-growth-funds" => Ok(Screener::SolidMidcapGrowthFunds),
134 "top-mutual-funds" => Ok(Screener::TopMutualFunds),
135 _ => Err(()),
136 }
137 }
138 }
139}
140
141pub mod sectors {
145 use serde::{Deserialize, Serialize};
146
147 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
149 #[serde(rename_all = "kebab-case")]
150 pub enum Sector {
151 Technology,
153 FinancialServices,
155 ConsumerCyclical,
157 CommunicationServices,
159 Healthcare,
161 Industrials,
163 ConsumerDefensive,
165 Energy,
167 BasicMaterials,
169 RealEstate,
171 Utilities,
173 }
174
175 impl Sector {
176 pub fn as_api_path(&self) -> &'static str {
178 match self {
179 Sector::Technology => "technology",
180 Sector::FinancialServices => "financial-services",
181 Sector::ConsumerCyclical => "consumer-cyclical",
182 Sector::CommunicationServices => "communication-services",
183 Sector::Healthcare => "healthcare",
184 Sector::Industrials => "industrials",
185 Sector::ConsumerDefensive => "consumer-defensive",
186 Sector::Energy => "energy",
187 Sector::BasicMaterials => "basic-materials",
188 Sector::RealEstate => "real-estate",
189 Sector::Utilities => "utilities",
190 }
191 }
192
193 pub fn display_name(&self) -> &'static str {
195 match self {
196 Sector::Technology => "Technology",
197 Sector::FinancialServices => "Financial Services",
198 Sector::ConsumerCyclical => "Consumer Cyclical",
199 Sector::CommunicationServices => "Communication Services",
200 Sector::Healthcare => "Healthcare",
201 Sector::Industrials => "Industrials",
202 Sector::ConsumerDefensive => "Consumer Defensive",
203 Sector::Energy => "Energy",
204 Sector::BasicMaterials => "Basic Materials",
205 Sector::RealEstate => "Real Estate",
206 Sector::Utilities => "Utilities",
207 }
208 }
209
210 pub fn valid_types() -> &'static str {
212 "technology, financial-services, consumer-cyclical, communication-services, \
213 healthcare, industrials, consumer-defensive, energy, basic-materials, \
214 real-estate, utilities"
215 }
216
217 pub fn all() -> &'static [Sector] {
219 &[
220 Sector::Technology,
221 Sector::FinancialServices,
222 Sector::ConsumerCyclical,
223 Sector::CommunicationServices,
224 Sector::Healthcare,
225 Sector::Industrials,
226 Sector::ConsumerDefensive,
227 Sector::Energy,
228 Sector::BasicMaterials,
229 Sector::RealEstate,
230 Sector::Utilities,
231 ]
232 }
233 }
234
235 impl std::str::FromStr for Sector {
236 type Err = ();
237
238 fn from_str(s: &str) -> Result<Self, Self::Err> {
239 match s.to_lowercase().replace('_', "-").as_str() {
240 "technology" | "tech" => Ok(Sector::Technology),
241 "financial-services" | "financials" | "financial" => Ok(Sector::FinancialServices),
242 "consumer-cyclical" => Ok(Sector::ConsumerCyclical),
243 "communication-services" | "communication" => Ok(Sector::CommunicationServices),
244 "healthcare" | "health" => Ok(Sector::Healthcare),
245 "industrials" | "industrial" => Ok(Sector::Industrials),
246 "consumer-defensive" => Ok(Sector::ConsumerDefensive),
247 "energy" => Ok(Sector::Energy),
248 "basic-materials" | "materials" => Ok(Sector::BasicMaterials),
249 "real-estate" | "realestate" => Ok(Sector::RealEstate),
250 "utilities" | "utility" => Ok(Sector::Utilities),
251 _ => Err(()),
252 }
253 }
254 }
255
256 impl std::fmt::Display for Sector {
257 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
258 write!(f, "{}", self.display_name())
259 }
260 }
261
262 impl From<Sector> for String {
263 fn from(v: Sector) -> Self {
265 v.display_name().to_string()
266 }
267 }
268}
269
270pub mod indices {
272 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
274 pub enum Region {
275 Americas,
277 Europe,
279 AsiaPacific,
281 MiddleEastAfrica,
283 Currencies,
285 }
286
287 impl std::str::FromStr for Region {
288 type Err = ();
289
290 fn from_str(s: &str) -> Result<Self, Self::Err> {
291 match s.to_lowercase().replace(['-', '_'], "").as_str() {
292 "americas" | "america" => Ok(Region::Americas),
293 "europe" | "eu" => Ok(Region::Europe),
294 "asiapacific" | "asia" | "apac" => Ok(Region::AsiaPacific),
295 "middleeastafrica" | "mea" | "emea" => Ok(Region::MiddleEastAfrica),
296 "currencies" | "currency" | "fx" => Ok(Region::Currencies),
297 _ => Err(()),
298 }
299 }
300 }
301
302 impl Region {
303 pub fn parse(s: &str) -> Option<Self> {
305 s.parse().ok()
306 }
307
308 pub fn symbols(&self) -> &'static [&'static str] {
310 match self {
311 Region::Americas => AMERICAS,
312 Region::Europe => EUROPE,
313 Region::AsiaPacific => ASIA_PACIFIC,
314 Region::MiddleEastAfrica => MIDDLE_EAST_AFRICA,
315 Region::Currencies => CURRENCIES,
316 }
317 }
318
319 pub fn as_str(&self) -> &'static str {
321 match self {
322 Region::Americas => "americas",
323 Region::Europe => "europe",
324 Region::AsiaPacific => "asia-pacific",
325 Region::MiddleEastAfrica => "middle-east-africa",
326 Region::Currencies => "currencies",
327 }
328 }
329
330 pub fn all() -> &'static [Region] {
332 &[
333 Region::Americas,
334 Region::Europe,
335 Region::AsiaPacific,
336 Region::MiddleEastAfrica,
337 Region::Currencies,
338 ]
339 }
340 }
341
342 pub const AMERICAS: &[&str] = &[
344 "^GSPC", "^DJI", "^IXIC", "^NYA", "^XAX", "^RUT", "^VIX", "^GSPTSE", "^BVSP", "^MXX", "^IPSA", "^MERV", ];
357
358 pub const EUROPE: &[&str] = &[
360 "^FTSE", "^GDAXI", "^FCHI", "^STOXX50E", "^N100", "^BFX", "^BUK100P", "MOEX.ME", "^125904-USD-STRD", ];
370
371 pub const ASIA_PACIFIC: &[&str] = &[
373 "^N225", "^HSI", "000001.SS", "^KS11", "^TWII", "^STI", "^AXJO", "^AORD", "^NZ50", "^BSESN", "^JKSE", "^KLSE", ];
386
387 pub const MIDDLE_EAST_AFRICA: &[&str] = &[
389 "^TA125.TA", "^CASE30", "^JN0U.JO", ];
393
394 pub const CURRENCIES: &[&str] = &[
396 "DX-Y.NYB", "^XDB", "^XDE", "^XDN", "^XDA", ];
402
403 pub fn all_symbols() -> Vec<&'static str> {
405 Region::all()
406 .iter()
407 .flat_map(|r| r.symbols().iter().copied())
408 .collect()
409 }
410}
411
412#[allow(missing_docs)]
417pub mod fundamental_types {
418 pub const TOTAL_REVENUE: &str = "TotalRevenue";
422 pub const OPERATING_REVENUE: &str = "OperatingRevenue";
423 pub const COST_OF_REVENUE: &str = "CostOfRevenue";
424 pub const GROSS_PROFIT: &str = "GrossProfit";
425 pub const OPERATING_EXPENSE: &str = "OperatingExpense";
426 pub const SELLING_GENERAL_AND_ADMIN: &str = "SellingGeneralAndAdministration";
427 pub const RESEARCH_AND_DEVELOPMENT: &str = "ResearchAndDevelopment";
428 pub const OPERATING_INCOME: &str = "OperatingIncome";
429 pub const NET_INTEREST_INCOME: &str = "NetInterestIncome";
430 pub const INTEREST_EXPENSE: &str = "InterestExpense";
431 pub const INTEREST_INCOME: &str = "InterestIncome";
432 pub const NET_NON_OPERATING_INTEREST_INCOME_EXPENSE: &str =
433 "NetNonOperatingInterestIncomeExpense";
434 pub const OTHER_INCOME_EXPENSE: &str = "OtherIncomeExpense";
435 pub const PRETAX_INCOME: &str = "PretaxIncome";
436 pub const TAX_PROVISION: &str = "TaxProvision";
437 pub const NET_INCOME_COMMON_STOCKHOLDERS: &str = "NetIncomeCommonStockholders";
438 pub const NET_INCOME: &str = "NetIncome";
439 pub const DILUTED_EPS: &str = "DilutedEPS";
440 pub const BASIC_EPS: &str = "BasicEPS";
441 pub const DILUTED_AVERAGE_SHARES: &str = "DilutedAverageShares";
442 pub const BASIC_AVERAGE_SHARES: &str = "BasicAverageShares";
443 pub const EBIT: &str = "EBIT";
444 pub const EBITDA: &str = "EBITDA";
445 pub const RECONCILED_COST_OF_REVENUE: &str = "ReconciledCostOfRevenue";
446 pub const RECONCILED_DEPRECIATION: &str = "ReconciledDepreciation";
447 pub const NET_INCOME_FROM_CONTINUING_OPERATION_NET_MINORITY_INTEREST: &str =
448 "NetIncomeFromContinuingOperationNetMinorityInterest";
449 pub const NORMALIZED_EBITDA: &str = "NormalizedEBITDA";
450 pub const TOTAL_EXPENSES: &str = "TotalExpenses";
451 pub const TOTAL_OPERATING_INCOME_AS_REPORTED: &str = "TotalOperatingIncomeAsReported";
452
453 pub const TOTAL_ASSETS: &str = "TotalAssets";
457 pub const CURRENT_ASSETS: &str = "CurrentAssets";
458 pub const CASH_CASH_EQUIVALENTS_AND_SHORT_TERM_INVESTMENTS: &str =
459 "CashCashEquivalentsAndShortTermInvestments";
460 pub const CASH_AND_CASH_EQUIVALENTS: &str = "CashAndCashEquivalents";
461 pub const CASH_FINANCIAL: &str = "CashFinancial";
462 pub const RECEIVABLES: &str = "Receivables";
463 pub const ACCOUNTS_RECEIVABLE: &str = "AccountsReceivable";
464 pub const INVENTORY: &str = "Inventory";
465 pub const PREPAID_ASSETS: &str = "PrepaidAssets";
466 pub const OTHER_CURRENT_ASSETS: &str = "OtherCurrentAssets";
467 pub const TOTAL_NON_CURRENT_ASSETS: &str = "TotalNonCurrentAssets";
468 pub const NET_PPE: &str = "NetPPE";
469 pub const GROSS_PPE: &str = "GrossPPE";
470 pub const ACCUMULATED_DEPRECIATION: &str = "AccumulatedDepreciation";
471 pub const GOODWILL: &str = "Goodwill";
472 pub const GOODWILL_AND_OTHER_INTANGIBLE_ASSETS: &str = "GoodwillAndOtherIntangibleAssets";
473 pub const OTHER_INTANGIBLE_ASSETS: &str = "OtherIntangibleAssets";
474 pub const INVESTMENTS_AND_ADVANCES: &str = "InvestmentsAndAdvances";
475 pub const LONG_TERM_EQUITY_INVESTMENT: &str = "LongTermEquityInvestment";
476 pub const OTHER_NON_CURRENT_ASSETS: &str = "OtherNonCurrentAssets";
477 pub const TOTAL_LIABILITIES_NET_MINORITY_INTEREST: &str = "TotalLiabilitiesNetMinorityInterest";
478 pub const CURRENT_LIABILITIES: &str = "CurrentLiabilities";
479 pub const PAYABLES_AND_ACCRUED_EXPENSES: &str = "PayablesAndAccruedExpenses";
480 pub const ACCOUNTS_PAYABLE: &str = "AccountsPayable";
481 pub const CURRENT_DEBT: &str = "CurrentDebt";
482 pub const CURRENT_DEFERRED_REVENUE: &str = "CurrentDeferredRevenue";
483 pub const OTHER_CURRENT_LIABILITIES: &str = "OtherCurrentLiabilities";
484 pub const TOTAL_NON_CURRENT_LIABILITIES_NET_MINORITY_INTEREST: &str =
485 "TotalNonCurrentLiabilitiesNetMinorityInterest";
486 pub const LONG_TERM_DEBT: &str = "LongTermDebt";
487 pub const LONG_TERM_DEBT_AND_CAPITAL_LEASE_OBLIGATION: &str =
488 "LongTermDebtAndCapitalLeaseObligation";
489 pub const NON_CURRENT_DEFERRED_REVENUE: &str = "NonCurrentDeferredRevenue";
490 pub const NON_CURRENT_DEFERRED_TAXES_LIABILITIES: &str = "NonCurrentDeferredTaxesLiabilities";
491 pub const OTHER_NON_CURRENT_LIABILITIES: &str = "OtherNonCurrentLiabilities";
492 pub const STOCKHOLDERS_EQUITY: &str = "StockholdersEquity";
493 pub const COMMON_STOCK_EQUITY: &str = "CommonStockEquity";
494 pub const COMMON_STOCK: &str = "CommonStock";
495 pub const RETAINED_EARNINGS: &str = "RetainedEarnings";
496 pub const ADDITIONAL_PAID_IN_CAPITAL: &str = "AdditionalPaidInCapital";
497 pub const TREASURY_STOCK: &str = "TreasuryStock";
498 pub const TOTAL_EQUITY_GROSS_MINORITY_INTEREST: &str = "TotalEquityGrossMinorityInterest";
499 pub const WORKING_CAPITAL: &str = "WorkingCapital";
500 pub const INVESTED_CAPITAL: &str = "InvestedCapital";
501 pub const TANGIBLE_BOOK_VALUE: &str = "TangibleBookValue";
502 pub const TOTAL_DEBT: &str = "TotalDebt";
503 pub const NET_DEBT: &str = "NetDebt";
504 pub const SHARE_ISSUED: &str = "ShareIssued";
505 pub const ORDINARY_SHARES_NUMBER: &str = "OrdinarySharesNumber";
506
507 pub const OPERATING_CASH_FLOW: &str = "OperatingCashFlow";
511 pub const CASH_FLOW_FROM_CONTINUING_OPERATING_ACTIVITIES: &str =
512 "CashFlowFromContinuingOperatingActivities";
513 pub const NET_INCOME_FROM_CONTINUING_OPERATIONS: &str = "NetIncomeFromContinuingOperations";
514 pub const DEPRECIATION_AND_AMORTIZATION: &str = "DepreciationAndAmortization";
515 pub const DEFERRED_INCOME_TAX: &str = "DeferredIncomeTax";
516 pub const CHANGE_IN_WORKING_CAPITAL: &str = "ChangeInWorkingCapital";
517 pub const CHANGE_IN_RECEIVABLES: &str = "ChangeInReceivables";
518 pub const CHANGES_IN_ACCOUNT_RECEIVABLES: &str = "ChangesInAccountReceivables";
519 pub const CHANGE_IN_INVENTORY: &str = "ChangeInInventory";
520 pub const CHANGE_IN_ACCOUNT_PAYABLE: &str = "ChangeInAccountPayable";
521 pub const CHANGE_IN_OTHER_WORKING_CAPITAL: &str = "ChangeInOtherWorkingCapital";
522 pub const STOCK_BASED_COMPENSATION: &str = "StockBasedCompensation";
523 pub const OTHER_NON_CASH_ITEMS: &str = "OtherNonCashItems";
524 pub const INVESTING_CASH_FLOW: &str = "InvestingCashFlow";
525 pub const CASH_FLOW_FROM_CONTINUING_INVESTING_ACTIVITIES: &str =
526 "CashFlowFromContinuingInvestingActivities";
527 pub const NET_PPE_PURCHASE_AND_SALE: &str = "NetPPEPurchaseAndSale";
528 pub const PURCHASE_OF_PPE: &str = "PurchaseOfPPE";
529 pub const SALE_OF_PPE: &str = "SaleOfPPE";
530 pub const CAPITAL_EXPENDITURE: &str = "CapitalExpenditure";
531 pub const NET_BUSINESS_PURCHASE_AND_SALE: &str = "NetBusinessPurchaseAndSale";
532 pub const PURCHASE_OF_BUSINESS: &str = "PurchaseOfBusiness";
533 pub const SALE_OF_BUSINESS: &str = "SaleOfBusiness";
534 pub const NET_INVESTMENT_PURCHASE_AND_SALE: &str = "NetInvestmentPurchaseAndSale";
535 pub const PURCHASE_OF_INVESTMENT: &str = "PurchaseOfInvestment";
536 pub const SALE_OF_INVESTMENT: &str = "SaleOfInvestment";
537 pub const NET_OTHER_INVESTING_CHANGES: &str = "NetOtherInvestingChanges";
538 pub const FINANCING_CASH_FLOW: &str = "FinancingCashFlow";
539 pub const CASH_FLOW_FROM_CONTINUING_FINANCING_ACTIVITIES: &str =
540 "CashFlowFromContinuingFinancingActivities";
541 pub const NET_ISSUANCE_PAYMENTS_OF_DEBT: &str = "NetIssuancePaymentsOfDebt";
542 pub const NET_LONG_TERM_DEBT_ISSUANCE: &str = "NetLongTermDebtIssuance";
543 pub const LONG_TERM_DEBT_ISSUANCE: &str = "LongTermDebtIssuance";
544 pub const LONG_TERM_DEBT_PAYMENTS: &str = "LongTermDebtPayments";
545 pub const NET_SHORT_TERM_DEBT_ISSUANCE: &str = "NetShortTermDebtIssuance";
546 pub const NET_COMMON_STOCK_ISSUANCE: &str = "NetCommonStockIssuance";
547 pub const COMMON_STOCK_ISSUANCE: &str = "CommonStockIssuance";
548 pub const COMMON_STOCK_PAYMENTS: &str = "CommonStockPayments";
549 pub const REPURCHASE_OF_CAPITAL_STOCK: &str = "RepurchaseOfCapitalStock";
550 pub const CASH_DIVIDENDS_PAID: &str = "CashDividendsPaid";
551 pub const COMMON_STOCK_DIVIDEND_PAID: &str = "CommonStockDividendPaid";
552 pub const NET_OTHER_FINANCING_CHARGES: &str = "NetOtherFinancingCharges";
553 pub const END_CASH_POSITION: &str = "EndCashPosition";
554 pub const BEGINNING_CASH_POSITION: &str = "BeginningCashPosition";
555 pub const CHANGESIN_CASH: &str = "ChangesinCash";
556 pub const EFFECT_OF_EXCHANGE_RATE_CHANGES: &str = "EffectOfExchangeRateChanges";
557 pub const FREE_CASH_FLOW: &str = "FreeCashFlow";
558 pub const CAPITAL_EXPENDITURE_REPORTED: &str = "CapitalExpenditureReported";
559}
560
561#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
563pub enum StatementType {
564 Income,
566 Balance,
568 CashFlow,
570}
571
572impl StatementType {
573 pub fn as_str(&self) -> &'static str {
575 match self {
576 StatementType::Income => "income",
577 StatementType::Balance => "balance",
578 StatementType::CashFlow => "cashflow",
579 }
580 }
581
582 pub fn get_fields(&self) -> &'static [&'static str] {
586 match self {
587 StatementType::Income => &INCOME_STATEMENT_FIELDS,
588 StatementType::Balance => &BALANCE_SHEET_FIELDS,
589 StatementType::CashFlow => &CASH_FLOW_FIELDS,
590 }
591 }
592}
593
594const INCOME_STATEMENT_FIELDS: [&str; 30] = [
596 fundamental_types::TOTAL_REVENUE,
597 fundamental_types::OPERATING_REVENUE,
598 fundamental_types::COST_OF_REVENUE,
599 fundamental_types::GROSS_PROFIT,
600 fundamental_types::OPERATING_EXPENSE,
601 fundamental_types::SELLING_GENERAL_AND_ADMIN,
602 fundamental_types::RESEARCH_AND_DEVELOPMENT,
603 fundamental_types::OPERATING_INCOME,
604 fundamental_types::NET_INTEREST_INCOME,
605 fundamental_types::INTEREST_EXPENSE,
606 fundamental_types::INTEREST_INCOME,
607 fundamental_types::NET_NON_OPERATING_INTEREST_INCOME_EXPENSE,
608 fundamental_types::OTHER_INCOME_EXPENSE,
609 fundamental_types::PRETAX_INCOME,
610 fundamental_types::TAX_PROVISION,
611 fundamental_types::NET_INCOME_COMMON_STOCKHOLDERS,
612 fundamental_types::NET_INCOME,
613 fundamental_types::DILUTED_EPS,
614 fundamental_types::BASIC_EPS,
615 fundamental_types::DILUTED_AVERAGE_SHARES,
616 fundamental_types::BASIC_AVERAGE_SHARES,
617 fundamental_types::EBIT,
618 fundamental_types::EBITDA,
619 fundamental_types::RECONCILED_COST_OF_REVENUE,
620 fundamental_types::RECONCILED_DEPRECIATION,
621 fundamental_types::NET_INCOME_FROM_CONTINUING_OPERATION_NET_MINORITY_INTEREST,
622 fundamental_types::NORMALIZED_EBITDA,
623 fundamental_types::TOTAL_EXPENSES,
624 fundamental_types::TOTAL_OPERATING_INCOME_AS_REPORTED,
625 fundamental_types::DEPRECIATION_AND_AMORTIZATION,
626];
627
628const BALANCE_SHEET_FIELDS: [&str; 48] = [
630 fundamental_types::TOTAL_ASSETS,
631 fundamental_types::CURRENT_ASSETS,
632 fundamental_types::CASH_CASH_EQUIVALENTS_AND_SHORT_TERM_INVESTMENTS,
633 fundamental_types::CASH_AND_CASH_EQUIVALENTS,
634 fundamental_types::CASH_FINANCIAL,
635 fundamental_types::RECEIVABLES,
636 fundamental_types::ACCOUNTS_RECEIVABLE,
637 fundamental_types::INVENTORY,
638 fundamental_types::PREPAID_ASSETS,
639 fundamental_types::OTHER_CURRENT_ASSETS,
640 fundamental_types::TOTAL_NON_CURRENT_ASSETS,
641 fundamental_types::NET_PPE,
642 fundamental_types::GROSS_PPE,
643 fundamental_types::ACCUMULATED_DEPRECIATION,
644 fundamental_types::GOODWILL,
645 fundamental_types::GOODWILL_AND_OTHER_INTANGIBLE_ASSETS,
646 fundamental_types::OTHER_INTANGIBLE_ASSETS,
647 fundamental_types::INVESTMENTS_AND_ADVANCES,
648 fundamental_types::LONG_TERM_EQUITY_INVESTMENT,
649 fundamental_types::OTHER_NON_CURRENT_ASSETS,
650 fundamental_types::TOTAL_LIABILITIES_NET_MINORITY_INTEREST,
651 fundamental_types::CURRENT_LIABILITIES,
652 fundamental_types::PAYABLES_AND_ACCRUED_EXPENSES,
653 fundamental_types::ACCOUNTS_PAYABLE,
654 fundamental_types::CURRENT_DEBT,
655 fundamental_types::CURRENT_DEFERRED_REVENUE,
656 fundamental_types::OTHER_CURRENT_LIABILITIES,
657 fundamental_types::TOTAL_NON_CURRENT_LIABILITIES_NET_MINORITY_INTEREST,
658 fundamental_types::LONG_TERM_DEBT,
659 fundamental_types::LONG_TERM_DEBT_AND_CAPITAL_LEASE_OBLIGATION,
660 fundamental_types::NON_CURRENT_DEFERRED_REVENUE,
661 fundamental_types::NON_CURRENT_DEFERRED_TAXES_LIABILITIES,
662 fundamental_types::OTHER_NON_CURRENT_LIABILITIES,
663 fundamental_types::STOCKHOLDERS_EQUITY,
664 fundamental_types::COMMON_STOCK_EQUITY,
665 fundamental_types::COMMON_STOCK,
666 fundamental_types::RETAINED_EARNINGS,
667 fundamental_types::ADDITIONAL_PAID_IN_CAPITAL,
668 fundamental_types::TREASURY_STOCK,
669 fundamental_types::TOTAL_EQUITY_GROSS_MINORITY_INTEREST,
670 fundamental_types::WORKING_CAPITAL,
671 fundamental_types::INVESTED_CAPITAL,
672 fundamental_types::TANGIBLE_BOOK_VALUE,
673 fundamental_types::TOTAL_DEBT,
674 fundamental_types::NET_DEBT,
675 fundamental_types::SHARE_ISSUED,
676 fundamental_types::ORDINARY_SHARES_NUMBER,
677 fundamental_types::DEPRECIATION_AND_AMORTIZATION,
678];
679
680const CASH_FLOW_FIELDS: [&str; 47] = [
682 fundamental_types::OPERATING_CASH_FLOW,
683 fundamental_types::CASH_FLOW_FROM_CONTINUING_OPERATING_ACTIVITIES,
684 fundamental_types::NET_INCOME_FROM_CONTINUING_OPERATIONS,
685 fundamental_types::DEPRECIATION_AND_AMORTIZATION,
686 fundamental_types::DEFERRED_INCOME_TAX,
687 fundamental_types::CHANGE_IN_WORKING_CAPITAL,
688 fundamental_types::CHANGE_IN_RECEIVABLES,
689 fundamental_types::CHANGES_IN_ACCOUNT_RECEIVABLES,
690 fundamental_types::CHANGE_IN_INVENTORY,
691 fundamental_types::CHANGE_IN_ACCOUNT_PAYABLE,
692 fundamental_types::CHANGE_IN_OTHER_WORKING_CAPITAL,
693 fundamental_types::STOCK_BASED_COMPENSATION,
694 fundamental_types::OTHER_NON_CASH_ITEMS,
695 fundamental_types::INVESTING_CASH_FLOW,
696 fundamental_types::CASH_FLOW_FROM_CONTINUING_INVESTING_ACTIVITIES,
697 fundamental_types::NET_PPE_PURCHASE_AND_SALE,
698 fundamental_types::PURCHASE_OF_PPE,
699 fundamental_types::SALE_OF_PPE,
700 fundamental_types::CAPITAL_EXPENDITURE,
701 fundamental_types::NET_BUSINESS_PURCHASE_AND_SALE,
702 fundamental_types::PURCHASE_OF_BUSINESS,
703 fundamental_types::SALE_OF_BUSINESS,
704 fundamental_types::NET_INVESTMENT_PURCHASE_AND_SALE,
705 fundamental_types::PURCHASE_OF_INVESTMENT,
706 fundamental_types::SALE_OF_INVESTMENT,
707 fundamental_types::NET_OTHER_INVESTING_CHANGES,
708 fundamental_types::FINANCING_CASH_FLOW,
709 fundamental_types::CASH_FLOW_FROM_CONTINUING_FINANCING_ACTIVITIES,
710 fundamental_types::NET_ISSUANCE_PAYMENTS_OF_DEBT,
711 fundamental_types::NET_LONG_TERM_DEBT_ISSUANCE,
712 fundamental_types::LONG_TERM_DEBT_ISSUANCE,
713 fundamental_types::LONG_TERM_DEBT_PAYMENTS,
714 fundamental_types::NET_SHORT_TERM_DEBT_ISSUANCE,
715 fundamental_types::NET_COMMON_STOCK_ISSUANCE,
716 fundamental_types::COMMON_STOCK_ISSUANCE,
717 fundamental_types::COMMON_STOCK_PAYMENTS,
718 fundamental_types::REPURCHASE_OF_CAPITAL_STOCK,
719 fundamental_types::CASH_DIVIDENDS_PAID,
720 fundamental_types::COMMON_STOCK_DIVIDEND_PAID,
721 fundamental_types::NET_OTHER_FINANCING_CHARGES,
722 fundamental_types::END_CASH_POSITION,
723 fundamental_types::BEGINNING_CASH_POSITION,
724 fundamental_types::CHANGESIN_CASH,
725 fundamental_types::EFFECT_OF_EXCHANGE_RATE_CHANGES,
726 fundamental_types::FREE_CASH_FLOW,
727 fundamental_types::CAPITAL_EXPENDITURE_REPORTED,
728 fundamental_types::DEPRECIATION_AND_AMORTIZATION,
729];
730
731#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
733pub enum Frequency {
734 Annual,
736 Quarterly,
738}
739
740impl Frequency {
741 pub fn as_str(&self) -> &'static str {
743 match self {
744 Frequency::Annual => "annual",
745 Frequency::Quarterly => "quarterly",
746 }
747 }
748
749 pub fn prefix(&self, field: &str) -> String {
760 format!("{}{}", self.as_str(), field)
761 }
762}
763
764#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
766pub enum Interval {
767 #[serde(rename = "1m")]
769 OneMinute,
770 #[serde(rename = "5m")]
772 FiveMinutes,
773 #[serde(rename = "15m")]
775 FifteenMinutes,
776 #[serde(rename = "30m")]
778 ThirtyMinutes,
779 #[serde(rename = "1h")]
781 OneHour,
782 #[serde(rename = "1d")]
784 OneDay,
785 #[serde(rename = "1wk")]
787 OneWeek,
788 #[serde(rename = "1mo")]
790 OneMonth,
791 #[serde(rename = "3mo")]
793 ThreeMonths,
794}
795
796impl Interval {
797 pub fn as_str(&self) -> &'static str {
799 match self {
800 Interval::OneMinute => "1m",
801 Interval::FiveMinutes => "5m",
802 Interval::FifteenMinutes => "15m",
803 Interval::ThirtyMinutes => "30m",
804 Interval::OneHour => "1h",
805 Interval::OneDay => "1d",
806 Interval::OneWeek => "1wk",
807 Interval::OneMonth => "1mo",
808 Interval::ThreeMonths => "3mo",
809 }
810 }
811}
812
813impl std::fmt::Display for Interval {
814 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
815 f.write_str(self.as_str())
816 }
817}
818
819#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
821pub enum TimeRange {
822 #[serde(rename = "1d")]
824 OneDay,
825 #[serde(rename = "5d")]
827 FiveDays,
828 #[serde(rename = "1mo")]
830 OneMonth,
831 #[serde(rename = "3mo")]
833 ThreeMonths,
834 #[serde(rename = "6mo")]
836 SixMonths,
837 #[serde(rename = "1y")]
839 OneYear,
840 #[serde(rename = "2y")]
842 TwoYears,
843 #[serde(rename = "5y")]
845 FiveYears,
846 #[serde(rename = "10y")]
848 TenYears,
849 #[serde(rename = "ytd")]
851 YearToDate,
852 #[serde(rename = "max")]
854 Max,
855}
856
857impl TimeRange {
858 pub fn as_str(&self) -> &'static str {
860 match self {
861 TimeRange::OneDay => "1d",
862 TimeRange::FiveDays => "5d",
863 TimeRange::OneMonth => "1mo",
864 TimeRange::ThreeMonths => "3mo",
865 TimeRange::SixMonths => "6mo",
866 TimeRange::OneYear => "1y",
867 TimeRange::TwoYears => "2y",
868 TimeRange::FiveYears => "5y",
869 TimeRange::TenYears => "10y",
870 TimeRange::YearToDate => "ytd",
871 TimeRange::Max => "max",
872 }
873 }
874}
875
876impl std::fmt::Display for TimeRange {
877 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
878 f.write_str(self.as_str())
879 }
880}
881
882#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
887pub enum Region {
888 Argentina,
890 Australia,
892 Brazil,
894 Canada,
896 China,
898 Denmark,
900 Finland,
902 France,
904 Germany,
906 Greece,
908 HongKong,
910 India,
912 Israel,
914 Italy,
916 Malaysia,
918 NewZealand,
920 Norway,
922 Portugal,
924 Russia,
926 Singapore,
928 Spain,
930 Sweden,
932 Taiwan,
934 Thailand,
936 Turkey,
938 UnitedKingdom,
940 #[default]
942 UnitedStates,
943 Vietnam,
945}
946
947impl Region {
948 pub fn lang(&self) -> &'static str {
959 match self {
960 Region::Argentina => "es-AR",
961 Region::Australia => "en-AU",
962 Region::Brazil => "pt-BR",
963 Region::Canada => "en-CA",
964 Region::China => "zh-CN",
965 Region::Denmark => "da-DK",
966 Region::Finland => "fi-FI",
967 Region::France => "fr-FR",
968 Region::Germany => "de-DE",
969 Region::Greece => "el-GR",
970 Region::HongKong => "zh-Hant-HK",
971 Region::India => "en-IN",
972 Region::Israel => "he-IL",
973 Region::Italy => "it-IT",
974 Region::Malaysia => "ms-MY",
975 Region::NewZealand => "en-NZ",
976 Region::Norway => "nb-NO",
977 Region::Portugal => "pt-PT",
978 Region::Russia => "ru-RU",
979 Region::Singapore => "en-SG",
980 Region::Spain => "es-ES",
981 Region::Sweden => "sv-SE",
982 Region::Taiwan => "zh-TW",
983 Region::Thailand => "th-TH",
984 Region::Turkey => "tr-TR",
985 Region::UnitedKingdom => "en-GB",
986 Region::UnitedStates => "en-US",
987 Region::Vietnam => "vi-VN",
988 }
989 }
990
991 pub fn region(&self) -> &'static str {
1002 match self {
1003 Region::Argentina => "AR",
1004 Region::Australia => "AU",
1005 Region::Brazil => "BR",
1006 Region::Canada => "CA",
1007 Region::China => "CN",
1008 Region::Denmark => "DK",
1009 Region::Finland => "FI",
1010 Region::France => "FR",
1011 Region::Germany => "DE",
1012 Region::Greece => "GR",
1013 Region::HongKong => "HK",
1014 Region::India => "IN",
1015 Region::Israel => "IL",
1016 Region::Italy => "IT",
1017 Region::Malaysia => "MY",
1018 Region::NewZealand => "NZ",
1019 Region::Norway => "NO",
1020 Region::Portugal => "PT",
1021 Region::Russia => "RU",
1022 Region::Singapore => "SG",
1023 Region::Spain => "ES",
1024 Region::Sweden => "SE",
1025 Region::Taiwan => "TW",
1026 Region::Thailand => "TH",
1027 Region::Turkey => "TR",
1028 Region::UnitedKingdom => "GB",
1029 Region::UnitedStates => "US",
1030 Region::Vietnam => "VN",
1031 }
1032 }
1033
1034 pub fn cors_domain(&self) -> &'static str {
1045 match self {
1046 Region::Argentina => "ar.finance.yahoo.com",
1047 Region::Australia => "au.finance.yahoo.com",
1048 Region::Brazil => "br.financas.yahoo.com",
1049 Region::Canada => "ca.finance.yahoo.com",
1050 Region::China => "cn.finance.yahoo.com",
1051 Region::Denmark => "dk.finance.yahoo.com",
1052 Region::Finland => "fi.finance.yahoo.com",
1053 Region::France => "fr.finance.yahoo.com",
1054 Region::Germany => "de.finance.yahoo.com",
1055 Region::Greece => "gr.finance.yahoo.com",
1056 Region::HongKong => "hk.finance.yahoo.com",
1057 Region::India => "in.finance.yahoo.com",
1058 Region::Israel => "il.finance.yahoo.com",
1059 Region::Italy => "it.finance.yahoo.com",
1060 Region::Malaysia => "my.finance.yahoo.com",
1061 Region::NewZealand => "nz.finance.yahoo.com",
1062 Region::Norway => "no.finance.yahoo.com",
1063 Region::Portugal => "pt.finance.yahoo.com",
1064 Region::Russia => "ru.finance.yahoo.com",
1065 Region::Singapore => "sg.finance.yahoo.com",
1066 Region::Spain => "es.finance.yahoo.com",
1067 Region::Sweden => "se.finance.yahoo.com",
1068 Region::Taiwan => "tw.finance.yahoo.com",
1069 Region::Thailand => "th.finance.yahoo.com",
1070 Region::Turkey => "tr.finance.yahoo.com",
1071 Region::UnitedKingdom => "uk.finance.yahoo.com",
1072 Region::UnitedStates => "finance.yahoo.com",
1073 Region::Vietnam => "vn.finance.yahoo.com",
1074 }
1075 }
1076}
1077
1078impl std::str::FromStr for Region {
1079 type Err = ();
1080
1081 fn from_str(s: &str) -> Result<Self, Self::Err> {
1082 match s.to_uppercase().as_str() {
1083 "AR" => Ok(Region::Argentina),
1084 "AU" => Ok(Region::Australia),
1085 "BR" => Ok(Region::Brazil),
1086 "CA" => Ok(Region::Canada),
1087 "CN" => Ok(Region::China),
1088 "DK" => Ok(Region::Denmark),
1089 "FI" => Ok(Region::Finland),
1090 "FR" => Ok(Region::France),
1091 "DE" => Ok(Region::Germany),
1092 "GR" => Ok(Region::Greece),
1093 "HK" => Ok(Region::HongKong),
1094 "IN" => Ok(Region::India),
1095 "IL" => Ok(Region::Israel),
1096 "IT" => Ok(Region::Italy),
1097 "MY" => Ok(Region::Malaysia),
1098 "NZ" => Ok(Region::NewZealand),
1099 "NO" => Ok(Region::Norway),
1100 "PT" => Ok(Region::Portugal),
1101 "RU" => Ok(Region::Russia),
1102 "SG" => Ok(Region::Singapore),
1103 "ES" => Ok(Region::Spain),
1104 "SE" => Ok(Region::Sweden),
1105 "TW" => Ok(Region::Taiwan),
1106 "TH" => Ok(Region::Thailand),
1107 "TR" => Ok(Region::Turkey),
1108 "GB" | "UK" => Ok(Region::UnitedKingdom),
1109 "US" => Ok(Region::UnitedStates),
1110 "VN" => Ok(Region::Vietnam),
1111 _ => Err(()),
1112 }
1113 }
1114}
1115
1116impl From<Region> for String {
1117 fn from(v: Region) -> Self {
1120 v.region().to_lowercase()
1121 }
1122}
1123
1124#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
1130pub enum ValueFormat {
1131 #[default]
1134 Raw,
1135 Pretty,
1138 Both,
1141}
1142
1143impl std::str::FromStr for ValueFormat {
1144 type Err = ();
1145
1146 fn from_str(s: &str) -> Result<Self, Self::Err> {
1147 match s.to_lowercase().as_str() {
1148 "raw" => Ok(ValueFormat::Raw),
1149 "pretty" | "fmt" => Ok(ValueFormat::Pretty),
1150 "both" | "full" => Ok(ValueFormat::Both),
1151 _ => Err(()),
1152 }
1153 }
1154}
1155
1156impl ValueFormat {
1157 pub fn parse(s: &str) -> Option<Self> {
1159 s.parse().ok()
1160 }
1161
1162 pub fn as_str(&self) -> &'static str {
1164 match self {
1165 ValueFormat::Raw => "raw",
1166 ValueFormat::Pretty => "pretty",
1167 ValueFormat::Both => "both",
1168 }
1169 }
1170
1171 pub fn transform(&self, value: serde_json::Value) -> serde_json::Value {
1198 match self {
1199 ValueFormat::Both => value, _ => self.transform_recursive(value),
1201 }
1202 }
1203
1204 fn transform_recursive(&self, value: serde_json::Value) -> serde_json::Value {
1205 use serde_json::Value;
1206
1207 match value {
1208 Value::Object(map) => {
1209 if self.is_formatted_value(&map) {
1211 return self.extract_value(&map);
1212 }
1213
1214 let transformed: serde_json::Map<String, Value> = map
1216 .into_iter()
1217 .map(|(k, v)| (k, self.transform_recursive(v)))
1218 .collect();
1219 Value::Object(transformed)
1220 }
1221 Value::Array(arr) => Value::Array(
1222 arr.into_iter()
1223 .map(|v| self.transform_recursive(v))
1224 .collect(),
1225 ),
1226 other => other,
1228 }
1229 }
1230
1231 fn is_formatted_value(&self, map: &serde_json::Map<String, serde_json::Value>) -> bool {
1233 if !map.contains_key("raw") {
1237 return false;
1238 }
1239
1240 let known_keys = ["raw", "fmt", "longFmt"];
1241 let unknown_keys = map
1242 .keys()
1243 .filter(|k| !known_keys.contains(&k.as_str()))
1244 .count();
1245
1246 unknown_keys == 0
1248 }
1249
1250 fn extract_value(&self, map: &serde_json::Map<String, serde_json::Value>) -> serde_json::Value {
1252 match self {
1253 ValueFormat::Raw => {
1254 map.get("raw").cloned().unwrap_or(serde_json::Value::Null)
1256 }
1257 ValueFormat::Pretty => {
1258 map.get("fmt")
1260 .or_else(|| map.get("longFmt"))
1261 .cloned()
1262 .unwrap_or(serde_json::Value::Null)
1263 }
1264 ValueFormat::Both => {
1265 serde_json::Value::Object(map.clone())
1267 }
1268 }
1269 }
1270}
1271
1272pub mod industries {
1297 #[non_exhaustive]
1301 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1302 pub enum Industry {
1303 AgriculturalInputs,
1306 Aluminum,
1308 Coal,
1310 Copper,
1312 FarmProducts,
1314 ForestProducts,
1316 Gold,
1318 LumberAndWoodProduction,
1320 OtherIndustrialMetalsAndMining,
1322 OtherPreciousMetalsAndMining,
1324 Silver,
1326 Steel,
1328 ThermalCoal,
1330 Uranium,
1332 ApparelManufacturing,
1335 ApparelRetail,
1337 AutoAndTruckDealerships,
1339 AutoManufacturers,
1341 AutoParts,
1343 BeveragesBrewers,
1345 BeveragesNonAlcoholic,
1347 BeveragesWineriesAndDistilleries,
1349 Confectioners,
1351 DepartmentStores,
1353 DiscountStores,
1355 ElectronicGamingAndMultimedia,
1357 FoodDistribution,
1359 FootwearAndAccessories,
1361 FurnishingsFixturesAndAppliances,
1363 Gambling,
1365 GroceryStores,
1367 HomeImprovementRetail,
1369 HouseholdAndPersonalProducts,
1371 InternetRetail,
1373 Leisure,
1375 Lodging,
1377 LuxuryGoods,
1379 PackagedFoods,
1381 PersonalServices,
1383 ResidentialConstruction,
1385 ResortsAndCasinos,
1387 Restaurants,
1389 SpecialtyRetail,
1391 TextileManufacturing,
1393 Tobacco,
1395 TravelServices,
1397 OilAndGasDrilling,
1400 OilAndGasEAndP,
1402 OilAndGasEquipmentAndServices,
1404 OilAndGasIntegrated,
1406 OilAndGasMidstream,
1408 OilAndGasRefiningAndMarketing,
1410 Solar,
1412 AssetManagement,
1415 BanksDiversified,
1417 BanksRegional,
1419 CapitalMarkets,
1421 CreditServices,
1423 FinancialDataAndStockExchanges,
1425 InsuranceBrokers,
1427 InsuranceDiversified,
1429 InsuranceLife,
1431 InsurancePropertyAndCasualty,
1433 InsuranceReinsurance,
1435 InsuranceSpecialty,
1437 MortgageFinance,
1439 ShellCompanies,
1441 Biotechnology,
1444 DiagnosticsAndResearch,
1446 DrugManufacturersGeneral,
1448 DrugManufacturersSpecialtyAndGeneric,
1450 HealthInformationServices,
1452 HealthcarePlans,
1454 MedicalCareFacilities,
1456 MedicalDevices,
1458 MedicalDistribution,
1460 MedicalInstrumentsAndSupplies,
1462 PharmaceuticalRetailers,
1464 AerospaceAndDefense,
1467 BuildingMaterials,
1469 BuildingProductsAndEquipment,
1471 BusinessEquipmentAndSupplies,
1473 ChemicalManufacturing,
1475 Chemicals,
1477 Conglomerates,
1479 ConsultingServices,
1481 ElectricalEquipmentAndParts,
1483 EngineeringAndConstruction,
1485 FarmAndHeavyConstructionMachinery,
1487 IndustrialDistribution,
1489 InfrastructureOperations,
1491 IntegratedFreightAndLogistics,
1493 ManufacturingDiversified,
1495 MarinePortsAndServices,
1497 MarineShipping,
1499 MetalFabrication,
1501 PaperAndPaperProducts,
1503 PollutionAndTreatmentControls,
1505 Railroads,
1507 RentalAndLeasingServices,
1509 SecurityAndProtectionServices,
1511 SpecialtyBusinessServices,
1513 SpecialtyChemicals,
1515 SpecialtyIndustrialMachinery,
1517 StaffingAndEmploymentServices,
1519 ToolsAndAccessories,
1521 Trucking,
1523 WasteManagement,
1525 RealEstateDevelopment,
1528 RealEstateDiversified,
1530 RealEstateServices,
1532 ReitDiversified,
1534 ReitHealthcareFacilities,
1536 ReitHotelAndMotel,
1538 ReitIndustrial,
1540 ReitMortgage,
1542 ReitOffice,
1544 ReitResidential,
1546 ReitRetail,
1548 ReitSpecialty,
1550 CommunicationEquipment,
1553 ComputerHardware,
1555 ConsumerElectronics,
1557 DataAnalytics,
1559 ElectronicComponents,
1561 ElectronicsAndComputerDistribution,
1563 HardwareAndSoftwareDistribution,
1565 InformationTechnologyServices,
1567 InternetContentAndInformation,
1569 ScientificAndTechnicalInstruments,
1571 SemiconductorEquipmentAndMaterials,
1573 Semiconductors,
1575 SoftwareApplication,
1577 SoftwareInfrastructure,
1579 Broadcasting,
1582 Entertainment,
1584 Publishing,
1586 TelecomServices,
1588 UtilitiesDiversified,
1591 UtilitiesIndependentPowerProducers,
1593 UtilitiesRegulatedElectric,
1595 UtilitiesRegulatedGas,
1597 UtilitiesRegulatedWater,
1599 UtilitiesRenewable,
1601 ClosedEndFundDebt,
1604 ClosedEndFundEquity,
1606 ClosedEndFundForeign,
1608 ExchangeTradedFund,
1610 }
1611
1612 impl Industry {
1613 pub fn as_slug(self) -> &'static str {
1623 match self {
1624 Industry::AgriculturalInputs => "agricultural-inputs",
1625 Industry::Aluminum => "aluminum",
1626 Industry::Coal => "coal",
1627 Industry::Copper => "copper",
1628 Industry::FarmProducts => "farm-products",
1629 Industry::ForestProducts => "forest-products",
1630 Industry::Gold => "gold",
1631 Industry::LumberAndWoodProduction => "lumber-wood-production",
1632 Industry::OtherIndustrialMetalsAndMining => "other-industrial-metals-mining",
1633 Industry::OtherPreciousMetalsAndMining => "other-precious-metals-mining",
1634 Industry::Silver => "silver",
1635 Industry::Steel => "steel",
1636 Industry::ThermalCoal => "thermal-coal",
1637 Industry::Uranium => "uranium",
1638 Industry::ApparelManufacturing => "apparel-manufacturing",
1639 Industry::ApparelRetail => "apparel-retail",
1640 Industry::AutoAndTruckDealerships => "auto-truck-dealerships",
1641 Industry::AutoManufacturers => "auto-manufacturers",
1642 Industry::AutoParts => "auto-parts",
1643 Industry::BeveragesBrewers => "beverages-brewers",
1644 Industry::BeveragesNonAlcoholic => "beverages-non-alcoholic",
1645 Industry::BeveragesWineriesAndDistilleries => "beverages-wineries-distilleries",
1646 Industry::Confectioners => "confectioners",
1647 Industry::DepartmentStores => "department-stores",
1648 Industry::DiscountStores => "discount-stores",
1649 Industry::ElectronicGamingAndMultimedia => "electronic-gaming-multimedia",
1650 Industry::FoodDistribution => "food-distribution",
1651 Industry::FootwearAndAccessories => "footwear-accessories",
1652 Industry::FurnishingsFixturesAndAppliances => "furnishings-fixtures-appliances",
1653 Industry::Gambling => "gambling",
1654 Industry::GroceryStores => "grocery-stores",
1655 Industry::HomeImprovementRetail => "home-improvement-retail",
1656 Industry::HouseholdAndPersonalProducts => "household-personal-products",
1657 Industry::InternetRetail => "internet-retail",
1658 Industry::Leisure => "leisure",
1659 Industry::Lodging => "lodging",
1660 Industry::LuxuryGoods => "luxury-goods",
1661 Industry::PackagedFoods => "packaged-foods",
1662 Industry::PersonalServices => "personal-services",
1663 Industry::ResidentialConstruction => "residential-construction",
1664 Industry::ResortsAndCasinos => "resorts-casinos",
1665 Industry::Restaurants => "restaurants",
1666 Industry::SpecialtyRetail => "specialty-retail",
1667 Industry::TextileManufacturing => "textile-manufacturing",
1668 Industry::Tobacco => "tobacco",
1669 Industry::TravelServices => "travel-services",
1670 Industry::OilAndGasDrilling => "oil-gas-drilling",
1671 Industry::OilAndGasEAndP => "oil-gas-ep",
1672 Industry::OilAndGasEquipmentAndServices => "oil-gas-equipment-services",
1673 Industry::OilAndGasIntegrated => "oil-gas-integrated",
1674 Industry::OilAndGasMidstream => "oil-gas-midstream",
1675 Industry::OilAndGasRefiningAndMarketing => "oil-gas-refining-marketing",
1676 Industry::Solar => "solar",
1677 Industry::AssetManagement => "asset-management",
1678 Industry::BanksDiversified => "banks-diversified",
1679 Industry::BanksRegional => "banks-regional",
1680 Industry::CapitalMarkets => "capital-markets",
1681 Industry::CreditServices => "credit-services",
1682 Industry::FinancialDataAndStockExchanges => "financial-data-stock-exchanges",
1683 Industry::InsuranceBrokers => "insurance-brokers",
1684 Industry::InsuranceDiversified => "insurance-diversified",
1685 Industry::InsuranceLife => "insurance-life",
1686 Industry::InsurancePropertyAndCasualty => "insurance-property-casualty",
1687 Industry::InsuranceReinsurance => "insurance-reinsurance",
1688 Industry::InsuranceSpecialty => "insurance-specialty",
1689 Industry::MortgageFinance => "mortgage-finance",
1690 Industry::ShellCompanies => "shell-companies",
1691 Industry::Biotechnology => "biotechnology",
1692 Industry::DiagnosticsAndResearch => "diagnostics-research",
1693 Industry::DrugManufacturersGeneral => "drug-manufacturers-general",
1694 Industry::DrugManufacturersSpecialtyAndGeneric => {
1695 "drug-manufacturers-specialty-generic"
1696 }
1697 Industry::HealthInformationServices => "health-information-services",
1698 Industry::HealthcarePlans => "healthcare-plans",
1699 Industry::MedicalCareFacilities => "medical-care-facilities",
1700 Industry::MedicalDevices => "medical-devices",
1701 Industry::MedicalDistribution => "medical-distribution",
1702 Industry::MedicalInstrumentsAndSupplies => "medical-instruments-supplies",
1703 Industry::PharmaceuticalRetailers => "pharmaceutical-retailers",
1704 Industry::AerospaceAndDefense => "aerospace-defense",
1705 Industry::BuildingMaterials => "building-materials",
1706 Industry::BuildingProductsAndEquipment => "building-products-equipment",
1707 Industry::BusinessEquipmentAndSupplies => "business-equipment-supplies",
1708 Industry::ChemicalManufacturing => "chemical-manufacturing",
1709 Industry::Chemicals => "chemicals",
1710 Industry::Conglomerates => "conglomerates",
1711 Industry::ConsultingServices => "consulting-services",
1712 Industry::ElectricalEquipmentAndParts => "electrical-equipment-parts",
1713 Industry::EngineeringAndConstruction => "engineering-construction",
1714 Industry::FarmAndHeavyConstructionMachinery => "farm-heavy-construction-machinery",
1715 Industry::IndustrialDistribution => "industrial-distribution",
1716 Industry::InfrastructureOperations => "infrastructure-operations",
1717 Industry::IntegratedFreightAndLogistics => "integrated-freight-logistics",
1718 Industry::ManufacturingDiversified => "manufacturing-diversified",
1719 Industry::MarinePortsAndServices => "marine-ports-services",
1720 Industry::MarineShipping => "marine-shipping",
1721 Industry::MetalFabrication => "metal-fabrication",
1722 Industry::PaperAndPaperProducts => "paper-paper-products",
1723 Industry::PollutionAndTreatmentControls => "pollution-treatment-controls",
1724 Industry::Railroads => "railroads",
1725 Industry::RentalAndLeasingServices => "rental-leasing-services",
1726 Industry::SecurityAndProtectionServices => "security-protection-services",
1727 Industry::SpecialtyBusinessServices => "specialty-business-services",
1728 Industry::SpecialtyChemicals => "specialty-chemicals",
1729 Industry::SpecialtyIndustrialMachinery => "specialty-industrial-machinery",
1730 Industry::StaffingAndEmploymentServices => "staffing-employment-services",
1731 Industry::ToolsAndAccessories => "tools-accessories",
1732 Industry::Trucking => "trucking",
1733 Industry::WasteManagement => "waste-management",
1734 Industry::RealEstateDevelopment => "real-estate-development",
1735 Industry::RealEstateDiversified => "real-estate-diversified",
1736 Industry::RealEstateServices => "real-estate-services",
1737 Industry::ReitDiversified => "reit-diversified",
1738 Industry::ReitHealthcareFacilities => "reit-healthcare-facilities",
1739 Industry::ReitHotelAndMotel => "reit-hotel-motel",
1740 Industry::ReitIndustrial => "reit-industrial",
1741 Industry::ReitMortgage => "reit-mortgage",
1742 Industry::ReitOffice => "reit-office",
1743 Industry::ReitResidential => "reit-residential",
1744 Industry::ReitRetail => "reit-retail",
1745 Industry::ReitSpecialty => "reit-specialty",
1746 Industry::CommunicationEquipment => "communication-equipment",
1747 Industry::ComputerHardware => "computer-hardware",
1748 Industry::ConsumerElectronics => "consumer-electronics",
1749 Industry::DataAnalytics => "data-analytics",
1750 Industry::ElectronicComponents => "electronic-components",
1751 Industry::ElectronicsAndComputerDistribution => "electronics-computer-distribution",
1752 Industry::HardwareAndSoftwareDistribution => "hardware-software-distribution",
1753 Industry::InformationTechnologyServices => "information-technology-services",
1754 Industry::InternetContentAndInformation => "internet-content-information",
1755 Industry::ScientificAndTechnicalInstruments => "scientific-technical-instruments",
1756 Industry::SemiconductorEquipmentAndMaterials => "semiconductor-equipment-materials",
1757 Industry::Semiconductors => "semiconductors",
1758 Industry::SoftwareApplication => "software-application",
1759 Industry::SoftwareInfrastructure => "software-infrastructure",
1760 Industry::Broadcasting => "broadcasting",
1761 Industry::Entertainment => "entertainment",
1762 Industry::Publishing => "publishing",
1763 Industry::TelecomServices => "telecom-services",
1764 Industry::UtilitiesDiversified => "utilities-diversified",
1765 Industry::UtilitiesIndependentPowerProducers => {
1766 "utilities-independent-power-producers"
1767 }
1768 Industry::UtilitiesRegulatedElectric => "utilities-regulated-electric",
1769 Industry::UtilitiesRegulatedGas => "utilities-regulated-gas",
1770 Industry::UtilitiesRegulatedWater => "utilities-regulated-water",
1771 Industry::UtilitiesRenewable => "utilities-renewable",
1772 Industry::ClosedEndFundDebt => "closed-end-fund-debt",
1773 Industry::ClosedEndFundEquity => "closed-end-fund-equity",
1774 Industry::ClosedEndFundForeign => "closed-end-fund-foreign",
1775 Industry::ExchangeTradedFund => "exchange-traded-fund",
1776 }
1777 }
1778
1779 pub fn screener_value(self) -> &'static str {
1789 match self {
1790 Industry::AgriculturalInputs => "Agricultural Inputs",
1791 Industry::Aluminum => "Aluminum",
1792 Industry::Coal => "Coal",
1793 Industry::Copper => "Copper",
1794 Industry::FarmProducts => "Farm Products",
1795 Industry::ForestProducts => "Forest Products",
1796 Industry::Gold => "Gold",
1797 Industry::LumberAndWoodProduction => "Lumber & Wood Production",
1798 Industry::OtherIndustrialMetalsAndMining => "Other Industrial Metals & Mining",
1799 Industry::OtherPreciousMetalsAndMining => "Other Precious Metals & Mining",
1800 Industry::Silver => "Silver",
1801 Industry::Steel => "Steel",
1802 Industry::ThermalCoal => "Thermal Coal",
1803 Industry::Uranium => "Uranium",
1804 Industry::ApparelManufacturing => "Apparel Manufacturing",
1805 Industry::ApparelRetail => "Apparel Retail",
1806 Industry::AutoAndTruckDealerships => "Auto & Truck Dealerships",
1807 Industry::AutoManufacturers => "Auto Manufacturers",
1808 Industry::AutoParts => "Auto Parts",
1809 Industry::BeveragesBrewers => "Beverages - Brewers",
1810 Industry::BeveragesNonAlcoholic => "Beverages - Non-Alcoholic",
1811 Industry::BeveragesWineriesAndDistilleries => "Beverages - Wineries & Distilleries",
1812 Industry::Confectioners => "Confectioners",
1813 Industry::DepartmentStores => "Department Stores",
1814 Industry::DiscountStores => "Discount Stores",
1815 Industry::ElectronicGamingAndMultimedia => "Electronic Gaming & Multimedia",
1816 Industry::FoodDistribution => "Food Distribution",
1817 Industry::FootwearAndAccessories => "Footwear & Accessories",
1818 Industry::FurnishingsFixturesAndAppliances => "Furnishings, Fixtures & Appliances",
1819 Industry::Gambling => "Gambling",
1820 Industry::GroceryStores => "Grocery Stores",
1821 Industry::HomeImprovementRetail => "Home Improvement Retail",
1822 Industry::HouseholdAndPersonalProducts => "Household & Personal Products",
1823 Industry::InternetRetail => "Internet Retail",
1824 Industry::Leisure => "Leisure",
1825 Industry::Lodging => "Lodging",
1826 Industry::LuxuryGoods => "Luxury Goods",
1827 Industry::PackagedFoods => "Packaged Foods",
1828 Industry::PersonalServices => "Personal Services",
1829 Industry::ResidentialConstruction => "Residential Construction",
1830 Industry::ResortsAndCasinos => "Resorts & Casinos",
1831 Industry::Restaurants => "Restaurants",
1832 Industry::SpecialtyRetail => "Specialty Retail",
1833 Industry::TextileManufacturing => "Textile Manufacturing",
1834 Industry::Tobacco => "Tobacco",
1835 Industry::TravelServices => "Travel Services",
1836 Industry::OilAndGasDrilling => "Oil & Gas Drilling",
1837 Industry::OilAndGasEAndP => "Oil & Gas E&P",
1838 Industry::OilAndGasEquipmentAndServices => "Oil & Gas Equipment & Services",
1839 Industry::OilAndGasIntegrated => "Oil & Gas Integrated",
1840 Industry::OilAndGasMidstream => "Oil & Gas Midstream",
1841 Industry::OilAndGasRefiningAndMarketing => "Oil & Gas Refining & Marketing",
1842 Industry::Solar => "Solar",
1843 Industry::AssetManagement => "Asset Management",
1844 Industry::BanksDiversified => "Banks - Diversified",
1845 Industry::BanksRegional => "Banks - Regional",
1846 Industry::CapitalMarkets => "Capital Markets",
1847 Industry::CreditServices => "Credit Services",
1848 Industry::FinancialDataAndStockExchanges => "Financial Data & Stock Exchanges",
1849 Industry::InsuranceBrokers => "Insurance Brokers",
1850 Industry::InsuranceDiversified => "Insurance - Diversified",
1851 Industry::InsuranceLife => "Insurance - Life",
1852 Industry::InsurancePropertyAndCasualty => "Insurance - Property & Casualty",
1853 Industry::InsuranceReinsurance => "Insurance - Reinsurance",
1854 Industry::InsuranceSpecialty => "Insurance - Specialty",
1855 Industry::MortgageFinance => "Mortgage Finance",
1856 Industry::ShellCompanies => "Shell Companies",
1857 Industry::Biotechnology => "Biotechnology",
1858 Industry::DiagnosticsAndResearch => "Diagnostics & Research",
1859 Industry::DrugManufacturersGeneral => "Drug Manufacturers - General",
1860 Industry::DrugManufacturersSpecialtyAndGeneric => {
1861 "Drug Manufacturers - Specialty & Generic"
1862 }
1863 Industry::HealthInformationServices => "Health Information Services",
1864 Industry::HealthcarePlans => "Healthcare Plans",
1865 Industry::MedicalCareFacilities => "Medical Care Facilities",
1866 Industry::MedicalDevices => "Medical Devices",
1867 Industry::MedicalDistribution => "Medical Distribution",
1868 Industry::MedicalInstrumentsAndSupplies => "Medical Instruments & Supplies",
1869 Industry::PharmaceuticalRetailers => "Pharmaceutical Retailers",
1870 Industry::AerospaceAndDefense => "Aerospace & Defense",
1871 Industry::BuildingMaterials => "Building Materials",
1872 Industry::BuildingProductsAndEquipment => "Building Products & Equipment",
1873 Industry::BusinessEquipmentAndSupplies => "Business Equipment & Supplies",
1874 Industry::ChemicalManufacturing => "Chemical Manufacturing",
1875 Industry::Chemicals => "Chemicals",
1876 Industry::Conglomerates => "Conglomerates",
1877 Industry::ConsultingServices => "Consulting Services",
1878 Industry::ElectricalEquipmentAndParts => "Electrical Equipment & Parts",
1879 Industry::EngineeringAndConstruction => "Engineering & Construction",
1880 Industry::FarmAndHeavyConstructionMachinery => {
1881 "Farm & Heavy Construction Machinery"
1882 }
1883 Industry::IndustrialDistribution => "Industrial Distribution",
1884 Industry::InfrastructureOperations => "Infrastructure Operations",
1885 Industry::IntegratedFreightAndLogistics => "Integrated Freight & Logistics",
1886 Industry::ManufacturingDiversified => "Manufacturing - Diversified",
1887 Industry::MarinePortsAndServices => "Marine Ports & Services",
1888 Industry::MarineShipping => "Marine Shipping",
1889 Industry::MetalFabrication => "Metal Fabrication",
1890 Industry::PaperAndPaperProducts => "Paper & Paper Products",
1891 Industry::PollutionAndTreatmentControls => "Pollution & Treatment Controls",
1892 Industry::Railroads => "Railroads",
1893 Industry::RentalAndLeasingServices => "Rental & Leasing Services",
1894 Industry::SecurityAndProtectionServices => "Security & Protection Services",
1895 Industry::SpecialtyBusinessServices => "Specialty Business Services",
1896 Industry::SpecialtyChemicals => "Specialty Chemicals",
1897 Industry::SpecialtyIndustrialMachinery => "Specialty Industrial Machinery",
1898 Industry::StaffingAndEmploymentServices => "Staffing & Employment Services",
1899 Industry::ToolsAndAccessories => "Tools & Accessories",
1900 Industry::Trucking => "Trucking",
1901 Industry::WasteManagement => "Waste Management",
1902 Industry::RealEstateDevelopment => "Real Estate - Development",
1903 Industry::RealEstateDiversified => "Real Estate - Diversified",
1904 Industry::RealEstateServices => "Real Estate Services",
1905 Industry::ReitDiversified => "REIT - Diversified",
1906 Industry::ReitHealthcareFacilities => "REIT - Healthcare Facilities",
1907 Industry::ReitHotelAndMotel => "REIT - Hotel & Motel",
1908 Industry::ReitIndustrial => "REIT - Industrial",
1909 Industry::ReitMortgage => "REIT - Mortgage",
1910 Industry::ReitOffice => "REIT - Office",
1911 Industry::ReitResidential => "REIT - Residential",
1912 Industry::ReitRetail => "REIT - Retail",
1913 Industry::ReitSpecialty => "REIT - Specialty",
1914 Industry::CommunicationEquipment => "Communication Equipment",
1915 Industry::ComputerHardware => "Computer Hardware",
1916 Industry::ConsumerElectronics => "Consumer Electronics",
1917 Industry::DataAnalytics => "Data Analytics",
1918 Industry::ElectronicComponents => "Electronic Components",
1919 Industry::ElectronicsAndComputerDistribution => {
1920 "Electronics & Computer Distribution"
1921 }
1922 Industry::HardwareAndSoftwareDistribution => "Hardware & Software Distribution",
1923 Industry::InformationTechnologyServices => "Information Technology Services",
1924 Industry::InternetContentAndInformation => "Internet Content & Information",
1925 Industry::ScientificAndTechnicalInstruments => "Scientific & Technical Instruments",
1926 Industry::SemiconductorEquipmentAndMaterials => {
1927 "Semiconductor Equipment & Materials"
1928 }
1929 Industry::Semiconductors => "Semiconductors",
1930 Industry::SoftwareApplication => "Software - Application",
1931 Industry::SoftwareInfrastructure => "Software - Infrastructure",
1932 Industry::Broadcasting => "Broadcasting",
1933 Industry::Entertainment => "Entertainment",
1934 Industry::Publishing => "Publishing",
1935 Industry::TelecomServices => "Telecom Services",
1936 Industry::UtilitiesDiversified => "Utilities - Diversified",
1937 Industry::UtilitiesIndependentPowerProducers => {
1938 "Utilities - Independent Power Producers"
1939 }
1940 Industry::UtilitiesRegulatedElectric => "Utilities - Regulated Electric",
1941 Industry::UtilitiesRegulatedGas => "Utilities - Regulated Gas",
1942 Industry::UtilitiesRegulatedWater => "Utilities - Regulated Water",
1943 Industry::UtilitiesRenewable => "Utilities - Renewable",
1944 Industry::ClosedEndFundDebt => "Closed-End Fund - Debt",
1945 Industry::ClosedEndFundEquity => "Closed-End Fund - Equity",
1946 Industry::ClosedEndFundForeign => "Closed-End Fund - Foreign",
1947 Industry::ExchangeTradedFund => "Exchange Traded Fund",
1948 }
1949 }
1950 }
1951
1952 impl AsRef<str> for Industry {
1953 fn as_ref(&self) -> &str {
1955 self.as_slug()
1956 }
1957 }
1958
1959 impl From<Industry> for String {
1960 fn from(v: Industry) -> Self {
1962 v.screener_value().to_string()
1963 }
1964 }
1965}
1966
1967pub mod exchange_codes {
1984 #[non_exhaustive]
1986 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1987 pub enum ExchangeCode {
1988 Ase,
1991 Bts,
1993 Ncm,
1995 Ngm,
1997 Nms,
1999 Nyq,
2001 Pcx,
2003 Pnk,
2005 Nas,
2008 Asx,
2011 Bse,
2013 Hkg,
2015 Krx,
2017 Lse,
2019 Nsi,
2021 Shh,
2023 Shz,
2025 Tyo,
2027 Tor,
2029 Ger,
2031 }
2032
2033 impl ExchangeCode {
2034 pub fn as_str(self) -> &'static str {
2036 match self {
2037 ExchangeCode::Ase => "ASE",
2038 ExchangeCode::Bts => "BTS",
2039 ExchangeCode::Ncm => "NCM",
2040 ExchangeCode::Ngm => "NGM",
2041 ExchangeCode::Nms => "NMS",
2042 ExchangeCode::Nyq => "NYQ",
2043 ExchangeCode::Pcx => "PCX",
2044 ExchangeCode::Pnk => "PNK",
2045 ExchangeCode::Nas => "NAS",
2046 ExchangeCode::Asx => "ASX",
2047 ExchangeCode::Bse => "BSE",
2048 ExchangeCode::Hkg => "HKG",
2049 ExchangeCode::Krx => "KRX",
2050 ExchangeCode::Lse => "LSE",
2051 ExchangeCode::Nsi => "NSI",
2052 ExchangeCode::Shh => "SHH",
2053 ExchangeCode::Shz => "SHZ",
2054 ExchangeCode::Tyo => "TYO",
2055 ExchangeCode::Tor => "TOR",
2056 ExchangeCode::Ger => "GER",
2057 }
2058 }
2059 }
2060
2061 impl From<ExchangeCode> for String {
2062 fn from(v: ExchangeCode) -> Self {
2063 v.as_str().to_string()
2064 }
2065 }
2066}
2067
2068#[cfg(test)]
2069mod tests {
2070 use super::*;
2071
2072 #[test]
2073 fn test_interval_as_str() {
2074 assert_eq!(Interval::OneMinute.as_str(), "1m");
2075 assert_eq!(Interval::FiveMinutes.as_str(), "5m");
2076 assert_eq!(Interval::OneDay.as_str(), "1d");
2077 assert_eq!(Interval::OneWeek.as_str(), "1wk");
2078 }
2079
2080 #[test]
2081 fn test_time_range_as_str() {
2082 assert_eq!(TimeRange::OneDay.as_str(), "1d");
2083 assert_eq!(TimeRange::OneMonth.as_str(), "1mo");
2084 assert_eq!(TimeRange::OneYear.as_str(), "1y");
2085 assert_eq!(TimeRange::Max.as_str(), "max");
2086 }
2087}