Beispiel #1
0
 public static object CubeFromCSV(
     [ExcelArgument(Description = "Output cube name")] string ObjectName,
     [ExcelArgument(Description = "Input filename")] string FileName)
 {
     return(ExcelHelper.Execute(_logger, () =>
     {
         var cube = CubeEx.FromCSVFile(FileName);
         return RiskFunctions.PushCubeToCache(cube, ObjectName);
     }));
 }
Beispiel #2
0
 public static object SurfaceToCube(
     [ExcelArgument(Description = "Surface name")] string SurfaceName,
     [ExcelArgument(Description = "Output cube name")] string CubeName)
 {
     return(ExcelHelper.Execute(_logger, () =>
     {
         var surface = ContainerStores.GetObjectCache <IVolSurface>().GetObjectOrThrow(SurfaceName, $"Vol surface {SurfaceName} not found");
         var rrbf = (RiskyFlySurface)surface.Value;
         var cube = rrbf.ToCube();
         return RiskFunctions.PushCubeToCache(cube, CubeName);
     }));
 }
Beispiel #3
0
        public static object CubeFromCSV(
            [ExcelArgument(Description = "Output cube name")] string ObjectName,
            [ExcelArgument(Description = "Input filename")] string FileName,
            [ExcelArgument(Description = "Has header row, default true")] object HasHeaderRow,
            [ExcelArgument(Description = "Has value column, default true")] object HasValueColumn)
        {
            return(ExcelHelper.Execute(_logger, () =>
            {
                var hasHeader = HasHeaderRow.OptionalExcel(true);
                var hasValue = HasValueColumn.OptionalExcel(true);


                var cube = (!hasHeader && !hasValue) ?
                           CubeEx.FromCSVFileRaw(FileName) :
                           CubeEx.FromCSVFile(FileName, hasHeader, hasValue);
                return RiskFunctions.PushCubeToCache(cube, ObjectName);
            }));
        }