예제 #1
0
 public static void save(ResearchGUI gui)
 {
     try { makeRunInfo(gui).save(gui.name()); }
     catch (Exception e) {
         gui.logAndAlert("failed to save settings", e);
     }
 }
예제 #2
0
 void runSystem(Producer <SystemRunInfo> info, bool goLive)
 {
     try {
         gui.disableRunButton();
         runInfo   = info();
         simulator = runInfo.newSimulator((symbol, definition) => plots.get(symbol).Add(definition));
         each(simulator.symbols, symbol => simulator.addCollectible(symbol));
         simulator.addNewTradeListener(addTrade);
         simulator.processBars();
     } catch (Exception e) {
         gui.logAndAlert("failed during simulation run", e);
         return;
     } finally {
         runThread = null;
         gui.enableRunButton();
     }
     gui.reportResults(this);
     if (goLive)
     {
         simulator.goLive();
     }
 }
예제 #3
0
 public static void loadSystem(ResearchGUI gui)
 {
     try {
         var        systemId = int.Parse(gui.systemId());
         var        details  = Parameters.details(systemId);
         Parameters parameters;
         if (details.hasPv())
         {
             parameters = new Parameters {
                 { "systemId", systemId },
                 { "RunMode", (double)RunMode.LIVE }
             };
             gui.setMarkets(convert(list <Market>(details.liveSystem().markets()), market => market.name()));
         }
         else if (hasContent(gui.runNumber()))
         {
             parameters = new Parameters {
                 { "systemId", systemId },
                 { "RunNumber", int.Parse(gui.runNumber()) },
                 { "RunMode", (double)RunMode.STO }
             };
             gui.setMarkets(list <string>(MsivBacktestTable.BACKTEST.markets(details.siv(), details.stoId())));
         }
         else
         {
             parameters = new Parameters {
                 { "systemId", systemId },
                 { "RunMode", (double)RunMode.RIGHTEDGE }
             };
             each(list <string>(StrategyParameters.NAMES.names(details.siv().system())), name => parameters.Add(name, 0));
             gui.setMarkets(list <string>(MsivBacktestTable.BACKTEST.markets(details.siv(), details.stoId())));
         }
         gui.setRunNumberEnabled(details.hasValidStoDir());
         gui.setRunInNativeCurrency(details.runInNativeCurrency());
         gui.setParameters(parameters);
     } catch (Exception e) {
         gui.logAndAlert("failed to load system", e);
     }
 }