finalynx.portfolio.bucket
Module Contents
Classes
Holds a list of |
API
- class finalynx.portfolio.bucket.Bucket(name: str, lines: List[finalynx.portfolio.line.Line])[source]
Holds a list of
Lineobjects to represent a group of investments that hold the same purpose.Once defined with a list of lines, there is nothing else to do from a user perspective. The user can reference this bucket instance in as many
SharedFolderinstances in the portfolio tree as desired. Each folder will only user the specifiedtarget_amountin each folder instance, and the bucket will generate a new list of liens for this folder with only the specified amount, while keeping track of what has been already used.Initialization
- Parameters:
name – Name for the bucket used to display it and export it to JSON.
lines – List of
Lineinstances that will be shared with allSharedFolderobjects that use thisBucket.
- _get_cumulative_index(target: float) Dict[str, Any][source]
- Returns:
A dictionary containing the Line index where the cumulative sum meets, and the remainder amount not used in this line.
- get_lines() List[finalynx.portfolio.line.Line][source]
- Returns:
A copy of the
Bucket’s lines between the two previoususe_amount()calls.
- use_amount(amount: float) List[finalynx.portfolio.line.Line][source]
Ask to consume the specified amount from the bucket.
- Returns:
A list of copies of the used Lines with their respective used amounts. Next time this method is called, the bucket will start from the cumulative amount used so far.
- add_amount(amount: float) None[source]
Add or remove an amount to the bucket’s lines. This can be used to dynamically change the bucket’s total amount, e.g. to apply recommendations from Finalynx during the simulation
- static from_dict(dict: Dict[str, Any], envelopes: Dict[str, finalynx.portfolio.envelope.Envelope]) finalynx.portfolio.bucket.Bucket[source]