diff --git a/AutoSeller.Designer.cs b/AutoSeller.Designer.cs index 0f05b1d..5e87a9d 100644 --- a/AutoSeller.Designer.cs +++ b/AutoSeller.Designer.cs @@ -53,9 +53,9 @@ this.tbSubAccount = new MaterialSkin.Controls.MaterialSingleLineTextField(); this.cbAccount = new System.Windows.Forms.ComboBox(); this.tabPage3 = new System.Windows.Forms.TabPage(); + this.tbSimulationLog = new System.Windows.Forms.RichTextBox(); this.btSimulate = new MaterialSkin.Controls.MaterialFlatButton(); this.btLoad = new MaterialSkin.Controls.MaterialFlatButton(); - this.tbSimulationLog = new System.Windows.Forms.RichTextBox(); this.lvItems = new AutoSellerNS.ListViewNF(); this.chCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -438,6 +438,17 @@ this.tabPage3.Text = "Simulation"; this.tabPage3.UseVisualStyleBackColor = true; // + // tbSimulationLog + // + this.tbSimulationLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbSimulationLog.Location = new System.Drawing.Point(0, 204); + this.tbSimulationLog.Name = "tbSimulationLog"; + this.tbSimulationLog.Size = new System.Drawing.Size(1060, 342); + this.tbSimulationLog.TabIndex = 2; + this.tbSimulationLog.Text = ""; + // // btSimulate // this.btSimulate.AutoSize = true; @@ -470,14 +481,6 @@ this.btLoad.UseVisualStyleBackColor = true; this.btLoad.Click += new System.EventHandler(this.btLoad_Click); // - // tbSimulationLog - // - this.tbSimulationLog.Location = new System.Drawing.Point(0, 204); - this.tbSimulationLog.Name = "tbSimulationLog"; - this.tbSimulationLog.Size = new System.Drawing.Size(1060, 342); - this.tbSimulationLog.TabIndex = 2; - this.tbSimulationLog.Text = ""; - // // lvItems // this.lvItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { diff --git a/AutoSeller.cs b/AutoSeller.cs index 1451ec8..4520c7b 100644 --- a/AutoSeller.cs +++ b/AutoSeller.cs @@ -373,7 +373,29 @@ namespace AutoSellerNS private void btSimulate_Click(object sender, EventArgs e) { SimulationHelper helper = new SimulationHelper(m_CybosHelper, tbSimulationLog); - helper.StartSimuation(); + + int iOrgBidCount = Config.GetBidCount(); + float fOrgTrailingRate = Config.GetTrailingRate(); + int iOrgTraililngCount = Config.GetTrailingCnt(); + + for(int iBidCount = 4; iBidCount <= 8; iBidCount++) + { + for(float fTrailingRate=2.5f; fTrailingRate <= 5.0f; fTrailingRate += 0.5f) + { + for(int iTrailingCount = 2; iTrailingCount <= 4; iTrailingCount++) + { + Config.SetBidCount(iBidCount); + Config.SetTrailing(fTrailingRate, iTrailingCount); + + helper.StartSimuation(); + } + } + } + + Config.SetBidCount(iOrgBidCount); + Config.SetTrailing(fOrgTrailingRate, iOrgTraililngCount); + + Console.WriteLine("end"); } #endregion } diff --git a/SimulationHelper.cs b/SimulationHelper.cs index a18670f..aecab90 100644 --- a/SimulationHelper.cs +++ b/SimulationHelper.cs @@ -129,7 +129,12 @@ namespace AutoSellerNS string strOutFileName = Util.GetSimulationPath() + "/" + strCodeName + "-" + StartDT.ToString("yyyy-MM-dd") + ".xlsx"; if(File.Exists(strOutFileName) == true) - continue; + { + if(StartDT.DayOfYear == DateTime.Now.DayOfYear) + File.Delete(strOutFileName); + else + continue; + } CPStockChart.SetInputValue(0, "A"+strCode); CPStockChart.SetInputValue(1, '1'); @@ -172,6 +177,8 @@ namespace AutoSellerNS } m_tbLogView.AppendText(string.Format("[Load] All End\n\n")); + m_tbLogView.SelectionStart = m_tbLogView.TextLength; + m_tbLogView.ScrollToCaret(); } public void StartSimuation() @@ -245,7 +252,7 @@ namespace AutoSellerNS if(iAskCount >= Config.GetBidCount()) { - m_tbLogView.AppendText(string.Format("[{0}] 시뮬레이션 매도 {1} {2} {3} ({4} : {5:n2}%)\n", + m_tbLogView.AppendText(string.Format("[{0}] 시뮬레이션 매도 {1} line:{2} {3:n0}원 ({4} : {5:n2}%)\n", strCodeName, RowDT.ToString("yyyy-MM-dd HH:mm:00"), iRow, @@ -266,7 +273,7 @@ namespace AutoSellerNS if(iTrailingCount >= Config.GetTrailingCnt()) { - m_tbLogView.AppendText(string.Format("[{0}] 트레일링 매도 {1} {2} {3} ({4} : {5:n2}%)\n", + m_tbLogView.AppendText(string.Format("[{0}] 트레일링 매도 {1} line:{2} {3:n0}원 ({4} : {5:n2}%)\n", strCodeName, RowDT.ToString("yyyy-MM-dd HH:mm:00"), iRow, @@ -285,7 +292,9 @@ namespace AutoSellerNS } } - m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0} : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/iTotalBid)); + m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0}원 : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/(float)iTotalBid)); + m_tbLogView.SelectionStart = m_tbLogView.TextLength; + m_tbLogView.ScrollToCaret(); } } }