public void writeSTOFiles(bool doMetricFiles) { each(collectors, (portfolio, collector) => collector.writeSTOFiles(portfolio.name, doMetricFiles)); if (!doMetricFiles || !arguments.parameters.isCloudSTO()) { return; } var systemId = arguments.systemId(); var run = arguments.parameters.runNumber(); MetricFiles.writeToS3(systemId, run, metrics()); FetchSTOParameters.key(systemId, run).write(serialize(arguments.parameters)); }
public void writeSTOFiles(string marketName, bool doMetricFiles) { if (arguments.parameters.isSTO()) { var path = arguments.curveDir(marketName); LogC.info("write sto curve file on " + path); CurveFiles.writeOne(path, dates_, pnl_, positions_); if (doMetricFiles) { MetricFiles.writeOne(arguments.systemId(), marketName, arguments.parameters.runNumber(), metrics()); } } else if (arguments.parameters.isCloudSTO()) { CurveFiles.writeToS3(arguments.systemId(), marketName, arguments.parameters.runNumber(), dates_, pnl_, positions_); } }
public void testCanWriteToS3() { var id = 5203; new MetaBucket("quantys-5203").create(); var metrics = new MetricResults(); var marketName = "RE.TEST.TY.1C"; var runNumber = 1; var expected = new Dictionary <string, double> { { "value1", 1.0 }, { "value2", 5.005 }, { "value3", 0.005 } }; metrics.Add(marketName, expected); metrics.Add(marketName + ".2", expected); MetricFiles.writeToS3(id, runNumber, metrics); var actual = MetricFiles.readFromS3(id, runNumber); IsTrue(Objects.dictionaryEquals(expected, actual[marketName])); IsTrue(Objects.dictionaryEquals(expected, actual[marketName + ".2"])); }
public void testCanWriteMetricFile() { var id = 5203; MetricFiles.writeOne(id, "RE.TEST.TY.1C", 1, new Dictionary <string, double> { { "value1", 1.0 }, { "value2", 5.005 }, { "value3", 0.005 } }); var details = SystemDetailsTable.DETAILS.details(id); var sto = new STO(details); checkMetrics(sto, 1.0, 5.005, 0.005, 1); IsTrue(Db.explicitlyCommitted()); MetricFiles.writeOne(id, "RE.TEST.TY.1C", 10, new Dictionary <string, double> { { "value1", 2.0 }, { "value2", 6.005 }, { "value3", 0.006 } }); checkMetrics(sto, 2.0, 6.005, 0.006, 10); IsTrue(Db.explicitlyCommitted()); }