inputFolder = '/Input' inputTimeseries1 = 'Input1' inputTimeseries2 = 'Input2' outputFolder = '/Output' outputName = 'OutputTimeseries' formula = '[Input1]-[Input2]' tsMgr = app.Modules.Get('Time series Manager') ts1 = tsMgr.TimeSeriesList.Fetch(inputFolder + '/' + inputTimeseries1) ts2 = tsMgr.TimeSeriesList.Fetch(inputFolder + '/' + inputTimeseries2) mapping = {inputTimeseries1 : ts1, inputTimeseries2: ts2} tool = app.Tools.CreateNew('Timeseries Calculator') tool.InputItems.Add(ts1) tool.InputItems.Add(ts2) tool.Formula = formula tool.NameMapping = mapping tool.Execute() output = tool.OutputItems[0] outputGroup = tsMgr.TimeSeriesGroupList.Fetch(outputFolder) if(outputGroup != None): output.GroupId = outputGroup.Id outputTS = tsMgr.TimeSeriesList.Fetch(outputFolder + '/' + outputName) if(outputTS == None): output.Name = outputName tsMgr.TimeSeriesList.Add(output) else: print 'timeseries already exists'