I'm trying to calculate the distance from custom factor x to custom factor y.
My problem is: sometimes it will be a positive number to a negative and other times a negative to a positive.
If custom factor x is -10 and custom factor y is +10, I would want the output to be +20
If custom factor x is +10 and custom factor y is -10, I would want the output to be -20.
I am dealing with decimals.
Here's what I've tried with no luck:
class DiffInEroc2(CustomFactor):
inputs = [it24up11619.eroc]
window_length = 12
def compute(self, today, asset_ids, out, eroc):
out[:] = eroc[-12]
class DiffInEroc1(CustomFactor):
inputs = [it24up11619.eroc]
window_length = 1
def compute(self, today, asset_ids, out, eroc):
out[:] = eroc[-1]
eroc1 = DiffInEroc1()
eroc2 = DiffInEroc2()
erocrange = range(eroc1, eroc2, .0001)