Screener Module Documentation

Screener

A class representing a Screener object for querying financial instruments.

__new__

Create a new Screener object.

Parameters:

  • quote_type (str): The type of financial instrument to screen. Options are:

    • "EQUITY"
    • "MUTUALFUND"
    • "ETF"
    • "INDEX"
    • "FUTURE"
    • "CRYPTO"
  • filters (List[str]): A list of JSON strings specifying filter criteria. Each filter should follow the format:

    {
        "operator": "<op>",
        "operands": ["<metric>", <value>[, <value2>]]
    }

    Where <op> can be one of:

    • "eq"
    • "gte"
    • "lte"
    • "gt"
    • "lt"
    • "btwn"
  • sort_field (str, optional): The metric to sort by.

  • sort_descending (bool, default=True): Whether to sort in descending order.

  • offset (int, default=0): The starting index of results to return.

  • size (int, default=250): The maximum number of results to return.

Returns:

  • Screener: A Screener object.

Example:

from finalytics import Screener

screener = Screener(
    quote_type="EQUITY",
    filters=[
        '{"operator": "eq", "operands": ["exchange", "NMS"]}'
    ],
    sort_field="intradaymarketcap",
    sort_descending=True,
    offset=0,
    size=100
)

Note: A full list of screener metrics for each category can be found at: https://github.com/Nnamdi-sys/finalytics/tree/main/rust/src/data/yahoo/screeners/screeners.json

symbols

Get the list of ticker symbols matching the screener criteria.

Returns:

  • List[str]: A list of ticker symbols, e.g., ["AAPL", "MSFT", "GOOGL"].

Example:

symbols = screener.symbols()
print(symbols)
['NVDA', 'GOOGL', 'GOOG', 'AAPL', 'MSFT', 'AMZN', 'AVGO', 'META', 'TSLA', 'WMT', 'MU', 'AMD', 'ASML', 'INTC', 'COST', 'NFLX', 'CSCO', 'PLTR', 'LRCX', 'AMAT', 'TXN', 'LIN', 'KLAC', 'ARM', 'PEP', 'TMUS', 'ADI', 'QCOM', 'AMGN', 'GILD', 'SNDK', 'ISRG', 'SHOP', 'STX', 'APP', 'WDC', 'PANW', 'MRVL', 'PDD', 'HON', 'BKNG', 'SBUX', 'CEG', 'CRWD', 'SNY', 'VRTX', 'INTU', 'EQIX', 'CME', 'ADBE', 'CMCSA', 'MAR', 'SNPS', 'CDNS', 'MELI', 'ADP', 'CSX', 'ABNB', 'ORLY', 'MPWR', 'MDLZ', 'MNST', 'NTES', 'AEP', 'NXPI', 'REGN', 'DASH', 'ROST', 'CTAS', 'BKR', 'WBD', 'HOOD', 'LITE', 'PCAR', 'FTNT', 'CRWV', 'MSTR', 'FANG', 'TER', 'NDAQ', 'XEL', 'FAST', 'EA', 'MCHP', 'ADSK', 'COIN', 'FER', 'ARGX', 'EXC', 'DDOG', 'EBAY', 'FITB', 'PYPL', 'IDXX', 'ODFL', 'BIDU', 'TRI', 'CCEP', 'JD', 'ALNY']
overview

Get a Polars DataFrame containing the overview of screened instruments.

Returns:

  • DataFrame: A Polars DataFrame with overview data.

Example:

