Trying to access a property on the algorithm class from the alpha class in the Update method, but its saying that the property doesn't exist. I've tried using the @property along with setters and getters but when I call the getter in the Alpha, an error is thrown saying that no method exists on the algorithm.
How would I go about doing this?
Sample Code:
class BasicTemplateFrameworkAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2001, 12, 1) # Set Start Date
self.SetEndDate(2020,5,1)
self.SetCash(100000) # Set Strategy Cash
self.AddAlpha(CustomAlphaModel())
self.Locked = False
@property
def IsLocked(self):
return self.Locked
def Lock(self):
self.Locked = True
def Unlock(self):
self.Locked = False
class CustomAlphaModel(AlphaModel):
def __init__(self):
self.Name = '{}'.format(self.__class__.__name__)
def Update(self, algorithm, data):
# Throws Error: 'QCAlgorithm' object has no attribute 'IsLocked'
algorithm.Debug("Algo Locked: {} ".format(algorithm.IsLocked))