macrosynergy.panel.converge_row#

Convergence of rows for max weight

class ConvergeRow(row, max_weight, margin=0.001, max_loops=25)[source]#

Bases: object

Class designed to receive a row of weights, where at least one weight in the aforementioned row exceeds the permitted upper-bound, and subsequently redistributes the excess evenly across all cross-sections. :type row: ndarray :param row: Array of weights. :type max_weight: float :param max_weight: Maximum weight. :type margin: float :param margin: Margin of error allowed in the convergence to within the

upper-bound, “max_weight”.

Parameters:

max_loops (int) – Controls the accuracy: in theory, the greater the number of loops allowed, the more accurate the convergence. However, will only become significant if a tight margin is imposed: the “looser” the margin, the less likely the maximum number of loops permitted will be exceeded.

classmethod application(row, max_weight)[source]#
distribute_simple()[source]#

Initiates an indefinite While Loop until the weights converge below the (max_weight + margin). Will evenly redistribute the excess weight across all active cross-sections, and will compute the maximum weight, the number of cross- sections above the threshold and the excess weight dynamically: through each iteration.