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()); }
void assignAppender(string market) { var file = tempDir.file(details.siv().sviName("_") + "_" + market + ".csv"); if (!reuseExistingFiles) { file.deleteIfExists(); } appendersByMarket[market] = file.appender(); }
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()); }
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()); }
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(); }
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()); }
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; } }
public void writeCurveFile(Collectible collectible, LiveSystem liveSystem, QDirectory directory) { CurveFiles.writeOne(directory.file(liveSystem.fileName(collectible.name) + ".bin").path(), dates_, pnl_, positions_); }