MCPcopy
hub / github.com/JerBouma/FinanceDatabase / select

Method select

financedatabase/Equities.py:23–222  ·  view source on GitHub ↗

Retrieve equity data based on specified criteria. This method allows you to retrieve data for specific equities based on a combination of country, sector, industry group, and industry filters. You can also exclude exchanges from the search. If no input criteria are

(
        self,
        country: str | list | None = None,
        sector: str | list | None = None,
        industry_group: str | list | None = None,
        industry: str | list | None = None,
        currency: str | list | None = None,
        exchange: str | list | None = None,
        mic: str | list | None = None,
        market: str | list | None = None,
        market_cap: str | list | None = None,
        only_primary_listing: bool = False,
        exclude_delisted: bool = True,
    )

Source from the content-addressed store, hash-verified

21 FILE_NAME = "equities.bz2"
22
23 def select(
24 self,
25 country: str | list | None = None,
26 sector: str | list | None = None,
27 industry_group: str | list | None = None,
28 industry: str | list | None = None,
29 currency: str | list | None = None,
30 exchange: str | list | None = None,
31 mic: str | list | None = None,
32 market: str | list | None = None,
33 market_cap: str | list | None = None,
34 only_primary_listing: bool = False,
35 exclude_delisted: bool = True,
36 ) -> FinanceFrame:
37 """
38 Retrieve equity data based on specified criteria.
39
40 This method allows you to retrieve data for specific equities based on a combination
41 of country, sector, industry group, and industry filters. You can also exclude
42 exchanges from the search. If no input criteria are provided, it returns data for all equities.
43
44 Args:
45 country (str | list | None): Specific country or list of countries to filter equities.
46 If not provided, returns data for all countries.
47 sector (str | list | None): Specific sector or list of sectors to filter equities.
48 If not provided, returns data for all sectors.
49 industry_group (str | list | None): Specific industry group or list of industry groups
50 to filter equities. If not provided, returns data for all industry groups.
51 industry (str | list | None): Specific industry or list of industries to filter equities.
52 If not provided, returns data for all industries.
53 currency (str | list | None): Specific currency or list of currencies to filter equities.
54 If not provided, returns data for all currencies.
55 exchange (str | list | None): Specific exchange or list of exchanges to filter equities.
56 If not provided, returns data for all exchanges.
57 mic (str | list | None): Specific ISO 10383 MIC code or list of MIC codes to filter
58 equities. If not provided, returns data for all MIC codes.
59 market (str | list | None): Specific market or list of markets to filter equities.
60 If not provided, returns data for all markets.
61 market_cap (str | list | None): Specific market cap or list of market caps to filter equities.
62 If not provided, returns data for all market caps.
63 only_primary_listing (bool, optional): Whether to only include the primary listing.
64 If False, you will receive data for equities from different exchanges.
65 Default is False.
66 exclude_delisted (bool, optional): Whether to exclude delisted equities.
67 If True, delisted equities will be excluded from the results.
68 Default is True.
69 Raises:
70 ValueError: If any of the specified criteria are not available in the database.
71 Please check the available options using the 'show_options' method.
72
73 Returns:
74 FinanceFrame:
75 A DataFrame containing equity data matching the specified input criteria.
76 """
77 equities = self.data.copy(deep=True)
78
79 if exclude_delisted:
80 equities = equities[~equities["delisted"]]

Callers 1

show_optionsMethod · 0.95

Calls 2

show_optionsMethod · 0.95
FinanceFrameClass · 0.85

Tested by

no test coverage detected