Welcome to Finalytics Documentation

Ticker Module

class Ticker

A class representing a Ticker object.

__init__(symbol: str, start_date: str | None, end_date: str | None, interval: str | None, benchmark_symbol: str | None, confidence_level: float | None, risk_free_rate: float | None) Ticker

Create a new Ticker object.

Parameters:
  • symbol (str) – The ticker symbol of the asset.

  • start_date (Optional[str]) – Optional start date for historical data, defaults to None.

  • end_date (Optional[str]) – Optional end date for historical data, defaults to None.

  • interval (Optional[str]) – Optional data interval (2m, 5m, 15m, 30m, 1h, 1d, 1wk, 1mo, 3mo), defaults to None.

  • benchmark_symbol (Optional[str]) – Optional benchmark symbol, defaults to None.

  • confidence_level (Optional[float]) – Optional confidence level for statistics, defaults to None.

  • risk_free_rate (Optional[float]) – Optional risk-free rate for calculations, defaults to None.

Returns:

A Ticker object.

Return type:

Ticker

get_quote() dict

Get the current ticker quote stats.

Returns:

Dictionary containing current ticker quote stats.

Return type:

dict

get_summary_stats() dict

Get summary technical and fundamental statistics for the ticker.

Returns:

Dictionary containing summary statistics.

Return type:

dict

get_price_history() DataFrame

Get the OHLCV data for the ticker for a given time period.

Returns:

Polars DataFrame containing OHLCV data.

Return type:

DataFrame

get_options_chain() DataFrame

Get the options chain for the ticker.

Returns:

Polars DataFrame containing the options chain.

Return type:

DataFrame

get_news(compute_sentiment: bool) dict

Get the latest news for the given ticker.

Parameters:

compute_sentiment (bool) – Whether to compute sentiment of news articles.

Returns:

Dictionary containing news articles and sentiment results if requested.

Return type:

dict

get_income_statement() DataFrame

Get the Income Statement for the ticker.

Returns:

Polars DataFrame containing the Income Statement.

Return type:

DataFrame

get_balance_sheet() DataFrame

Get the Balance Sheet for the ticker.

Returns:

Polars DataFrame containing the Balance Sheet.

Return type:

DataFrame

get_cashflow_statement() DataFrame

Get the Cashflow Statement for the ticker.

Returns:

Polars DataFrame containing the Cashflow Statement.

Return type:

DataFrame

get_financial_ratios() DataFrame

Get the Financial Ratios for the ticker.

Returns:

Polars DataFrame containing the Financial Ratios.

Return type:

DataFrame

volatility_surface() DataFrame

Get the implied volatility surface for the ticker options chain.

Returns:

Polars DataFrame containing the implied volatility surface.

Return type:

DataFrame

performance_stats() dict

Compute the performance statistics for the ticker.

Returns:

Dictionary containing performance statistics.

Return type:

dict

performance_chart(height: int | None, width: int | None) Plot

Display the performance chart for the ticker.

Parameters:
  • height (Optional[int]) – Optional height of the plot in pixels, defaults to None.

  • width (Optional[int]) – Optional width of the plot in pixels, defaults to None.

Returns:

Plot object containing the performance chart.

Return type:

Plot

candlestick_chart(height: int | None, width: int | None) Plot

Display the candlestick chart for the ticker.

Parameters:
  • height (Optional[int]) – Optional height of the plot in pixels, defaults to None.

  • width (Optional[int]) – Optional width of the plot in pixels, defaults to None.

Returns:

Plot object containing the candlestick chart.

Return type:

Plot

options_chart(chart_type: str, height: int | None, width: int | None) Plot

Display the options volatility surface, smile and term structure charts for the ticker.

Parameters:
  • chart_type (str) – Type of options chart (volatility_surface, smile, term_structure).

  • height (Optional[int]) – Optional height of the plot in pixels, defaults to None.

  • width (Optional[int]) – Optional width of the plot in pixels, defaults to None.

Returns:

Plot object containing the options chart.

Return type:

Plot

Portfolio Module

class Portfolio

A class representing a Portfolio object.

__init__(symbols: List[str], benchmark_symbol: str, start_date: str, end_date: str, interval: str, confidence_level: float, risk_free_rate: float, max_iterations: int, objective_function: str) Portfolio

Create a new Portfolio object.

Parameters:
  • symbols (List[str]) – List of ticker symbols for the assets in the portfolio.

  • benchmark_symbol (str) – The ticker symbol of the benchmark to compare against.

  • 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).

  • 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.

  • max_iterations (int) – The maximum number of iterations to use in the optimization.

  • objective_function (str) – The objective function to use in the optimization (max_sharpe, min_vol, max_return, min_var, min_cvar, min_drawdown).

Returns:

A Portfolio object.

Return type:

Portfolio

portfolio_chart(chart_type: str, height: int | None, width: int | None) Plot

Display the Portfolio Optimization Chart.

Parameters:
  • chart_type (str) – Type of portfolio chart (optimization, performance, asset_returns).

  • height (Optional[int]) – Optional height of the plot in pixels, defaults to 800.

  • width (Optional[int]) – Optional width of the plot in pixels, defaults to 1200.

Returns:

Plot object containing the portfolio chart.

Return type:

Plot

Indices and tables