Tickers Module Documentation

Tickers

A class representing a Tickers object.

__new__

Create a new Tickers object.

Parameters:

  • symbols (List[str]): A list of ticker symbols.
  • start_date (str): The start date of the time period in the format YYYY-MM-DD.
  • end_date (str): The end date of the time period in the format YYYY-MM-DD.
  • interval (str): The interval of the data (2m, 5m, 15m, 30m, 1h, 1d, 1wk, 1mo, 3mo).
  • benchmark_symbol (str): The ticker symbol of the benchmark to compare against.
  • confidence_level (float): The confidence level for the VaR and ES calculations.
  • risk_free_rate (float): The risk free rate to use in the calculations.

Returns:

  • Tickers: A Tickers object.

Example:

from finalytics import Tickers

tickers = Tickers(symbols=["AAPL", "GOOG", "MSFT", "NVDA", "BTC-USD"],
                  start_date="2020-01-01",
                  end_date="2024-01-01",
                  interval="1d",
                  benchmark_symbol="^GSPC",
                  confidence_level=0.95,
                  risk_free_rate=0.02)
get_summary_stats

Fetch the Ticker Summary Stats Data for all tickers.

Returns:

  • DataFrame: Polars DataFrame containing summary statistics.

Example:

summary_stats = tickers.get_summary_stats()
print(summary_stats)
shape: (5, 29)
┌─────────┬────────────┬────────────┬──────────┬───┬───────────┬───────────┬───────────┬───────────┐
│ symbol  ┆ long_name  ┆ full_excha ┆ currency ┆ … ┆ book_valu ┆ price_to_ ┆ market_ca ┆ shares_ou │
│ ---     ┆ ---        ┆ nge_name   ┆ ---      ┆   ┆ e         ┆ book      ┆ p         ┆ tstanding │
│ str     ┆ str        ┆ ---        ┆ str      ┆   ┆ ---       ┆ ---       ┆ ---       ┆ ---       │
│         ┆            ┆ str        ┆          ┆   ┆ f64       ┆ f64       ┆ f64       ┆ f64       │
╞═════════╪════════════╪════════════╪══════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡
│ AAPL    ┆ Apple Inc. ┆ NasdaqGS   ┆ USD      ┆ … ┆ 3.767     ┆ 64.427925 ┆ 3.6686e12 ┆ 1.5116e10 │
│ GOOG    ┆ Alphabet   ┆ NasdaqGS   ┆ USD      ┆ … ┆ 25.613    ┆ 7.6285477 ┆ 2.3821e12 ┆ 5.5340e9  │
│         ┆ Inc.       ┆            ┆          ┆   ┆           ┆           ┆           ┆           │
│ MSFT    ┆ Microsoft  ┆ NasdaqGS   ┆ USD      ┆ … ┆ 38.693    ┆ 10.972527 ┆ 3.1566e12 ┆ 7.4349e9  │
│         ┆ Corporatio ┆            ┆          ┆   ┆           ┆           ┆           ┆           │
│         ┆ n          ┆            ┆          ┆   ┆           ┆           ┆           ┆           │
│ NVDA    ┆ NVIDIA Cor ┆ NasdaqGS   ┆ USD      ┆ … ┆ 1.744     ┆ 80.3383   ┆ 3.4313e12 ┆ 2.4490e10 │
│         ┆ poration   ┆            ┆          ┆   ┆           ┆           ┆           ┆           │
│ BTC-USD ┆ Bitcoin    ┆ CCC        ┆ USD      ┆ … ┆ 0.0       ┆ 0.0       ┆ 1.8102e12 ┆ 0.0       │
│         ┆ USD        ┆            ┆          ┆   ┆           ┆           ┆           ┆           │
└─────────┴────────────┴────────────┴──────────┴───┴───────────┴───────────┴───────────┴───────────┘
get_price_history

Fetch the OHLCV Data for all tickers.

Returns:

  • DataFrame: Polars DataFrame containing OHLCV data.

Example:

