just update the Target drift attribute to so we dont have to inject the drift_percent every single time

This commit is contained in:
Adrian Manteza
2022-03-17 22:48:22 +00:00
parent e4f51b8a3f
commit bd61fb7e81
3 changed files with 15 additions and 8 deletions

View File

@ -30,6 +30,12 @@ class ObjectiveFunction(BaseModel):
print(self.tcc_targets)
return amount
def update_targets_drift(self, amount: float = 0.0):
for target in self.tif_targets:
target.drift = round(amount, 2)
for target in self.tcc_targets:
target.drift = round(amount, 2)
def minimum_drift(self) -> float:
minimum_drift = 0.0

View File

@ -15,8 +15,8 @@ class Target(BaseModel):
def max_drift_increment(cls) -> int:
return 1 # 10%
def minimum(self, drift_percent = 0.0) -> float:
return self.value - (self.value * drift_percent)
def minimum(self) -> float:
return self.value - (self.value * self.drift)
def maximum(self, drift_percent = 0.0) -> float:
return self.value + (self.value * drift_percent)
def maximum(self) -> float:
return self.value + (self.value * self.drift)