finalynx.assistant

Module Contents

Classes

Assistant

Main entry class that orchestrates the generation of your selected outputs.

API

class finalynx.assistant.Assistant(portfolio: finalynx.Portfolio, buckets: Optional[List[finalynx.portfolio.bucket.Bucket]] = None, envelopes: Optional[List[finalynx.portfolio.envelope.Envelope]] = None, ignore_orphans: bool = False, clear_cache: bool = False, force_signin: bool = False, hide_amounts: bool = False, hide_root: bool = False, show_data: bool = False, launch_dashboard: bool = False, output_format: str = '[console]', enable_export: bool = True, export_dir: str = 'logs', active_sources: Optional[List[str]] = None, theme: Optional[finalynx.theme.Theme] = None, sidecars: Optional[List[finalynx.portfolio.folder.Sidecar]] = None, ignore_argv: bool = False, check_budget: bool = False, interactive: bool = False, simulation: Optional[finalynx.simulator.timeline.Simulation] = None)[source]

Main entry class that orchestrates the generation of your selected outputs.

Declare your portfolio configuration (and other extensions such as scenario and copilot) in a separate file and create an instance of this Assistant class with your configuration as input.

Parameters:
  • portfolio – Your fully defined portfolio structure (with Target, Folder and Line objects).

  • scenario – Your simulation configuration including Event objects and so on (TODO coming soon).

  • copilot – Your investment strategy configuration (TODO coming soon).

  • ignore_orphans – Ignore fetched lines that you didn’t reference in your portfolio, defaults to False.

  • force_signin – Sign in to Finary even if there is an existing cookies file, defaults to False.

  • hide_amount – Display your portfolio with dots instead of the real values (easier to share), defaults to False.

  • hide_root – Display your portfolio without the root (cosmetic preference), defaults to False.

Initialization

add_source(source: finalynx.fetch.source_base_line.SourceBaseLine) None[source]

Register a source, either defined in your own config or from the available Finalynx sources using from finalynx.fetch.source_any import SourceAny.

_parse_args() None[source]

Internal method that parses the command-line options and activates the options in the corresponding modules.

run() None[source]

Main method to run (once your configuration is fully defined). This method orchestrates the call to the other available methods in this class. This methods displays a nice default output.

This method will fetch the data from your Finary account, process the targets in the portfolio tree, run your simulation, generate recommendations, and format the output nicely to the console.

initialize() rich.tree.Tree[source]

Fetch investments online from all sources and process the portfolio internally. Call this method first if you’re not using run().

simulate() rich.tree.Tree[source]

Simulate your portfolio’s future with the Simulation configuration passed in the Assistant constructor.

Returns:

A tree with the portfolio total worth every few years until the end date.

render_mainframe() rich.columns.Columns[source]

Renders the main tree and sidecars together. Call either run() or initialize() first.

render_panels() Tuple[Dict[str, Any], rich.columns.Columns][source]

Renders the default set of panels used in the default console view when calling run().

render_performance_report() rich.tree.Tree[source]

Print the current and ideal global expected performance. Call either run() or initialize() first.

dashboard() None[source]

Launch an interactive web dashboard! Call either run() or initialize() first.

export_json(dirpath: str) None[source]

Save everything in a JSON file. Can be used for data analysis in future or by other projects.

Parameters:

dirpath – Path to the directory where the file will be saved.

export_img(dir_path: str = '', file_name: str = 'portfolio.png', size: Tuple[int, int] = (1300, 2300), zoom: float = 2) str[source]

Export your portfolio to a PNG file with the following options:

Parameters:
  • dir_path – Relative path to the directory that will contain the

  • file_name – File name without the path, must end with .png

  • size – Output image resolution.

  • zoom – Image zoom, only way to affect the DPI of the image.

Returns:

The full absolute path where the image was saved.