price_history = tickers.get_price_history()
print(price_history)
shape: (5_485, 8)
┌────────────┬─────────┬────────────┬────────────┬────────────┬────────────┬───────────┬───────────┐
│ timestamp  ┆ symbol  ┆ open       ┆ high       ┆ low        ┆ close      ┆ volume    ┆ adjclose  │
│ ---        ┆ ---     ┆ ---        ┆ ---        ┆ ---        ┆ ---        ┆ ---       ┆ ---       │
│ datetime[m ┆ str     ┆ f64        ┆ f64        ┆ f64        ┆ f64        ┆ f64       ┆ f64       │
│ s]         ┆         ┆            ┆            ┆            ┆            ┆           ┆           │
╞════════════╪═════════╪════════════╪════════════╪════════════╪════════════╪═══════════╪═══════════╡
│ 2020-01-02 ┆ AAPL    ┆ 74.059998  ┆ 75.150002  ┆ 73.797501  ┆ 75.087502  ┆ 1.354804e ┆ 72.796013 │
│ 00:00:00   ┆         ┆            ┆            ┆            ┆            ┆ 8         ┆           │
│ 2020-01-03 ┆ AAPL    ┆ 74.287498  ┆ 75.144997  ┆ 74.125     ┆ 74.357498  ┆ 1.463228e ┆ 72.088318 │
│ 00:00:00   ┆         ┆            ┆            ┆            ┆            ┆ 8         ┆           │
│ 2020-01-06 ┆ AAPL    ┆ 73.447502  ┆ 74.989998  ┆ 73.1875    ┆ 74.949997  ┆ 1.183872e ┆ 72.66272  │
│ 00:00:00   ┆         ┆            ┆            ┆            ┆            ┆ 8         ┆           │
│ 2020-01-07 ┆ AAPL    ┆ 74.959999  ┆ 75.224998  ┆ 74.370003  ┆ 74.597504  ┆ 1.08872e8 ┆ 72.320969 │
│ 00:00:00   ┆         ┆            ┆            ┆            ┆            ┆           ┆           │
│ 2020-01-08 ┆ AAPL    ┆ 74.290001  ┆ 76.110001  ┆ 74.290001  ┆ 75.797501  ┆ 1.320792e ┆ 73.48436  │
│ 00:00:00   ┆         ┆            ┆            ┆            ┆            ┆ 8         ┆           │
│ …          ┆ …       ┆ …          ┆ …          ┆ …          ┆ …          ┆ …         ┆ …         │
│ 2023-12-27 ┆ BTC-USD ┆ 42518.4687 ┆ 43683.1601 ┆ 42167.5820 ┆ 43442.8554 ┆ 2.5261e10 ┆ 43442.855 │
│ 00:00:00   ┆         ┆ 5          ┆ 56         ┆ 31         ┆ 69         ┆           ┆ 469       │
│ 2023-12-28 ┆ BTC-USD ┆ 43468.1992 ┆ 43804.7812 ┆ 42318.5507 ┆ 42627.8554 ┆ 2.2992e10 ┆ 42627.855 │
│ 00:00:00   ┆         ┆ 19         ┆ 5          ┆ 81         ┆ 69         ┆           ┆ 469       │
│ 2023-12-29 ┆ BTC-USD ┆ 42614.6445 ┆ 43124.3242 ┆ 41424.0625 ┆ 42099.4023 ┆ 2.6000e10 ┆ 42099.402 │
│ 00:00:00   ┆         ┆ 31         ┆ 19         ┆            ┆ 44         ┆           ┆ 344       │
│ 2023-12-30 ┆ BTC-USD ┆ 42091.7539 ┆ 42584.125  ┆ 41556.2265 ┆ 42156.9023 ┆ 1.6014e10 ┆ 42156.902 │
│ 00:00:00   ┆         ┆ 06         ┆            ┆ 62         ┆ 44         ┆           ┆ 344       │
│ 2023-12-31 ┆ BTC-USD ┆ 42152.0976 ┆ 42860.9375 ┆ 41998.2539 ┆ 42265.1875 ┆ 1.6397e10 ┆ 42265.187 │
│ 00:00:00   ┆         ┆ 56         ┆            ┆ 06         ┆            ┆           ┆ 5         │
└────────────┴─────────┴────────────┴────────────┴────────────┴────────────┴───────────┴───────────┘
get_options_chain

Fetch the Options Chain Data for all tickers.

Returns:

  • DataFrame: Polars DataFrame containing the options chain.

Example:

