Example #1
0
        public void testCanRunOneBar()
        {
            var args      = arguments(O.list(SYMBOL), LIVE_SYSTEM, RunMode.RIGHTEDGE, typeof(ExampleSymbolSystem));
            var simulator = makeSimulator(args);

            O.zeroTo(6, i => {
                simulator.nextBar();
                noOrders(simulator);
            });

            simulator.nextBar();
            hasOrders(simulator); // entry

            simulator.nextBar();
            noOrders(simulator);
            hasPosition(simulator);

            simulator.nextBar();
            hasOrders(simulator); // exit

            simulator.writeCurveFiles(curvesDirectory);
            var written = curvesDirectory.file(LIVE_SYSTEM.liveMarket(SYMBOL.name).fileName() + ".bin");

            AreEqual(9 * 3 * 8, written.size());
        }
Example #2
0
        void assignAppender(string market)
        {
            var file = tempDir.file(details.siv().sviName("_") + "_" + market + ".csv");

            if (!reuseExistingFiles)
            {
                file.deleteIfExists();
            }
            appendersByMarket[market] = file.appender();
        }
Example #3
0
        public string metricsFilePath(Siv siv, string marketName)
        {
            var d = new QDirectory(join(@"\", list(stoDir(), stoId(), "Metrics")));

            d.createIfMissing();
            return(d.file(siv.sviName("_") + "_" + marketName + ".csv").path());
        }
Example #4
0
        public string curveFilePath(Siv siv, string marketName)
        {
            var d = new QDirectory(join(@"\", list(stoDir(), stoId(), "CurvesBin", siv.sviName("_") + "_" + marketName)));

            d.createIfMissing();
            return(d.file("run_" + runNumber() + ".bin").path());
        }
Example #5
0
        public static void Main(string[] args)
        {
            var arguments = Arguments.arguments(args, jStrings("prefix", "dir"));
            var dir       = new QDirectory(arguments.@string("dir"));
            var rep       = Tag.parse(dir.file("group.xml").text());

            Groups.GROUPS.load(rep.child("group"), arguments.@string("prefix"));
            Db.commit();
        }
Example #6
0
        static void writeGroupXml(QDirectory outputDirectory, Group group, DateTime start, DateTime end)
        {
            var groupXml = Group.asXml(group);

            groupXml.add("asOf", ymdHuman(now()));
            groupXml.add("runDate", ymdHuman(reallyNow()));
            groupXml.add("start", ymdHuman(start));
            groupXml.add("end", ymdHuman(end));
            outputDirectory.file("group.xml").create(groupXml.longXml());
        }
Example #7
0
        public void setLogFile(QDirectory dir)
        {
            dir.createIfMissing();
            switch (runMode())
            {
            case RunMode.LIVE:
                LogC.setOut("System", dir.file("Q_" + liveSystem().name() + ".log").path(), true);
                break;

            case RunMode.RIGHTEDGE:
                LogC.setOut("System", dir.file("Q.log").path(), true);
                break;

            case RunMode.STO:
                LogC.setOut("System", dir.file("Q_" + siv().name() + ".log").path(), true);
                break;

            default:
                Bomb.toss("unhandled run mode setting log file!");
                break;
            }
        }
Example #8
0
 public void writeCurveFile(Collectible collectible, LiveSystem liveSystem, QDirectory directory)
 {
     CurveFiles.writeOne(directory.file(liveSystem.fileName(collectible.name) + ".bin").path(), dates_, pnl_, positions_);
 }