finalynx.portfolio.line

Module Contents

Classes

Line

This class represents a single investment line in your online account (e.g. Finary).

API

class finalynx.portfolio.line.Line(name: str, asset_class: finalynx.portfolio.constants.AssetClass = AssetClass.UNKNOWN, asset_subclass: finalynx.portfolio.constants.AssetSubclass = AssetSubclass.UNKNOWN, parent: Optional[finalynx.portfolio.folder.Folder] = None, target: Optional[finalynx.portfolio.targets.Target] = None, key: Optional[str] = None, amount: float = 0, newline: bool = False, perf: Optional[finalynx.portfolio.constants.LinePerf] = None, currency: Optional[str] = None, envelope: Optional[finalynx.portfolio.envelope.Envelope] = None)[source]

Bases: finalynx.portfolio.node.Node

This class represents a single investment line in your online account (e.g. Finary).

Initialization

This is a subclass of Node that adds an amount and key property.

Parameters:
  • name – The name that will be displayed in the final portfolio tree.

  • parent – Parent of this line. If this line is created in a Folder instance, the folder will set iself as the parent at the initialization stage.

  • target – Optional Target instance to format this line’s amount based on the objective you selected.

  • key – Optional string that must be identical to the name in the online account (e.g. Finary). Defaults to the name if the key is not set.

  • amount – How much has been invested on this investment line. If you connect your online account, the amount you specify will be replaced by what has been fetched online.

  • newline – Print a new line in the console at the end of this Line for better readability.

get_amount() float[source]
Returns:

The amount invested in this line.

get_perf() finalynx.portfolio.constants.LinePerf[source]
Returns:

The expected yearly performance of this line (set by user).

apply_perf(inflation: float = 2.0, n_years: float = 1.0) float[source]

Applies the performance if set. n_years specifies the period to apply the performance over (e.g. 1 / 12 = 0.0833 for one month).

Returns:

The gained amount, or None if no perf was defined.

_render_account_code() str[source]
Returns:

A formatted string representation of this line’s envelope.

to_dict() Dict[str, Any][source]
static from_dict(dict: Dict[str, Any], envelopes: Dict[str, finalynx.portfolio.envelope.Envelope]) finalynx.portfolio.line.Line[source]
copy() finalynx.portfolio.line.Line[source]