options_chain = tickers.get_options_chain()
print(options_chain)
shape: (14_176, 17)
┌────────────┬───────────┬──────┬────────┬───┬─────────────┬─────────────┬────────────┬────────────┐
│ expiration ┆ ttm       ┆ type ┆ symbol ┆ … ┆ contractSiz ┆ lastTradeDa ┆ impliedVol ┆ inTheMoney │
│ ---        ┆ ---       ┆ ---  ┆ ---    ┆   ┆ e           ┆ te          ┆ atility    ┆ ---        │
│ str        ┆ f64       ┆ str  ┆ str    ┆   ┆ ---         ┆ ---         ┆ ---        ┆ bool       │
│            ┆           ┆      ┆        ┆   ┆ str         ┆ datetime[ms ┆ f64        ┆            │
│            ┆           ┆      ┆        ┆   ┆             ┆ ]           ┆            ┆            │
╞════════════╪═══════════╪══════╪════════╪═══╪═════════════╪═════════════╪════════════╪════════════╡
│ 2025-01-10 ┆ 0.0       ┆ call ┆ AAPL   ┆ … ┆ REGULAR     ┆ 2024-12-27  ┆ 4.718754   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 16:41:06    ┆            ┆            │
│ 2025-01-10 ┆ 0.0       ┆ call ┆ AAPL   ┆ … ┆ REGULAR     ┆ 2024-11-29  ┆ 10.428226  ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 17:01:29    ┆            ┆            │
│ 2025-01-10 ┆ 0.0       ┆ call ┆ AAPL   ┆ … ┆ REGULAR     ┆ 2025-01-02  ┆ 4.242192   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 17:37:35    ┆            ┆            │
│ 2025-01-10 ┆ 0.0       ┆ call ┆ AAPL   ┆ … ┆ REGULAR     ┆ 2024-12-27  ┆ 4.589848   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 16:29:00    ┆            ┆            │
│ 2025-01-10 ┆ 0.0       ┆ call ┆ AAPL   ┆ … ┆ REGULAR     ┆ 2024-12-27  ┆ 4.539067   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 17:03:06    ┆            ┆            │
│ …          ┆ …         ┆ …    ┆ …      ┆ … ┆ …           ┆ …           ┆ …          ┆ …          │
│ 2027-01-15 ┆ 24.145861 ┆ put  ┆ NVDA   ┆ … ┆ REGULAR     ┆ 2025-01-07  ┆ 0.371283   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 15:32:14    ┆            ┆            │
│ 2027-01-15 ┆ 24.145861 ┆ put  ┆ NVDA   ┆ … ┆ REGULAR     ┆ 2024-12-16  ┆ 0.360877   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 14:31:51    ┆            ┆            │
│ 2027-01-15 ┆ 24.145861 ┆ put  ┆ NVDA   ┆ … ┆ REGULAR     ┆ 2025-01-07  ┆ 0.363471   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 19:21:58    ┆            ┆            │
│ 2027-01-15 ┆ 24.145861 ┆ put  ┆ NVDA   ┆ … ┆ REGULAR     ┆ 2025-01-07  ┆ 0.35987    ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 19:21:58    ┆            ┆            │
│ 2027-01-15 ┆ 24.145861 ┆ put  ┆ NVDA   ┆ … ┆ REGULAR     ┆ 2025-01-08  ┆ 0.357428   ┆ true       │
│            ┆           ┆      ┆        ┆   ┆             ┆ 17:24:09    ┆            ┆            │
└────────────┴───────────┴──────┴────────┴───┴─────────────┴─────────────┴────────────┴────────────┘
No Options Data for BTC-USD
get_news

Fetch the Historical News Headlines for all tickers.

Returns:

  • DataFrame: Polars DataFrame containing news headlines.

Example:

news = tickers.get_news()
print(news)
get_income_statement

Fetch the income statement for all tickers.

Parameters:

  • frequency (str): The frequency of the data (annual or quarterly).

Returns:

  • DataFrame: Polars DataFrame containing the income statement.

Example:

