Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 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_);
     }
 }
Ejemplo n.º 3
0
        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"]));
        }
Ejemplo n.º 4
0
        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());
        }