finalynx.assistant
ο
Module Contentsο
Classesο
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
andLine
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 theAssistant
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.