finstmt.forecast package

Subpackages

Submodules

finstmt.forecast.config module

class finstmt.forecast.config.ForecastConfig(periods=5, freq='Y', prophet_kwargs=<factory>, balance=True, timeout=180, bs_diff_max=10000)[source]

Bases: object

__init__(periods=5, freq='Y', prophet_kwargs=<factory>, balance=True, timeout=180, bs_diff_max=10000)
balance: bool = True
bs_diff_max: float = 10000
freq: str = 'Y'
property make_future_df_kwargs: Dict[str, Union[int, str]]
periods: int = 5
prophet_kwargs: dict
timeout: float = 180
class finstmt.forecast.config.ForecastItemConfig(method='cagr', pct_of=None, make_forecast=True, prophet_kwargs=<factory>, cap=None, floor=None, manual_forecasts=<factory>, plug=False, balance_with=None)[source]

Bases: object

The main configuration for a single item forecast

method: ‘auto’ currently only supported method, runs forecast with prophet pct_of: key of financial statement item to forecast this as a percentage of make_forecast: whether to forecast prophet_kwargs: kwargs to pass to prophet model cap: the maximum that the trend line should reach floor: the minimum that the trend line should reach manual_forecasts: manually set values to use instead of doing a forecast plug: Whether to make this item adjustable to balance the balance sheet balance_item: Whether this item is balanced in the balancing process after forecasting

and which item to balance it with (typically just set to ‘total_liab_and_equity’ for total assets and ‘total_assets’ for total liabilities and equity)

__init__(method='cagr', pct_of=None, make_forecast=True, prophet_kwargs=<factory>, cap=None, floor=None, manual_forecasts=<factory>, plug=False, balance_with=None)
balance_with: Optional[str] = None
cap: Union[float, Series, None] = None
copy(**updates)[source]
Return type:

Self

floor: Union[float, Series, None] = None
make_forecast: bool = True
manual_forecasts: Dict[str, List[float]]
method: str = 'cagr'
pct_of: Optional[str] = None
plug: bool = False
prophet_kwargs: dict
to_series()[source]
Return type:

Series

finstmt.forecast.dataframe module

finstmt.forecast.dataframe.add_cap_and_floor_to_df(df, cap, floor)[source]

finstmt.forecast.main module

class finstmt.forecast.main.Forecast(orig_series, config, item_config, base_config, pct_of_series=None, pct_of_config=None)[source]

Bases: object

The main class to represent a forecast of an individual item.

__init__(orig_series, config, item_config, base_config, pct_of_series=None, pct_of_config=None)
base_config: ItemConfig
config: ForecastConfig
copy(**updates)[source]
Return type:

Self

fit()[source]
item_config: ForecastItemConfig
property name: str
orig_series: Series
pct_of_config: Optional[ItemConfig] = None
pct_of_series: Optional[Series] = None
plot(ax=None, figsize=(12, 5))[source]
Return type:

Figure

predict()[source]
Return type:

Series

property result: Series
property series: Series
to_manual(use_levels=False, adjustments=None, replacements=None)[source]

finstmt.forecast.plot module

finstmt.forecast.plot.plot_forecast(fcst_df, orig_data, orig_dates, ax=None, figsize=(12, 5), xlabel=None, ylabel=None, title=None)[source]
Return type:

Figure

finstmt.forecast.statements module

class finstmt.forecast.statements.ForecastedFinancialStatements(income_statements, balance_sheets, calculate=True, auto_adjust_config=True, _combinator=<finstmt.combined.combinator.FinancialStatementsCombinator object>, forecasts=<factory>)[source]

Bases: FinancialStatements

__init__(income_statements, balance_sheets, calculate=True, auto_adjust_config=True, _combinator=<finstmt.combined.combinator.FinancialStatementsCombinator object>, forecasts=<factory>)
forecasts: Dict[str, Forecast]
plot(subset=None, figsize=None, num_cols=3, height_per_row=3, plot_width=15)[source]
Return type:

Figure