nb module¶
Numba-compiled functions for portfolio optimization.
allocate_meta_nb function¶
Allocate by mapping each index point.
map_func_nb must take the point index, the index point, and *args. Must return a 1-dim array with the same size as n_cols.
get_alloc_points_nb function¶
Get allocation points from filled allocations.
If valid_only is True, does not register a new allocation when all points are NaN.v If nonzero_only is True, does not register a new allocation when all points are zero. If unique_only is True, does not register a new allocation when it's the same as the last one.
optimize_meta_nb function¶
Optimize by reducing each index range.
reduce_func_nb must take the range index, the range start, the range end, and *args. Must return a 1-dim array with the same size as n_cols.
pick_idx_allocate_func_nb function¶
Pick the allocation at an absolute position in an array.
pick_point_allocate_func_nb function¶
Pick the allocation at an index point in an array.
prepare_alloc_points_nb function¶
Prepare allocation points.
prepare_alloc_ranges_nb function¶
Prepare allocation ranges.
random_allocate_func_nb function¶
Generate a random allocation.
rescale_allocations_nb function¶
Rescale allocations to a new scale.
Positive and negative weights are rescaled separately from each other.