コード例 #1
0
def weights_and_estimates_with_no_valid_data(
        estimates: Estimates) -> estimatesWithPortfolioWeights:
    weights_with_no_valid_data = portfolioWeights.allnan([])
    weights_with_estimates_for_valid_data = estimatesWithPortfolioWeights(
        weights=weights_with_no_valid_data, estimates=estimates)

    return weights_with_estimates_for_valid_data
コード例 #2
0
def equal_weights_optimisation(estimates: Estimates,
                                     **_ignore_weighting_args) -> estimatesWithPortfolioWeights:

    portfolio_weights =  one_over_n_portfolio_weights_from_estimates(estimates)
    estimates_with_weights = estimatesWithPortfolioWeights(weights=portfolio_weights,
                                                           estimates=estimates)

    return estimates_with_weights
コード例 #3
0
def handcraft_optimisation(
        estimates: Estimates,
        equalise_SR: bool = False,
        equalise_vols: bool = True,
        **_ignored_weighting_kwargs) -> estimatesWithPortfolioWeights:

    weights = get_handcrafted_portfolio_weights_for_valid_data(
        estimates, equalise_vols=equalise_vols, equalise_SR=equalise_SR)

    estimates_and_portfolio_weights = estimatesWithPortfolioWeights(
        weights=weights, estimates=estimates)

    return estimates_and_portfolio_weights
コード例 #4
0
ファイル: shared.py プロジェクト: yabolgha/pysystemtrade
def optimise_given_estimates(
        estimates: Estimates,
        equalise_SR: bool = True,
        ann_target_SR: float = 0.5,
        equalise_vols: bool = True,
        **_ignored_kwargs) -> estimatesWithPortfolioWeights:

    estimates = estimates.equalise_estimates(equalise_vols=equalise_vols,
                                             equalise_SR=equalise_SR,
                                             ann_target_SR=ann_target_SR)

    portfolio_weights = optimise_from_processed_estimates(estimates)
    estimates_with_portfolio_weights = estimatesWithPortfolioWeights(
        weights=portfolio_weights, estimates=estimates)

    return estimates_with_portfolio_weights