public void testInOut() { var parameters = STOClient.STORunner.parameters(37859, 1); var request = new STORequest(O.list(new Symbol("RE.TEST.TY.1C", 1000)), new List <Portfolio>(), parameters); AreEqual(request, new STORequest(request.java())); }
public static void Main(string[] args) { Directory.CreateDirectory(@"E:\logs"); LogC.setOut("STOServer", @"E:\logs\STOServer." + processId() + ".log", true); LogC.setErr(@"E:\logs\STOServer." + processId() + ".error.log"); AppDomain.CurrentDomain.UnhandledException += handleUncaughtExceptions; S3Cache.setDefaultSqsDbMode(true); if (!(hostname().StartsWith("NY") || hostname().StartsWith("LN"))) { QHttpClient.turnOffProxy(); } var runner = EC2Runner.fromUserData(); S3Cache.setS3Cache(runner.s3Cache()); var lastRunTime = 120; while (trueDat()) { info("lastRunTime: " + lastRunTime); STORequest request = null; try { lastRunTime = processNextMessage(runner, lastRunTime, out request); } catch (Exception e) { LogC.err("failed " + request, e); LogC.info("failed " + request, e); continue; } info("finished " + request); } }
static void cacheSymbolData(STORequest request) { symbols = request.symbols; var systemId = request.parameters.get <int>("systemId"); var symbolRanges = dictionary(symbols, symbol => MsivBacktestTable.BACKTEST.range(systemId, symbol.name)); barData = new SystemDbBarLoader(SystemDetailsTable.DETAILS.details(systemId).interval(), symbols, symbolRanges); }
public bool Equals(STORequest obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } return(listEquals(obj.symbols, symbols) && Equals(obj.parameters, parameters)); }
internal void enqueueRun(int runNumber) { var runParameters = parameters(runNumber); var request = new STORequest(symbols, portfolios, runParameters); if (numInstances > 0 && !existingRuns.Contains(runNumber)) { runner.request(request.java()); } else { runner.responseQueue().send(request.response("LOCAL", now(), now(), processId())); } lock (runsQueuedLock) runsQueued++; if (runsQueued % 100 == 0) { info("queued message for run " + (start + runsQueued - 1)); } }
static int processNextMessage(EC2Runner runner, int lastRunTime, out STORequest request) { var message = runner.nextMessage(Math.Min(7200, 2 * lastRunTime)); var start = now(); request = new STORequest(message.@object()); info("received " + request); if (symbols == null || barData == null) { cacheSymbolData(request); } else { request.requireMatch(symbols); } var simulator = new Simulator.Simulator(new SystemArguments(symbols, request.portfolios, request.parameters), barData, "QUEDGE"); simulator.processBars(); simulator.shutdown(); lastRunTime = Math.Max((int)now().Subtract(start).TotalSeconds, 10); runner.responseQueue().send(request.response(EC2Runner.instanceId(), start, now(), processId())); message.delete(); return(lastRunTime); }