income_statement = tickers.get_income_statement(frequency="quarterly")
print(income_statement)
Error Fetching Data for BTC-USD: not found: asOfDate
shape: (52, 7)
┌─────────────────────────────┬────────┬───────────┬───────────┬───────────┬───────────┬───────────┐
│ Items                       ┆ symbol ┆ 2023Q3    ┆ 2023Q4    ┆ 2024Q1    ┆ 2024Q2    ┆ 2024Q3    │
│ ---                         ┆ ---    ┆ ---       ┆ ---       ┆ ---       ┆ ---       ┆ ---       │
│ str                         ┆ str    ┆ f64       ┆ f64       ┆ f64       ┆ f64       ┆ f64       │
╞═════════════════════════════╪════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Revenue                     ┆ AAPL   ┆ 8.9498e10 ┆ 1.1958e11 ┆ 9.0753e10 ┆ 8.5777e10 ┆ 9.4930e10 │
│ Cost of Goods Sold          ┆ AAPL   ┆ 4.9071e10 ┆ 6.4720e10 ┆ 4.8482e10 ┆ 4.6099e10 ┆ 5.1051e10 │
│ Gross Profit                ┆ AAPL   ┆ 4.0427e10 ┆ 5.4855e10 ┆ 4.2271e10 ┆ 3.9678e10 ┆ 4.3879e10 │
│ Operating Expenses          ┆ AAPL   ┆ 1.3458e10 ┆ 1.4482e10 ┆ 1.4371e10 ┆ 1.4326e10 ┆ 1.4288e10 │
│ EBITDA                      ┆ AAPL   ┆ 3.0653e10 ┆ 4.3221e10 ┆ 3.0736e10 ┆ 2.8202e10 ┆ 3.2502e10 │
│ …                           ┆ …      ┆ …         ┆ …         ┆ …         ┆ …         ┆ …         │
│ Interest Expense            ┆ NVDA   ┆ 6.3e7     ┆ 6.3e7     ┆ 6.4e7     ┆ 6.1e7     ┆ 6.1e7     │
│ Income Tax Expense          ┆ NVDA   ┆ 1.2790e9  ┆ 1.8210e9  ┆ 2.3980e9  ┆ 2.6150e9  ┆ 3.0070e9  │
│ Net Income                  ┆ NVDA   ┆ 9.2430e9  ┆ 1.2285e10 ┆ 1.4881e10 ┆ 1.6599e10 ┆ 1.9309e10 │
│ Earnings per Share - Basic  ┆ NVDA   ┆ 0.25      ┆ 0.37      ┆ 0.604     ┆ 0.68      ┆ 0.79      │
│ Earnings per Share -        ┆ NVDA   ┆ 0.25      ┆ 0.37      ┆ 0.598     ┆ 0.67      ┆ 0.78      │
│ Diluted                     ┆        ┆           ┆           ┆           ┆           ┆           │
└─────────────────────────────┴────────┴───────────┴───────────┴───────────┴───────────┴───────────┘
get_balance_sheet

Fetch the balance sheet for all tickers.

Parameters:

  • frequency (str): The frequency of the data (annual or quarterly).

Returns:

  • DataFrame: Polars DataFrame containing the balance sheet.

Example:

balance_sheet = tickers.get_balance_sheet(frequency="quarterly")
print(balance_sheet)
Error Fetching Data for BTC-USD: not found: asOfDate
shape: (86, 7)
┌─────────────────────────────┬────────┬───────────┬───────────┬───────────┬───────────┬───────────┐
│ Items                       ┆ symbol ┆ 2023Q3    ┆ 2023Q4    ┆ 2024Q1    ┆ 2024Q2    ┆ 2024Q3    │
│ ---                         ┆ ---    ┆ ---       ┆ ---       ┆ ---       ┆ ---       ┆ ---       │
│ str                         ┆ str    ┆ f64       ┆ f64       ┆ f64       ┆ f64       ┆ f64       │
╞═════════════════════════════╪════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Cash and Cash Equivalents   ┆ AAPL   ┆ 2.9965e10 ┆ 4.0760e10 ┆ 3.2695e10 ┆ 2.5565e10 ┆ 2.9943e10 │
│ Accounts Receivable         ┆ AAPL   ┆ 2.9508e10 ┆ 2.3194e10 ┆ 2.1837e10 ┆ 2.2795e10 ┆ 3.3410e10 │
│ Inventories                 ┆ AAPL   ┆ 6.3310e9  ┆ 6.5110e9  ┆ 6.2320e9  ┆ 6.1650e9  ┆ 7.2860e9  │
│ Other Current Assets        ┆ AAPL   ┆ 1.4695e10 ┆ 1.3979e10 ┆ 1.3884e10 ┆ 1.4297e10 ┆ 1.4287e10 │
│ Total Current Assets        ┆ AAPL   ┆ 1.4357e11 ┆ 1.4369e11 ┆ 1.2842e11 ┆ 1.2544e11 ┆ 1.5299e11 │
│ …                           ┆ …      ┆ …         ┆ …         ┆ …         ┆ …         ┆ …         │
│ Total Liabilities           ┆ NVDA   ┆ 2.0883e10 ┆ 2.2750e10 ┆ 2.7930e10 ┆ 2.7070e10 ┆ 3.0114e10 │
│ Common Stock                ┆ NVDA   ┆ 2e6       ┆ 2e6       ┆ 2e6       ┆ 2.5e7     ┆ 2.5e7     │
│ Retained Earnings           ┆ NVDA   ┆ 2.0360e10 ┆ 2.9817e10 ┆ 3.6598e10 ┆ 4.5961e10 ┆ 5.3950e10 │
│ Total Equity                ┆ NVDA   ┆ 3.3265e10 ┆ 4.2978e10 ┆ 4.9142e10 ┆ 5.8157e10 ┆ 6.5899e10 │
│ Total Liabilities and       ┆ NVDA   ┆ 3.3265e10 ┆ 4.2978e10 ┆ 4.9142e10 ┆ 5.8157e10 ┆ 6.5899e10 │
│ Equity                      ┆        ┆           ┆           ┆           ┆           ┆           │
└─────────────────────────────┴────────┴───────────┴───────────┴───────────┴───────────┴───────────┘
get_cashflow_statement

