Merge pull request #2024 from AlexCatarino/bug-2023-fixes-equalweightingportfolioconstructionmodel

Fixes EqualWeightingPortfolioConstructionModel logic
This commit is contained in:
Jared
2018-05-30 14:14:38 -04:00
committed by GitHub
6 changed files with 103 additions and 73 deletions
@@ -22,12 +22,12 @@ from QuantConnect.Orders import *
from QuantConnect.Algorithm import *
from QuantConnect.Algorithm.Framework import *
from QuantConnect.Algorithm.Framework.Alphas import *
from QuantConnect.Algorithm.Framework.Execution import *
from QuantConnect.Algorithm.Framework.Portfolio import *
from QuantConnect.Algorithm.Framework.Risk import *
from QuantConnect.Algorithm.Framework.Selection import *
from Alphas.RsiAlphaModel import RsiAlphaModel
from Alphas.EmaCrossAlphaModel import EmaCrossAlphaModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Risk.NullRiskManagementModel import NullRiskManagementModel
from datetime import timedelta
import numpy as np
@@ -21,9 +21,9 @@ from QuantConnect import *
from QuantConnect.Orders import *
from QuantConnect.Algorithm import *
from QuantConnect.Algorithm.Framework import *
from QuantConnect.Algorithm.Framework.Portfolio import *
from QuantConnect.Algorithm.Framework.Selection import *
from Alphas.RsiAlphaModel import RsiAlphaModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from Execution.StandardDeviationExecutionModel import StandardDeviationExecutionModel
from datetime import timedelta
@@ -62,4 +62,4 @@ class StandardDeviationExecutionModelRegressionAlgorithm(QCAlgorithmFramework):
self.SetExecution(StandardDeviationExecutionModel())
def OnOrderEvent(self, orderEvent):
self.Log("{}: {}".format(self.Time, orderEvent))
self.Log(f"{self.Time}: {orderEvent}")
@@ -21,9 +21,9 @@ from QuantConnect import *
from QuantConnect.Orders import *
from QuantConnect.Algorithm import *
from QuantConnect.Algorithm.Framework import *
from QuantConnect.Algorithm.Framework.Portfolio import *
from QuantConnect.Algorithm.Framework.Selection import *
from Alphas.RsiAlphaModel import RsiAlphaModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from Execution.VolumeWeightedAveragePriceExecutionModel import VolumeWeightedAveragePriceExecutionModel
from datetime import timedelta
@@ -63,7 +63,7 @@ class VolumeWeightedAveragePriceExecutionModelRegressionAlgorithm(QCAlgorithmFra
self.InsightsGenerated += self.OnInsightsGenerated
def OnInsightsGenerated(self, algorithm, data):
self.Log('{}: {}'.format(self.Time, ', '.join(str(x) for x in data.Insights)))
self.Log(f"{self.Time}: {', '.join(str(x) for x in data.Insights)}")
def OnOrderEvent(self, orderEvent):
self.Log("{}: {}".format(self.Time, orderEvent))
self.Log(f"{self.Time}: {orderEvent}")