Fetch last N days historical value from the valuationTime using HistoricalTimeSeries primitive


#1

Hi ,

I have a requirement as follows
f(DATE) = average(all values of histroical timeseries from DATE to 1 year back)

Here i was trying to achieve this by giving requirement dependency to HistoricalTimeSeries primitive but then i could learn that the valuationTime passed through the executionOption and that which is available inside execute function as “executionContext.getValuationTime()” is not available in getRequirements.

Which makes it impossible to pass valuationTime to any of the dependencies.

If there is a method to achieve this , kindly let me know.

Thanks
Vineeth


#2

On thinking further , i came to the conclusion that the HistoricalTimeSeries execute body can access the valuation date.

But again my primary questions is like “Can i pass parameters from a node to another node in a dependency graph” Where a node is a function execution class.

Thanks
Vineeth


#3

You might or might not be able to get away with it, but don’t rely on it. I think you should be able to specify a relative date using the HistoricalTimeSeriesFunction e.g. StartDate="-P1Y". Not 100% sure about that, but know I saw the code in there to do something like that. That should do it relative to the valuation date.