Fetch the cash flow statement for all tickers.

Parameters:

  • frequency (str): The frequency of the data (annual or quarterly).

Returns:

  • DataFrame: Polars DataFrame containing the cash flow statement.

Example:

cashflow_statement = tickers.get_cashflow_statement(frequency="quarterly")
print(cashflow_statement)
Error Fetching Data for BTC-USD: not found: asOfDate
shape: (114, 7)
┌───────────────────────────┬────────┬───────────┬───────────┬───────────┬────────────┬────────────┐
│ Items                     ┆ symbol ┆ 2023Q3    ┆ 2023Q4    ┆ 2024Q1    ┆ 2024Q2     ┆ 2024Q3     │
│ ---                       ┆ ---    ┆ ---       ┆ ---       ┆ ---       ┆ ---        ┆ ---        │
│ str                       ┆ str    ┆ f64       ┆ f64       ┆ f64       ┆ f64        ┆ f64        │
╞═══════════════════════════╪════════╪═══════════╪═══════════╪═══════════╪════════════╪════════════╡
│ Net Income from           ┆ AAPL   ┆ 2.2956e10 ┆ 3.3916e10 ┆ 2.3636e10 ┆ 2.1448e10  ┆ 1.4736e10  │
│ Continuing Ope…           ┆        ┆           ┆           ┆           ┆            ┆            │
│ Depreciation,             ┆ AAPL   ┆ 2.6530e9  ┆ 2.8480e9  ┆ 2.8360e9  ┆ 2.8500e9   ┆ 2.9110e9   │
│ Amortization, an…         ┆        ┆           ┆           ┆           ┆            ┆            │
│ Stock-Based Compensation  ┆ AAPL   ┆ 2.6250e9  ┆ 2.9970e9  ┆ 2.9640e9  ┆ 2.8690e9   ┆ 2.8580e9   │
│ Changes in Working        ┆ AAPL   ┆ -6.0600e9 ┆ 1.1230e9  ┆ -5.7640e9 ┆ 1.6840e9   ┆ 6.6080e9   │
│ Capital                   ┆        ┆           ┆           ┆           ┆            ┆            │
│ Cash Flow from Continuing ┆ AAPL   ┆ 2.1598e10 ┆ 3.9895e10 ┆ 2.2690e10 ┆ 2.8858e10  ┆ 2.6811e10  │
│ Oper…                     ┆        ┆           ┆           ┆           ┆            ┆            │
│ …                         ┆ …      ┆ …         ┆ …         ┆ …         ┆ …          ┆ …          │
│ Operating Cash Flow       ┆ NVDA   ┆ 7.3320e9  ┆ 1.1499e10 ┆ 1.5345e10 ┆ 1.4488e10  ┆ 1.7627e10  │
│ Investing Cash Flow       ┆ NVDA   ┆ -3.1700e9 ┆ -6.1090e9 ┆ -5.6930e9 ┆ -3.1840e9  ┆ -4.3460e9  │
│ Financing Cash Flow       ┆ NVDA   ┆ -4.5250e9 ┆ -3.6290e9 ┆ -9.3450e9 ┆ -1.0320e10 ┆ -1.2745e10 │
│ Ending Cash Position      ┆ NVDA   ┆ 5.5190e9  ┆ 7.2800e9  ┆ 7.5870e9  ┆ 8.5710e9   ┆ 9.1070e9   │
│ Free Cash Flow            ┆ NVDA   ┆ 7.0540e9  ┆ 1.1245e10 ┆ 1.4976e10 ┆ 1.3511e10  ┆ 1.6814e10  │
└───────────────────────────┴────────┴───────────┴───────────┴───────────┴────────────┴────────────┘
get_financial_ratios

