weighting#

tradeexecutor.strategy.weighting Python module in Trading Strategy framework.

Module description#

Weighting based portfolio manipulation.

Various helper functions to calculate weights for assets, normalise them.

Functions#

check_normalised_weights(weights[, epsilon])

Check that the sum of weights is good.

clip_to_normalised(weights[, epsilon, ...])

If the sum of the weights are not exactly 1, then decrease the largest member to make the same sum 1 precise.

normalise_weights(weights)

Normalise weight distribution so that the sum of weights is 1.

weight_by_1_slash_n(alpha_signals)

Use 1/N weighting system to generate portfolio weightings from the raw alpha signals.

weight_equal(alpha_signals)

Give equal weight to every asset, regardless of the signal strength

weight_passthrouh(alpha_signals)

Use the given raw weight value as is as the portfolio weight.