public static void Main(string[] args) { var arguments = Arguments.arguments(args, jStrings("system", "prefix")); var system = arguments.get("system"); var prefix = arguments.get("prefix", PREFIX_DEFAULT); LogC.setOut("Tomahawk", Systematic.logsDir().file("Tomahawk." + system + ".log").path(), true); LogC.useJavaLog = true; LogC.info("running system " + system + ", process " + processId()); var liveSystems = accept(list <LiveSystem>(MsivLiveHistory.LIVE.liveSystems()), ls => ls.siv().system().Equals(system)); each(liveSystems, liveSystem => { Bomb.when(liveSystem.details().runInNativeCurrency(), () => "not allowed to run live systems in native currency"); var markets = list <Market>(liveSystem.markets()); var symbols = convert(markets, market => new Symbol(market.name(), market.bigPointValue())); var systemId = liveSystem.id(); var parameters = new Parameters { { "systemId", systemId }, { "RunMode", (double)RunMode.LIVE } }; Bomb.when(isEmpty(symbols), () => "No markets for " + systemId); var systemArguments = new SystemArguments(symbols, parameters); var start = date(systemArguments.interval().isDaily() ? BloombergSecurity.BBG_START_HISTORICAL : BloombergSecurity.BBG_START_INTRADAY); if (parameters.has("DaysBack")) { start = now().AddDays(-parameters.get <int>("DaysBack")); } var loader = new SystemDbBarLoader(liveSystem.details().interval(), symbols, start); var simulator = new Simulator(systemArguments, loader, prefix); simulator.processBars(); simulator.goLive(); }); sleep(Int32.MaxValue); }
public MainWindow(string[] unused) : base("NORAD") { var arguments = Arguments.arguments(unused, o.jStrings("live", "settings")); System.Environment.SetEnvironmentVariable("RE_TEST_MODE", "TRUE"); LogC.useJavaLog = true; LogC.info("starting MainWindow."); var workbench = new WorkbenchPanel(); dockManager.Content = workbench; var path = Systematic.mainDir().file("dotNET/Gui/Resources/target.ico").path(); Icon = BitmapFrame.Create(new FileStream(path, FileMode.Open, FileAccess.Read)); if (arguments.containsKey("settings")) { if (arguments.get("live", false)) { workbench.liveButton.doClick(); } else { workbench.runButton.doClick(); } } }
public override void processTick(Symbol symbol, Tick tick) { if (!partialBars.ContainsKey(symbol)) { partialBars[symbol] = new Bar(tick.price, tick.price, tick.price, tick.price, tick.time); } partialBars[symbol] = partialBars[symbol].update(tick); var processThisTick = system.runOnNewTick() || !lastTickProcessed.ContainsKey(symbol) || lastTickProcessed[symbol] <= tick.time.AddMinutes(-1); try { if (processThisTick) { manager.newTick(); if (!isLive) { isLive = true; manager.goLive(); system.goLiveDO_NOT_CALL_EXCEPT_FROM_BRIDGE(); monitor().goLive(system); } var partialBar = updateBarSpud(symbol); if (Systematic.isLoggingTicks()) { LogC.info("processing tick " + symbol + ": bar=" + partialBar + ", tick=" + tick); } system.processTickDO_NOT_CALL_EXCEPT_FROM_BRIDGE(symbol, partialBar, tick); manager.recalculate(); lastTickProcessed[symbol] = tick.time; } monitor().tickProcessed(symbol, tick); } catch (Exception e) { LogC.info("exception caught in processTick: ", e); throw; } }
static void copyDirectory(QDirectory destination, string[] parts, bool debug) { var fromParts = new string[parts.Length]; zeroTo(parts.Length, i => fromParts[i] = debug ? parts[i].Replace("Release", "Debug") : parts[i]); var fromDir = Systematic.mainDir().directory(fromParts); var toDir = destination.directory(parts); toDir.destroyIfExists(); fromDir.copy(toDir); }
public void testRMetrics() { var csvFile = Systematic.mainDir().file("R/scripts/STO/rMetricsTieOut.csv"); var rScript = csvFile.path().Replace(".csv", ".r"); O.runProcess(@"T:\R\R-2.5.0\bin\Rscript.exe", rScript); var csv = new Csv(csvFile, true); var cMetrics = new Metrics(); O.zeroTo(csv.count(), i => { var values = csv.record(i); var metricName = csv.value("metricName", values); var calculator = Bomb.missing(cMetrics.calculators, qMetricName(metricName)); checkMetric(metricName, calculator, values, csv); }); }
public static void Main(string[] args) { LogC.setVerboseLoggingForever(true); var arguments = Arguments.arguments(args, jStrings("systemId", "queue", "serverIndex")); var systemId = arguments.integer("systemId"); var serverIndex = arguments.integer("serverIndex"); LogC.setOut("STOServer", Systematic.logsDir().file("STOServer_" + systemId + "-" + serverIndex + ".log").path(), true); LogC.useJavaLog = true; var server = new STOServer(systemId, serverIndex); var queue = new Queue(arguments.@string("queue"), Bootstrap.LOCAL_CLOUD_BROKER); server.subscribe(queue); server.heart.initiate(); sleepForever(); }
public void systematicTest() { Assert.AreEqual(5, Systematic.sampling(20, 5).Length); }
internal void start(string systemName) { LogC.info("starting " + systemName); if (BloombergTagsTable.TAGS.anyAutoExecute(systemName) && !FerretControl.status().Equals("Stage")) { Email.problem("Can't start autoex system " + systemName, "Ferret is not in Stage mode!").sendTo(Systematic.failureAddress()); return; } if (inTestMode) { fakeStarts.Add(systemName); return; } processes[systemName] = Process.Start(QRUN, "Q.Simulator.Live -system " + systemName + " -prefix " + OrderTable.prefix); }