Fetch the financial ratios for all tickers.

Parameters:

  • frequency (str): The frequency of the data (annual or quarterly).

Returns:

  • DataFrame: Polars DataFrame containing the financial ratios.

Example:

financial_ratios = tickers.get_financial_ratios(frequency="quarterly")
print(financial_ratios)
Error Fetching Data for BTC-USD: not found: asOfDate
shape: (84, 7)
┌─────────────────────────┬────────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ Items                   ┆ symbol ┆ 2023Q3   ┆ 2023Q4   ┆ 2024Q1   ┆ 2024Q2   ┆ 2024Q3   │
│ ---                     ┆ ---    ┆ ---      ┆ ---      ┆ ---      ┆ ---      ┆ ---      │
│ str                     ┆ str    ┆ f64      ┆ f64      ┆ f64      ┆ f64      ┆ f64      │
╞═════════════════════════╪════════╪══════════╪══════════╪══════════╪══════════╪══════════╡
│ Gross Profit Margin     ┆ AAPL   ┆ 0.451708 ┆ 0.45875  ┆ 0.465781 ┆ 0.462572 ┆ 0.462225 │
│ Operating Profit Margin ┆ AAPL   ┆ 0.312856 ┆ 0.337637 ┆ 0.307428 ┆ 0.295557 ┆ 0.311714 │
│ Net Profit Margin       ┆ AAPL   ┆ 0.256497 ┆ 0.283638 ┆ 0.260443 ┆ 0.250044 ┆ 0.15523  │
│ Return on Assets        ┆ AAPL   ┆ 0.065108 ┆ 0.09594  ┆ 0.070051 ┆ 0.064678 ┆ 0.040375 │
│ Return on Equity        ┆ AAPL   ┆ 0.369388 ┆ 0.457706 ┆ 0.31857  ┆ 0.321521 ┆ 0.258753 │
│ …                       ┆ …      ┆ …        ┆ …        ┆ …        ┆ …        ┆ …        │
│ Price to Earnings       ┆ NVDA   ┆ 4.513902 ┆ 4.186976 ┆ 3.870842 ┆ 4.013374 ┆ 3.851106 │
│ Price to Book           ┆ NVDA   ┆ 1.254231 ┆ 1.196822 ┆ 1.172154 ┆ 1.145485 ┆ 1.128409 │
│ Price to Sales          ┆ NVDA   ┆ 2.302539 ┆ 2.32715  ┆ 2.211719 ┆ 2.217643 ┆ 2.119634 │
│ Price to Cashflow       ┆ NVDA   ┆ 5.690398 ┆ 4.473172 ┆ 3.753796 ┆ 4.59815  ┆ 4.218585 │
│ Price to Free Cashflow  ┆ NVDA   ┆ 5.914658 ┆ 4.574211 ┆ 3.846287 ┆ 4.930649 ┆ 4.422565 │
└─────────────────────────┴────────┴──────────┴──────────┴──────────┴──────────┴──────────┘
returns

Compute the returns for all tickers.

Returns:

  • DataFrame: Polars DataFrame containing the returns.

Example:

returns = tickers.returns()
print(returns)
shape: (1_461, 6)
┌─────────────────────┬───────────┬───────────┬───────────┬───────────┬───────────┐
│ timestamp           ┆ AAPL      ┆ GOOG      ┆ MSFT      ┆ NVDA      ┆ BTC-USD   │
│ ---                 ┆ ---       ┆ ---       ┆ ---       ┆ ---       ┆ ---       │
│ str                 ┆ f64       ┆ f64       ┆ f64       ┆ f64       ┆ f64       │
╞═════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ 2020-01-01 00:00:00 ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       │
│ 2020-01-02 00:00:00 ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ -2.981929 │
│ 2020-01-03 00:00:00 ┆ -0.972162 ┆ -0.490721 ┆ -1.24518  ┆ -1.600576 ┆ 5.145166  │
│ 2020-01-04 00:00:00 ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.895487  │
│ 2020-01-05 00:00:00 ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.008915  │
│ …                   ┆ …         ┆ …         ┆ …         ┆ …         ┆ …         │
│ 2023-12-27 00:00:00 ┆ 0.051795  ┆ -0.966242 ┆ -0.157471 ┆ 0.280041  ┆ 2.169436  │
│ 2023-12-28 00:00:00 ┆ 0.222624  ┆ -0.113131 ┆ 0.323461  ┆ 0.212483  ┆ -1.876028 │
│ 2023-12-29 00:00:00 ┆ -0.542401 ┆ -0.24773  ┆ 0.202509  ┆ 0.0       ┆ -1.23969  │
│ 2023-12-30 00:00:00 ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.136582  │
│ 2023-12-31 00:00:00 ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.0       ┆ 0.256862  │
└─────────────────────┴───────────┴───────────┴───────────┴───────────┴───────────┘
performance_stats

