private bool CallRefineMethod(IStrategyRefiner obj, Strategy strategy) { PerformanceInfo spi = strategy.PerformanceInfo as PerformanceInfo; return(obj.CheckRefine(spi.winningPositionCount, spi.loosingPositionCount, spi.totalLoss, spi.totalWin, spi.largestLoss, spi.largestWin, spi.closedPositions.Count, spi.openPositions.Count, spi.reputation)); }
private bool doCompile() { if (compiledObject != null) { //no need to re-compile return(true); } string code = hiddenPrefix + lblCodePrefix.Text + txtCode.Text + lblCodeSuffix.Text + hiddenSuffix; List <string> references = new List <string>(); string appPath = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(appPath); string path = Uri.UnescapeDataString(uri.Path); path = Path.GetDirectoryName(path); references.Add(Path.Combine(path, "GeneticMarket.Base.dll")); references.Add(Path.Combine(path, "GeneticMarket.Common.dll")); references.Add(Path.Combine(path, "GeneticMarket.Logic.dll")); references.Add(Path.Combine(path, "GeneticMarket.BackEnd.dll")); references.Add(Path.Combine(path, "GeneticMarket.Core.dll")); RuntimeResult rr = RuntimeHelper.CompileCode(code, references); if (rr.Success == false) { MessageBox.Show(rr.ErrorMessage); return(false); } if (rr.CreatedObject == null) { MessageBox.Show("Error creating object"); return(false); } compiledObject = rr.CreatedObject as IStrategyRefiner; return(true); }
public int TestRefine(IStrategyRefiner refiner) { int result = 0; try { for (int i = 0; i < commonContext.StrategyRepository.StrategyCount; i++) { Strategy s = commonContext.StrategyRepository[i]; if (CallRefineMethod(refiner, s)) { result++; } } } catch { return(-1); } return(result); }
private void txtCode_TextChanged(object sender, EventArgs e) { compiledObject = null; }