public bool Start() { //ensure everything is ready to start the optimization if (!isValid) { debug("Invalid optimization, Must configure this optimization completely before re-starting."); status("Optimization not configured."); return(false); } SIM = myhistsim; DLL = Dll; RNAME = ResponseName; debug("Starting optimization, Queueing up all " + this.OptimizeCount + " combinations..."); //queue up all the possibilities /* * List<List<string[]>> paramListList = new List<List<string[]>>(); * foreach (OptimizationParam op in varListControl.Items) * { * List<string[]> paramList = new List<string[]>(); * string testClass = (String)reslist.SelectedItem; * string testName = op.name.ToString(); * decimal val = decimal.MinValue; * decimal max = decimal.MaxValue; * while (val < max) * { * if (val == decimal.MinValue) { val = op.low; max = op.high; } * else val += op.step; * paramList.Add(new string[] { testClass, testName, val.ToString() }); * } * paramListList.Add(paramList); * } * * //now we have all the possibilities in a list * //we need to combine them into all possible combos * * //keep all possible combinations in a list * //each string[] is a parameter value * //each List<string[]> is a parameter set * List<List<string[]>> comboList = new List<List<string[]>>(); * * foreach (List<string[]> paramList in paramListList) * { * comboList = appendList(comboList, paramList); * }*/ debug("All combinations queued, Starting Gauntlet Threads"); var rh = RunHelper.run(runopt, null, debug, "runopt: " + this.ToString()); status("Optimizaton started with " + OptimizeCount + " combinations."); return(rh.isStarted); }
private void button1_Click(object sender, EventArgs e) { string sym = chartsymbolbox.Text.ToUpper(); chartsymbolbox.Text = sym; usecachenow = usecachebut.Checked; useblack = blackbackground.Checked; usesticky = stickychartsbox.Checked; usemax = maxchartbox.Checked; newchartsyms.Write(sym); RunHelper.run(downloaddata, null, debug, "chartographer background fetcher"); }
public QuotopiaMain() { InitializeComponent(); if (!isquotopiacountok()) { return; } // handle close smoothly FormClosing += new FormClosingEventHandler(QuotopiaMain_FormClosing); // initialization initquotopiachrome(); initgvs(); initfeeds(); split.SplitterMoved += new SplitterEventHandler(split_SplitterMoved); Resize += new EventHandler(QuotopiaMain_Resize); restoresettings(); setsplitter(); RunHelper.run(refreshviews, completenone, debug, "refreshview"); }
private void _inputbut_Click(object sender, EventArgs e) { // make sure we only convert one group at a time if (bw.IsBusy || isgenericbusy) { debug("wait until conversion completes..."); return; } // see if we're converting from files or webservices switch (_conval) { case Converter.GenericCSV: { // prompt GenericConvert gc = new GenericConvert(); gc.SendDebugEvent += new DebugDelegate(debug); if (gc.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (gc.isConvertOk) { // reset progress progress(0); // get map genericcsv = gc.CurrentMap; // start process RunHelper.run(dogenericconvert, null, debug, "generic convert start"); } } else { debug("user canceled generic csv convert."); } return; } // webservice list case Converter.EuronextDaily: case Converter.YahooDaily: case Converter.GoogleDaily: // reset progress progress(0); // get list of symbols from user string symi = Microsoft.VisualBasic.Interaction.InputBox("Enter list of symbols to pull from " + _conval.ToString() + Environment.NewLine + "(eg LVS,GOOG,GE)", "Enter symbol list", string.Empty, 0, 0); // remove spaces and capitalize symi = symi.Replace(" ", string.Empty).ToUpper(); // parse string[] syms = symi.Split(','); int count = 0; foreach (string sym in syms) { try { // get barlists for those symbols BarList bl; if (_conval == Converter.GoogleDaily) { bl = BarListImpl.DayFromGoogle(sym); } else if (_conval == Converter.YahooDaily) { bl = BarListImpl.DayFromYahoo(sym); } else if (_conval == Converter.EuronextDaily) { if (!System.Text.RegularExpressions.Regex.IsMatch(sym, "[A-Z0-9]{12}", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { debug("\"" + sym + "\" is not a valid ISIN. Euronext expects ISINs!"); continue; } bl = BarListImpl.DayFromEuronext(sym); } else { continue; } // convert to tick files if (!TikUtil.TicksToFile(TikUtil.Barlist2Tick(bl), debug)) { debug("Error saving downloaded bars."); } // notify debug("downloaded " + bl.Count + " bars of daily data for " + sym + " from " + _conval.ToString()); } catch (Exception ex) { debug(sym + " converter error: " + ex.Message + ex.StackTrace); } // update progress progress((double)count++ / syms.Length); } debug("completed daily download."); // we're done return; } OpenFileDialog of = new OpenFileDialog(); // allow selection of multiple inputs of.Multiselect = true; // keep track of bytes so we can approximate progress long bytes = 0; if (of.ShowDialog() == DialogResult.OK) { List <string> symbols = new List <string>(); foreach (string file in of.FileNames) { _path = Path.GetDirectoryName(file); string sn = Path.GetFileName(file); // get size of current file and append to total size FileInfo fi = new FileInfo(file); bytes += fi.Length; string sym = string.Empty; switch (_conval) { case Converter.QCollector_eSignal: string [] r = Path.GetFileNameWithoutExtension(sn).Split('_'); if (r.Length != 2) { sym = Microsoft.VisualBasic.Interaction.InputBox("Symbol data represented by file: " + sn, "File's Symbol", string.Empty, 0, 0); } else { sym = r[0]; } break; case Converter.TrueFX: // the symbol name is extracted from the filename // do not rename files downloaded from TrueFX.com string[] symstrs = Path.GetFileNameWithoutExtension(sn).Split('-'); sym = symstrs[0]; break; default: // guess symbol string guess = Util.rxm(sn, "[^a-z]*([a-z]{1,6})[^a-z]+"); // remove extension guess = Util.rxr(guess, "[.].*", string.Empty); // see if it's a clean match, if not don't guess if (!Util.rxmok(guess, "^[a-z]+$")) { guess = string.Empty; } sym = Microsoft.VisualBasic.Interaction.InputBox("Symbol data represented by file: " + sn, "File's Symbol", guess, 0, 0); break; } if (sym != string.Empty) { symbols.Add(sym); } } // estimate total ticks _approxtotal = (int)((double)bytes / 51); // reset progress bar progress(0); // start background thread to convert bw.RunWorkerAsync(new convargs(of.FileNames, symbols.ToArray())); debug("started conversion"); } }