Compute the performance stats for all tickers.

Returns:

  • DataFrame: Polars DataFrame containing the performance stats.

Example:

performance_stats = tickers.performance_stats()
print(performance_stats)
shape: (5, 17)
┌─────────┬────────┬─────────────┬─────────────┬───┬────────┬────────────┬────────────┬────────────┐
│ Symbol  ┆ Daily  ┆ Daily       ┆ Cumulative  ┆ … ┆ Calmar ┆ Maximum    ┆ Value at   ┆ Expected   │
│ ---     ┆ Return ┆ Volatility  ┆ Return      ┆   ┆ Ratio  ┆ Drawdown   ┆ Risk       ┆ Shortfall  │
│ str     ┆ ---    ┆ ---         ┆ ---         ┆   ┆ ---    ┆ ---        ┆ ---        ┆ ---        │
│         ┆ str    ┆ str         ┆ str         ┆   ┆ str    ┆ str        ┆ str        ┆ str        │
╞═════════╪════════╪═════════════╪═════════════╪═══╪════════╪════════════╪════════════╪════════════╡
│ AAPL    ┆ 0.12%  ┆ 2.11%       ┆ 163.19%     ┆ … ┆ 1.04   ┆ 33.53%     ┆ -3.24%     ┆ -4.71%     │
│ GOOG    ┆ 0.09%  ┆ 2.11%       ┆ 106.13%     ┆ … ┆ 0.51   ┆ 52.36%     ┆ -3.19%     ┆ -4.81%     │
│ MSFT    ┆ 0.11%  ┆ 2.05%       ┆ 142.95%     ┆ … ┆ 0.77   ┆ 41.01%     ┆ -2.95%     ┆ -4.55%     │
│ NVDA    ┆ 0.27%  ┆ 3.41%       ┆ 728.90%     ┆ … ┆ 1.06   ┆ 91.15%     ┆ -5.13%     ┆ -7.00%     │
│ BTC-USD ┆ 0.18%  ┆ 3.48%       ┆ 487.00%     ┆ … ┆ 0.48   ┆ 122.82%    ┆ -5.10%     ┆ -7.98%     │
└─────────┴────────┴─────────────┴─────────────┴───┴────────┴────────────┴────────────┴────────────┘
returns_chart

Display the cumulative returns chart for all tickers.

Returns:

  • Plot: Plot object containing the returns chart.

Example:

returns_chart = tickers.returns_chart()
returns_chart.show()
returns_matrix

Display the returns correlation matrix for all tickers.

Returns:

  • Plot: Plot object containing the returns chart.

Example:

returns_matrix = tickers.returns_matrix(height=600, width=800)
returns_matrix.show()
report

Generate a report for all tickers.

Parameters:

  • report_type (str): The type of report to generate (“performance”).

Example:

tickers.report("performance")
get_ticker

Fetch the Ticker object for a specific ticker symbol.

Parameters:

  • symbol (str): The ticker symbol.

Returns:

  • Ticker: A Ticker object.

Example:

ticker = tickers.get_ticker(symbol="AAPL")
ticker.performance_chart().show()
optimize

Optimizes the tickers given the objective function and constraints.

Parameters:

  • objective_function (Optional[str]): The objective function for optimization.
  • constraints (Optional[List[Tuple[float, float]]]): List of constraints for optimization.

Returns:

  • Portfolio: A Portfolio object.

Example:

portfolio = tickers.optimize(objective_function="max_sharpe", constraints=[(0, 1), (0, 1), (0, 1), (0, 1), (0,1)])
portfolio.performance_chart().show()