示例#1
0
        static void generateCurves(LiveSystem system, IEnumerable <JMarket> markets, QDirectory directory, DateTime start, DateTime end, DataSource metricSource)
        {
            var symbols    = convert(markets, market => new Symbol(market.name(), market.bigPointValue()));
            var parameters = new Parameters {
                { "systemId", system.id() },
                { "RunMode", (double)RunMode.LIVE }
            };
            var startLoading = DateTime.Now;

            Bomb.when(system.details().runInNativeCurrency(), () => "portfolio optimization requires systems to run in dollars, not native currency");
            var bars            = new SystemDbBarLoader(system.details().interval(), symbols, start, end);
            var simulator       = new Simulator(new SystemArguments(symbols, parameters), bars, "QUEDGE");
            var startProcessing = DateTime.Now;
            var perSecond       = simulator.processBars();

            saveMetric(system, "marketBarsPerSecond", metricSource, perSecond);
            var startMetricCalc = DateTime.Now;

            simulator.metrics();
            saveMetric(system, "metricCalculationSeconds", metricSource, secondsSince(startMetricCalc));
            saveMetric(system, "totalRunSeconds", metricSource, secondsSince(startProcessing));
            simulator.writeCurveFiles(directory);
            saveMetric(system, "totaSeconds", metricSource, secondsSince(startLoading));
            Db.commit();
        }