Holds a list of
- class finalynx.portfolio.bucket.Bucket(name: str, lines: List[finalynx.portfolio.line.Line])
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 specified
target_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.
name – Name for the bucket used to display it and export it to JSON.
lines – List of
Lineinstances that will be shared with all
SharedFolderobjects that use this
- get_max_amount() float
The total amount contained in this bucket.
- _get_cumulative_index(target: float) Dict[str, Any]
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]
A copy of the
Bucket’s lines between the two previous
- use_amount(amount: float) List[finalynx.portfolio.line.Line]
Ask to consume the specified amount from the bucket.
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.
- get_used_amount() float
The total amount used from the bucket until now.
- add_amount(amount: float) None
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
- reset() None
Go back to a state where no amount was used.
- to_dict() Dict[str, Any]