overview_df = screener.overview()
print(overview_df)
shape: (100, 18)
┌─────────┬────────────┬────────────┬────────┬───┬────────────┬───────────┬────────────┬───────────┐
│ Symbol  ┆ Name       ┆ Exchange   ┆ Region ┆ … ┆ EPS        ┆ Price/EPS ┆ Price/Book ┆ Analyst   │
│ ---     ┆ ---        ┆ ---        ┆ ---    ┆   ┆ (Current   ┆ ---       ┆ ---        ┆ Rating    │
│ str     ┆ str        ┆ str        ┆ str    ┆   ┆ Year)      ┆ f64       ┆ f64        ┆ ---       │
│         ┆            ┆            ┆        ┆   ┆ ---        ┆           ┆            ┆ str       │
│         ┆            ┆            ┆        ┆   ┆ f64        ┆           ┆            ┆           │
╞═════════╪════════════╪════════════╪════════╪═══╪════════════╪═══════════╪════════════╪═══════════╡
│ "NVDA"  ┆ "NVIDIA    ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 8.33967    ┆ 23.930204 ┆ 30.835909  ┆ "1.3 -    │
│         ┆ Corporatio ┆            ┆        ┆   ┆            ┆           ┆            ┆ Strong    │
│         ┆ n"         ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ "GOOGL" ┆ "Alphabet  ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 11.71654   ┆ 32.842457 ┆ 11.20135   ┆ "1.4 -    │
│         ┆ Inc."      ┆            ┆        ┆   ┆            ┆           ┆            ┆ Strong    │
│         ┆            ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ "GOOG"  ┆ "Alphabet  ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 11.70297   ┆ 32.63616  ┆ 11.118097  ┆ "1.4 -    │
│         ┆ Inc."      ┆            ┆        ┆   ┆            ┆           ┆            ┆ Strong    │
│         ┆            ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ "AAPL"  ┆ "Apple     ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 8.51816    ┆ 31.855473 ┆ 45.24008   ┆ "1.9 -    │
│         ┆ Inc."      ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ "MSFT"  ┆ "Microsoft ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 16.68008   ┆ 24.447124 ┆ 7.750261   ┆ "1.3 -    │
│         ┆ Corporatio ┆            ┆        ┆   ┆            ┆           ┆            ┆ Strong    │
│         ┆ n"         ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ …       ┆ …          ┆ …          ┆ …      ┆ … ┆ …          ┆ …         ┆ …          ┆ …         │
│ "BIDU"  ┆ "Baidu,    ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 53.66615   ┆ 2.3577247 ┆ 1.1052791  ┆ "1.5 -    │
│         ┆ Inc."      ┆            ┆        ┆   ┆            ┆           ┆            ┆ Strong    │
│         ┆            ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ "TRI"   ┆ "Thomson   ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 4.40535    ┆ 21.721315 ┆ 3.6071322  ┆ "1.8 -    │
│         ┆ Reuters    ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│         ┆ Corporatio ┆            ┆        ┆   ┆            ┆           ┆            ┆           │
│         ┆ n"         ┆            ┆        ┆   ┆            ┆           ┆            ┆           │
│ "CCEP"  ┆ "Coca-Cola ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 4.45082    ┆ 21.24777  ┆ 4.6193624  ┆ "1.8 -    │
│         ┆ Europacifi ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│         ┆ c Partner… ┆            ┆        ┆   ┆            ┆           ┆            ┆           │
│ "JD"    ┆ "JD.com,   ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 20.85029   ┆ 1.4541764 ┆ 1.263212   ┆ "1.3 -    │
│         ┆ Inc."      ┆            ┆        ┆   ┆            ┆           ┆            ┆ Strong    │
│         ┆            ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│ "ALNY"  ┆ "Alnylam   ┆ "NasdaqGS" ┆ "US"   ┆ … ┆ 7.9        ┆ 39.17595  ┆ 51.91043   ┆ "1.8 -    │
│         ┆ Pharmaceut ┆            ┆        ┆   ┆            ┆           ┆            ┆ Buy"      │
│         ┆ icals,     ┆            ┆        ┆   ┆            ┆           ┆            ┆           │
│         ┆ Inc.…      ┆            ┆        ┆   ┆            ┆           ┆            ┆           │
└─────────┴────────────┴────────────┴────────┴───┴────────────┴───────────┴────────────┴───────────┘
metrics

Get a Polars DataFrame containing detailed metrics for screened instruments.

Returns:

  • DataFrame: A Polars DataFrame with detailed metrics.

Example:

