Module Contents



Holds a list of Line objects to represent a group of investments that hold the same purpose.


class finalynx.portfolio.bucket.Bucket(name: str, lines: List[finalynx.portfolio.line.Line])[source]

Holds a list of Line objects 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 SharedFolder instances in the portfolio tree as desired. Each folder will only user the specified target_amount in 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 Line instances that will be shared with all SharedFolder objects that use this Bucket.

get_max_amount() float[source]

The total amount contained in this bucket.

_get_cumulative_index(target: float) Dict[str, Any][source]

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]

A copy of the Bucket’s lines between the two previous use_amount() calls.

use_amount(amount: float) List[finalynx.portfolio.line.Line][source]

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[source]

The total amount used from the bucket until now.

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

reset() None[source]

Go back to a state where no amount was used.

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