// GET: StockRun public ActionResult Index() { string GetParametersQuery = Request.Url.Query; Hashtable GetParameters = new Hashtable(); foreach (var reqdata in GetParametersQuery.Trim('?').Split('&')) { try { GetParameters.Add(reqdata.Split('=')[0], reqdata.Split('=')[1]); } catch (Exception e) { } } string UrlQuery = Request.Url.Query; ZhaoFinancialSelectStockStrategy Strategy = new ZhaoFinancialSelectStockStrategy(GetParameters); SimulationStart Start = new SimulationStart(Strategy, UrlQuery); TransactionList Data = Start.Run(); Data._TransactionList.Sort(); Data.TransactionStatisticResult(); Session["DataResult"] = Data; return(View(Data)); }
public ActionResult Optimize() { List <TransactionList> OptimizeList = new List <TransactionList>(); string UrlQuery = Request.Url.Query; OptimizeStock _OptimizeStock = new OptimizeStock(); string GetParametersQuery = Request.Url.Query; Hashtable GetParameters = new Hashtable(); foreach (var data in GetParametersQuery.Trim('?').Split('&')) { GetParameters.Add(data.Split('=')[0], data.Split('=')[1]); } Strategy_2330 Strategy = new Strategy_2330(GetParameters); for (int i = 1; i <= 19; i += 1) { Strategy.Acc = i; SimulationStart Start = new SimulationStart(Strategy, UrlQuery); TransactionList Data = Start.Run(); Data._TransactionList.Sort(); TransactionList OptimizeData = _OptimizeStock.OptimizeCompany(Data, GetParameters); OptimizeData.TransactionStatisticResult(); OptimizeList.Add(OptimizeData); } Session["ResultStore"] = OptimizeList; return(View("~/Views/Optimize/OptimizeList.cshtml", OptimizeList)); }
public ActionResult AutoOptimizeStrategyAndCompany() { List <TransactionList> OptimizeList = new List <TransactionList>(); OptimizeStock _OptimizeStock = new OptimizeStock(); string GetParametersQuery = Request.Url.Query; Hashtable GetParameters = new Hashtable(); foreach (var data in GetParametersQuery.Trim('?').Split('&')) { GetParameters.Add(data.Split('=')[0], data.Split('=')[1]); } Strategy_Testing Strategy = new Strategy_Testing(GetParameters); for (int i = 0; i < 3; i++) { InitialData.SetYear(2016 - i, 2019 - i); InitialData.Initial(); SimulationStart Start = new SimulationStart(Strategy); TransactionList Data = Start.Run(); //Data._TransactionList.Sort(); TransactionList OptimizeData = _OptimizeStock.OptimizeCompany(Data, GetParameters); OptimizeData.TransactionStatisticResult(); OptimizeList.Add(OptimizeData); } Hashtable CandidateCompany = _OptimizeStock.OutputCompany(OptimizeList[0]); Hashtable StoreCompany = _OptimizeStock.OutputCompany(OptimizeList[0]); for (int i = 1; i < OptimizeList.Count; i++) { Hashtable FilterCompany = _OptimizeStock.OutputCompany(OptimizeList[i]); foreach (var check_company in CandidateCompany.Values) { if (!FilterCompany.ContainsValue(check_company)) { StoreCompany.Remove(check_company); } } } StreamWriter sw = new StreamWriter(@"C:\Users\user\Desktop\Data\FileCompanyData.csv"); foreach (var company in StoreCompany.Values) { sw.Write(company + ","); } sw.Close(); return(View("~/Views/Optimize/CompanyList.cshtml", StoreCompany)); }