metrics_df = screener.metrics()
print(metrics_df)
shape: (100, 51)
┌────────┬──────────┬────────────┬────────────┬───┬────────────┬───────────┬───────────┬───────────┐
│ Symbol ┆ Currency ┆ Current    ┆ Day Range  ┆ … ┆ Analyst    ┆ Average   ┆ High/Low  ┆ Analyst   │
│ ---    ┆ ---      ┆ Price      ┆ ---        ┆   ┆ Consensus  ┆ Target    ┆ Target    ┆ Count     │
│ str    ┆ str      ┆ ---        ┆ str        ┆   ┆ ---        ┆ ---       ┆ ---       ┆ ---       │
│        ┆          ┆ str        ┆            ┆   ┆ str        ┆ str       ┆ str       ┆ str       │
╞════════╪══════════╪════════════╪════════════╪═══╪════════════╪═══════════╪═══════════╪═══════════╡
│ NVDA   ┆ USD      ┆ 199.57     ┆ 210.30 -   ┆ … ┆ strong_buy ┆ Median:   ┆ 380.00 -  ┆ 57        │
│        ┆          ┆            ┆ 198.70     ┆   ┆            ┆ 265.00,   ┆ 140.00    ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 269.17    ┆           ┆           │
│ GOOGL  ┆ USD      ┆ 384.80     ┆ 385.83 -   ┆ … ┆ strong_buy ┆ Median:   ┆ 443.00 -  ┆ 56        │
│        ┆          ┆            ┆ 365.82     ┆   ┆            ┆ 387.50,   ┆ 185.00    ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 378.50    ┆           ┆           │
│ GOOG   ┆ USD      ┆ 381.94     ┆ 382.63 -   ┆ … ┆ strong_buy ┆ Median:   ┆ 405.00 -  ┆ 18        │
│        ┆          ┆            ┆ 363.09     ┆   ┆            ┆ 377.50,   ┆ 185.00    ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 364.00    ┆           ┆           │
│ AAPL   ┆ USD      ┆ 271.35     ┆ 275.94 -   ┆ … ┆ buy        ┆ Median:   ┆ 350.00 -  ┆ 42        │
│        ┆          ┆            ┆ 268.14     ┆   ┆            ┆ 300.00,   ┆ 215.00    ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 298.46    ┆           ┆           │
│ MSFT   ┆ USD      ┆ 407.78     ┆ 414.42 -   ┆ … ┆ strong_buy ┆ Median:   ┆ 730.00 -  ┆ 54        │
│        ┆          ┆            ┆ 398.01     ┆   ┆            ┆ 577.50,   ┆ 392.00    ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 570.72    ┆           ┆           │
│ …      ┆ …        ┆ …          ┆ …          ┆ … ┆ …          ┆ …         ┆ …         ┆ …         │
│ BIDU   ┆ USD      ┆ 126.53     ┆ 126.85 -   ┆ … ┆ strong_buy ┆ Median:   ┆ 271.63 -  ┆ 33        │
│        ┆          ┆            ┆ 121.62     ┆   ┆            ┆ 179.71,   ┆ 89.41     ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 175.06    ┆           ┆           │
│ TRI    ┆ USD      ┆ 95.69      ┆ 96.06 -    ┆ … ┆ buy        ┆ Median:   ┆ 183.00 -  ┆ 11        │
│        ┆          ┆            ┆ 91.80      ┆   ┆            ┆ 124.00,   ┆ 87.00     ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 125.41    ┆           ┆           │
│ CCEP   ┆ USD      ┆ 94.57      ┆ 95.69 -    ┆ … ┆ buy        ┆ Median:   ┆ 114.33 -  ┆ 10        │
│        ┆          ┆            ┆ 94.33      ┆   ┆            ┆ 108.82,   ┆ 87.34     ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 105.99    ┆           ┆           │
│ JD     ┆ USD      ┆ 30.32      ┆ 30.46 -    ┆ … ┆ strong_buy ┆ Median:   ┆ 60.70 -   ┆ 36        │
│        ┆          ┆            ┆ 29.70      ┆   ┆            ┆ 38.84,    ┆ 24.96     ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 39.72     ┆           ┆           │
│ ALNY   ┆ USD      ┆ 309.49     ┆ 317.55 -   ┆ … ┆ buy        ┆ Median:   ┆ 566.00 -  ┆ 25        │
│        ┆          ┆            ┆ 287.00     ┆   ┆            ┆ 448.00,   ┆ 310.00    ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ Mean:     ┆           ┆           │
│        ┆          ┆            ┆            ┆   ┆            ┆ 449.12    ┆           ┆           │
└────────┴──────────┴────────────┴────────────┴───┴────────────┴───────────┴───────────┴───────────┘