From ada9aeb58dcd607691dbeded8ea69c1da4c9cb0f Mon Sep 17 00:00:00 2001 From: mjjo Date: Mon, 13 Feb 2017 14:51:58 +0900 Subject: [PATCH] =?UTF-8?q?-=20simulation=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoSeller.Designer.cs | 619 +++++++++++++++++++++-------------------- AutoSeller.cs | 4 +- SimulationHelper.cs | 32 ++- 3 files changed, 334 insertions(+), 321 deletions(-) diff --git a/AutoSeller.Designer.cs b/AutoSeller.Designer.cs index 453605c..0f05b1d 100644 --- a/AutoSeller.Designer.cs +++ b/AutoSeller.Designer.cs @@ -35,24 +35,7 @@ this.btSell = new MaterialSkin.Controls.MaterialRaisedButton(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - 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())); - this.chCurPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chBookValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chCapitalGains = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chAssessedValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chValuation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chYield = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chMaxPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chCheckCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.tbLog = new System.Windows.Forms.RichTextBox(); - this.lvCurPrice = new AutoSellerNS.ListViewNF(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chAskCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chCallPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chBidCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.btUpdate = new MaterialSkin.Controls.MaterialRaisedButton(); this.btCybos = new MaterialSkin.Controls.MaterialRaisedButton(); this.tabPage2 = new System.Windows.Forms.TabPage(); @@ -70,8 +53,26 @@ this.tbSubAccount = new MaterialSkin.Controls.MaterialSingleLineTextField(); this.cbAccount = new System.Windows.Forms.ComboBox(); this.tabPage3 = new System.Windows.Forms.TabPage(); - this.btLoad = new MaterialSkin.Controls.MaterialFlatButton(); 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())); + this.chCurPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chBookValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chCapitalGains = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chAssessedValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chValuation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chYield = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chMaxPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chCheckCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.lvCurPrice = new AutoSellerNS.ListViewNF(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chAskCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chCallPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chBidCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.materialTabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); @@ -182,6 +183,301 @@ this.splitContainer1.SplitterDistance = 353; this.splitContainer1.TabIndex = 1; // + // tbLog + // + this.tbLog.Dock = System.Windows.Forms.DockStyle.Fill; + this.tbLog.Location = new System.Drawing.Point(0, 0); + this.tbLog.Name = "tbLog"; + this.tbLog.Size = new System.Drawing.Size(804, 151); + this.tbLog.TabIndex = 0; + this.tbLog.Text = ""; + // + // btUpdate + // + this.btUpdate.AutoSize = true; + this.btUpdate.Depth = 0; + this.btUpdate.Location = new System.Drawing.Point(74, 3); + this.btUpdate.MouseState = MaterialSkin.MouseState.HOVER; + this.btUpdate.Name = "btUpdate"; + this.btUpdate.Primary = true; + this.btUpdate.Size = new System.Drawing.Size(68, 28); + this.btUpdate.TabIndex = 3; + this.btUpdate.Text = "Update"; + this.btUpdate.UseVisualStyleBackColor = true; + this.btUpdate.Click += new System.EventHandler(this.btUpdate_Click); + // + // btCybos + // + this.btCybos.AutoSize = true; + this.btCybos.Depth = 0; + this.btCybos.Location = new System.Drawing.Point(3, 3); + this.btCybos.MouseState = MaterialSkin.MouseState.HOVER; + this.btCybos.Name = "btCybos"; + this.btCybos.Primary = true; + this.btCybos.Size = new System.Drawing.Size(66, 28); + this.btCybos.TabIndex = 3; + this.btCybos.Text = "Cybos"; + this.btCybos.UseVisualStyleBackColor = true; + this.btCybos.Click += new System.EventHandler(this.btCybos_Click); + // + // tabPage2 + // + this.tabPage2.BackColor = System.Drawing.Color.White; + this.tabPage2.Controls.Add(this.materialLabel7); + this.tabPage2.Controls.Add(this.tbTrailingCnt); + this.tabPage2.Controls.Add(this.materialLabel6); + this.tabPage2.Controls.Add(this.tbTrailingP); + this.tabPage2.Controls.Add(this.materialLabel5); + this.tabPage2.Controls.Add(this.materialLabel4); + this.tabPage2.Controls.Add(this.materialLabel3); + this.tabPage2.Controls.Add(this.materialLabel2); + this.tabPage2.Controls.Add(this.tbBidCount); + this.tabPage2.Controls.Add(this.materialLabel1); + this.tabPage2.Controls.Add(this.btApply); + this.tabPage2.Controls.Add(this.tbSubAccount); + this.tabPage2.Controls.Add(this.cbAccount); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(1060, 546); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Preference"; + // + // materialLabel7 + // + this.materialLabel7.AutoSize = true; + this.materialLabel7.Depth = 0; + this.materialLabel7.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel7.Location = new System.Drawing.Point(224, 229); + this.materialLabel7.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel7.Name = "materialLabel7"; + this.materialLabel7.Size = new System.Drawing.Size(21, 18); + this.materialLabel7.TabIndex = 12; + this.materialLabel7.Text = "회"; + // + // tbTrailingCnt + // + this.tbTrailingCnt.Depth = 0; + this.tbTrailingCnt.Hint = ""; + this.tbTrailingCnt.Location = new System.Drawing.Point(188, 225); + this.tbTrailingCnt.MouseState = MaterialSkin.MouseState.HOVER; + this.tbTrailingCnt.Name = "tbTrailingCnt"; + this.tbTrailingCnt.PasswordChar = '\0'; + this.tbTrailingCnt.SelectedText = ""; + this.tbTrailingCnt.SelectionLength = 0; + this.tbTrailingCnt.SelectionStart = 0; + this.tbTrailingCnt.Size = new System.Drawing.Size(30, 23); + this.tbTrailingCnt.TabIndex = 11; + this.tbTrailingCnt.Text = "2"; + this.tbTrailingCnt.UseSystemPasswordChar = false; + // + // materialLabel6 + // + this.materialLabel6.AutoSize = true; + this.materialLabel6.Depth = 0; + this.materialLabel6.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel6.Location = new System.Drawing.Point(152, 229); + this.materialLabel6.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel6.Name = "materialLabel6"; + this.materialLabel6.Size = new System.Drawing.Size(21, 18); + this.materialLabel6.TabIndex = 10; + this.materialLabel6.Text = "%"; + // + // tbTrailingP + // + this.tbTrailingP.Depth = 0; + this.tbTrailingP.Hint = ""; + this.tbTrailingP.Location = new System.Drawing.Point(116, 225); + this.tbTrailingP.MouseState = MaterialSkin.MouseState.HOVER; + this.tbTrailingP.Name = "tbTrailingP"; + this.tbTrailingP.PasswordChar = '\0'; + this.tbTrailingP.SelectedText = ""; + this.tbTrailingP.SelectionLength = 0; + this.tbTrailingP.SelectionStart = 0; + this.tbTrailingP.Size = new System.Drawing.Size(30, 23); + this.tbTrailingP.TabIndex = 9; + this.tbTrailingP.Text = "1.0"; + this.tbTrailingP.UseSystemPasswordChar = false; + // + // materialLabel5 + // + this.materialLabel5.AutoSize = true; + this.materialLabel5.Depth = 0; + this.materialLabel5.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel5.Location = new System.Drawing.Point(25, 229); + this.materialLabel5.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel5.Name = "materialLabel5"; + this.materialLabel5.Size = new System.Drawing.Size(77, 18); + this.materialLabel5.TabIndex = 8; + this.materialLabel5.Text = "최고가 대비"; + // + // materialLabel4 + // + this.materialLabel4.AutoSize = true; + this.materialLabel4.Depth = 0; + this.materialLabel4.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel4.Location = new System.Drawing.Point(25, 144); + this.materialLabel4.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel4.Name = "materialLabel4"; + this.materialLabel4.Size = new System.Drawing.Size(64, 18); + this.materialLabel4.TabIndex = 7; + this.materialLabel4.Text = "조건 횟수"; + // + // materialLabel3 + // + this.materialLabel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.materialLabel3.AutoSize = true; + this.materialLabel3.Depth = 0; + this.materialLabel3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel3.Location = new System.Drawing.Point(6, 524); + this.materialLabel3.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel3.Name = "materialLabel3"; + this.materialLabel3.Size = new System.Drawing.Size(162, 18); + this.materialLabel3.TabIndex = 6; + this.materialLabel3.Text = "Version : 2017.02.07.09"; + // + // materialLabel2 + // + this.materialLabel2.AutoSize = true; + this.materialLabel2.Depth = 0; + this.materialLabel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel2.Location = new System.Drawing.Point(152, 148); + this.materialLabel2.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel2.Name = "materialLabel2"; + this.materialLabel2.Size = new System.Drawing.Size(21, 18); + this.materialLabel2.TabIndex = 5; + this.materialLabel2.Text = "회"; + // + // tbBidCount + // + this.tbBidCount.Depth = 0; + this.tbBidCount.Hint = ""; + this.tbBidCount.Location = new System.Drawing.Point(116, 144); + this.tbBidCount.MouseState = MaterialSkin.MouseState.HOVER; + this.tbBidCount.Name = "tbBidCount"; + this.tbBidCount.PasswordChar = '\0'; + this.tbBidCount.SelectedText = ""; + this.tbBidCount.SelectionLength = 0; + this.tbBidCount.SelectionStart = 0; + this.tbBidCount.Size = new System.Drawing.Size(30, 23); + this.tbBidCount.TabIndex = 4; + this.tbBidCount.Text = "5"; + this.tbBidCount.UseSystemPasswordChar = false; + // + // materialLabel1 + // + this.materialLabel1.AutoSize = true; + this.materialLabel1.Depth = 0; + this.materialLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); + this.materialLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialLabel1.Location = new System.Drawing.Point(25, 29); + this.materialLabel1.MouseState = MaterialSkin.MouseState.HOVER; + this.materialLabel1.Name = "materialLabel1"; + this.materialLabel1.Size = new System.Drawing.Size(62, 18); + this.materialLabel1.TabIndex = 3; + this.materialLabel1.Text = "Account"; + // + // btApply + // + this.btApply.AutoSize = true; + this.btApply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btApply.Depth = 0; + this.btApply.Location = new System.Drawing.Point(844, 483); + this.btApply.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btApply.MinimumSize = new System.Drawing.Size(120, 36); + this.btApply.MouseState = MaterialSkin.MouseState.HOVER; + this.btApply.Name = "btApply"; + this.btApply.Primary = false; + this.btApply.Size = new System.Drawing.Size(120, 36); + this.btApply.TabIndex = 2; + this.btApply.Text = "적용하기"; + this.btApply.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.btApply.UseVisualStyleBackColor = true; + this.btApply.Click += new System.EventHandler(this.btApply_Click); + // + // tbSubAccount + // + this.tbSubAccount.Depth = 0; + this.tbSubAccount.Hint = ""; + this.tbSubAccount.Location = new System.Drawing.Point(154, 62); + this.tbSubAccount.MouseState = MaterialSkin.MouseState.HOVER; + this.tbSubAccount.Name = "tbSubAccount"; + this.tbSubAccount.PasswordChar = '\0'; + this.tbSubAccount.SelectedText = ""; + this.tbSubAccount.SelectionLength = 0; + this.tbSubAccount.SelectionStart = 0; + this.tbSubAccount.Size = new System.Drawing.Size(25, 23); + this.tbSubAccount.TabIndex = 1; + this.tbSubAccount.Text = "10"; + this.tbSubAccount.UseSystemPasswordChar = false; + // + // cbAccount + // + this.cbAccount.FormattingEnabled = true; + this.cbAccount.Location = new System.Drawing.Point(25, 62); + this.cbAccount.Name = "cbAccount"; + this.cbAccount.Size = new System.Drawing.Size(121, 20); + this.cbAccount.TabIndex = 0; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.tbSimulationLog); + this.tabPage3.Controls.Add(this.btSimulate); + this.tabPage3.Controls.Add(this.btLoad); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(1060, 546); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Simulation"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // btSimulate + // + this.btSimulate.AutoSize = true; + this.btSimulate.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btSimulate.Depth = 0; + this.btSimulate.Location = new System.Drawing.Point(44, 95); + this.btSimulate.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btSimulate.MouseState = MaterialSkin.MouseState.HOVER; + this.btSimulate.Name = "btSimulate"; + this.btSimulate.Primary = false; + this.btSimulate.Size = new System.Drawing.Size(139, 36); + this.btSimulate.TabIndex = 1; + this.btSimulate.Text = "simulation start"; + this.btSimulate.UseVisualStyleBackColor = true; + this.btSimulate.Click += new System.EventHandler(this.btSimulate_Click); + // + // btLoad + // + this.btLoad.AutoSize = true; + this.btLoad.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btLoad.Depth = 0; + this.btLoad.Location = new System.Drawing.Point(44, 47); + this.btLoad.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); + this.btLoad.MouseState = MaterialSkin.MouseState.HOVER; + this.btLoad.Name = "btLoad"; + this.btLoad.Primary = false; + this.btLoad.Size = new System.Drawing.Size(86, 36); + this.btLoad.TabIndex = 0; + this.btLoad.Text = "Load data"; + 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[] { @@ -268,15 +564,6 @@ this.chCheckCount.Text = "조건횟수"; this.chCheckCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // - // tbLog - // - this.tbLog.Dock = System.Windows.Forms.DockStyle.Fill; - this.tbLog.Location = new System.Drawing.Point(0, 0); - this.tbLog.Name = "tbLog"; - this.tbLog.Size = new System.Drawing.Size(804, 151); - this.tbLog.TabIndex = 0; - this.tbLog.Text = ""; - // // lvCurPrice // this.lvCurPrice.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { @@ -315,283 +602,6 @@ this.chBidCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.chBidCount.Width = 75; // - // btUpdate - // - this.btUpdate.AutoSize = true; - this.btUpdate.Depth = 0; - this.btUpdate.Location = new System.Drawing.Point(74, 3); - this.btUpdate.MouseState = MaterialSkin.MouseState.HOVER; - this.btUpdate.Name = "btUpdate"; - this.btUpdate.Primary = true; - this.btUpdate.Size = new System.Drawing.Size(68, 28); - this.btUpdate.TabIndex = 3; - this.btUpdate.Text = "Update"; - this.btUpdate.UseVisualStyleBackColor = true; - this.btUpdate.Click += new System.EventHandler(this.btUpdate_Click); - // - // btCybos - // - this.btCybos.AutoSize = true; - this.btCybos.Depth = 0; - this.btCybos.Location = new System.Drawing.Point(3, 3); - this.btCybos.MouseState = MaterialSkin.MouseState.HOVER; - this.btCybos.Name = "btCybos"; - this.btCybos.Primary = true; - this.btCybos.Size = new System.Drawing.Size(66, 28); - this.btCybos.TabIndex = 3; - this.btCybos.Text = "Cybos"; - this.btCybos.UseVisualStyleBackColor = true; - this.btCybos.Click += new System.EventHandler(this.btCybos_Click); - // - // tabPage2 - // - this.tabPage2.BackColor = System.Drawing.Color.White; - this.tabPage2.Controls.Add(this.materialLabel7); - this.tabPage2.Controls.Add(this.tbTrailingCnt); - this.tabPage2.Controls.Add(this.materialLabel6); - this.tabPage2.Controls.Add(this.tbTrailingP); - this.tabPage2.Controls.Add(this.materialLabel5); - this.tabPage2.Controls.Add(this.materialLabel4); - this.tabPage2.Controls.Add(this.materialLabel3); - this.tabPage2.Controls.Add(this.materialLabel2); - this.tabPage2.Controls.Add(this.tbBidCount); - this.tabPage2.Controls.Add(this.materialLabel1); - this.tabPage2.Controls.Add(this.btApply); - this.tabPage2.Controls.Add(this.tbSubAccount); - this.tabPage2.Controls.Add(this.cbAccount); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1060, 546); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Preference"; - // - // materialLabel7 - // - this.materialLabel7.AutoSize = true; - this.materialLabel7.Depth = 0; - this.materialLabel7.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel7.Location = new System.Drawing.Point(224, 229); - this.materialLabel7.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel7.Name = "materialLabel7"; - this.materialLabel7.Size = new System.Drawing.Size(20, 19); - this.materialLabel7.TabIndex = 12; - this.materialLabel7.Text = "회"; - // - // tbTrailingCnt - // - this.tbTrailingCnt.Depth = 0; - this.tbTrailingCnt.Hint = ""; - this.tbTrailingCnt.Location = new System.Drawing.Point(188, 225); - this.tbTrailingCnt.MouseState = MaterialSkin.MouseState.HOVER; - this.tbTrailingCnt.Name = "tbTrailingCnt"; - this.tbTrailingCnt.PasswordChar = '\0'; - this.tbTrailingCnt.SelectedText = ""; - this.tbTrailingCnt.SelectionLength = 0; - this.tbTrailingCnt.SelectionStart = 0; - this.tbTrailingCnt.Size = new System.Drawing.Size(30, 23); - this.tbTrailingCnt.TabIndex = 11; - this.tbTrailingCnt.Text = "2"; - this.tbTrailingCnt.UseSystemPasswordChar = false; - // - // materialLabel6 - // - this.materialLabel6.AutoSize = true; - this.materialLabel6.Depth = 0; - this.materialLabel6.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel6.Location = new System.Drawing.Point(152, 229); - this.materialLabel6.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel6.Name = "materialLabel6"; - this.materialLabel6.Size = new System.Drawing.Size(20, 19); - this.materialLabel6.TabIndex = 10; - this.materialLabel6.Text = "%"; - // - // tbTrailingP - // - this.tbTrailingP.Depth = 0; - this.tbTrailingP.Hint = ""; - this.tbTrailingP.Location = new System.Drawing.Point(116, 225); - this.tbTrailingP.MouseState = MaterialSkin.MouseState.HOVER; - this.tbTrailingP.Name = "tbTrailingP"; - this.tbTrailingP.PasswordChar = '\0'; - this.tbTrailingP.SelectedText = ""; - this.tbTrailingP.SelectionLength = 0; - this.tbTrailingP.SelectionStart = 0; - this.tbTrailingP.Size = new System.Drawing.Size(30, 23); - this.tbTrailingP.TabIndex = 9; - this.tbTrailingP.Text = "1.0"; - this.tbTrailingP.UseSystemPasswordChar = false; - // - // materialLabel5 - // - this.materialLabel5.AutoSize = true; - this.materialLabel5.Depth = 0; - this.materialLabel5.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel5.Location = new System.Drawing.Point(25, 229); - this.materialLabel5.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel5.Name = "materialLabel5"; - this.materialLabel5.Size = new System.Drawing.Size(68, 19); - this.materialLabel5.TabIndex = 8; - this.materialLabel5.Text = "최고가 대비"; - // - // materialLabel4 - // - this.materialLabel4.AutoSize = true; - this.materialLabel4.Depth = 0; - this.materialLabel4.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel4.Location = new System.Drawing.Point(25, 144); - this.materialLabel4.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel4.Name = "materialLabel4"; - this.materialLabel4.Size = new System.Drawing.Size(57, 19); - this.materialLabel4.TabIndex = 7; - this.materialLabel4.Text = "조건 횟수"; - // - // materialLabel3 - // - this.materialLabel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.materialLabel3.AutoSize = true; - this.materialLabel3.Depth = 0; - this.materialLabel3.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel3.Location = new System.Drawing.Point(6, 524); - this.materialLabel3.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel3.Name = "materialLabel3"; - this.materialLabel3.Size = new System.Drawing.Size(165, 19); - this.materialLabel3.TabIndex = 6; - this.materialLabel3.Text = "Version : 2017.02.07.09"; - // - // materialLabel2 - // - this.materialLabel2.AutoSize = true; - this.materialLabel2.Depth = 0; - this.materialLabel2.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel2.Location = new System.Drawing.Point(152, 148); - this.materialLabel2.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel2.Name = "materialLabel2"; - this.materialLabel2.Size = new System.Drawing.Size(20, 19); - this.materialLabel2.TabIndex = 5; - this.materialLabel2.Text = "회"; - // - // tbBidCount - // - this.tbBidCount.Depth = 0; - this.tbBidCount.Hint = ""; - this.tbBidCount.Location = new System.Drawing.Point(116, 144); - this.tbBidCount.MouseState = MaterialSkin.MouseState.HOVER; - this.tbBidCount.Name = "tbBidCount"; - this.tbBidCount.PasswordChar = '\0'; - this.tbBidCount.SelectedText = ""; - this.tbBidCount.SelectionLength = 0; - this.tbBidCount.SelectionStart = 0; - this.tbBidCount.Size = new System.Drawing.Size(30, 23); - this.tbBidCount.TabIndex = 4; - this.tbBidCount.Text = "5"; - this.tbBidCount.UseSystemPasswordChar = false; - // - // materialLabel1 - // - this.materialLabel1.AutoSize = true; - this.materialLabel1.Depth = 0; - this.materialLabel1.Font = new System.Drawing.Font("Roboto", 11F); - this.materialLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.materialLabel1.Location = new System.Drawing.Point(25, 29); - this.materialLabel1.MouseState = MaterialSkin.MouseState.HOVER; - this.materialLabel1.Name = "materialLabel1"; - this.materialLabel1.Size = new System.Drawing.Size(65, 19); - this.materialLabel1.TabIndex = 3; - this.materialLabel1.Text = "Account"; - // - // btApply - // - this.btApply.AutoSize = true; - this.btApply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btApply.Depth = 0; - this.btApply.Location = new System.Drawing.Point(844, 483); - this.btApply.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); - this.btApply.MinimumSize = new System.Drawing.Size(120, 36); - this.btApply.MouseState = MaterialSkin.MouseState.HOVER; - this.btApply.Name = "btApply"; - this.btApply.Primary = false; - this.btApply.Size = new System.Drawing.Size(120, 36); - this.btApply.TabIndex = 2; - this.btApply.Text = "적용하기"; - this.btApply.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.btApply.UseVisualStyleBackColor = true; - this.btApply.Click += new System.EventHandler(this.btApply_Click); - // - // tbSubAccount - // - this.tbSubAccount.Depth = 0; - this.tbSubAccount.Hint = ""; - this.tbSubAccount.Location = new System.Drawing.Point(154, 62); - this.tbSubAccount.MouseState = MaterialSkin.MouseState.HOVER; - this.tbSubAccount.Name = "tbSubAccount"; - this.tbSubAccount.PasswordChar = '\0'; - this.tbSubAccount.SelectedText = ""; - this.tbSubAccount.SelectionLength = 0; - this.tbSubAccount.SelectionStart = 0; - this.tbSubAccount.Size = new System.Drawing.Size(25, 23); - this.tbSubAccount.TabIndex = 1; - this.tbSubAccount.Text = "10"; - this.tbSubAccount.UseSystemPasswordChar = false; - // - // cbAccount - // - this.cbAccount.FormattingEnabled = true; - this.cbAccount.Location = new System.Drawing.Point(25, 62); - this.cbAccount.Name = "cbAccount"; - this.cbAccount.Size = new System.Drawing.Size(121, 20); - this.cbAccount.TabIndex = 0; - // - // tabPage3 - // - this.tabPage3.Controls.Add(this.btSimulate); - this.tabPage3.Controls.Add(this.btLoad); - this.tabPage3.Location = new System.Drawing.Point(4, 22); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(1060, 546); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Simulation"; - this.tabPage3.UseVisualStyleBackColor = true; - // - // btLoad - // - this.btLoad.AutoSize = true; - this.btLoad.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btLoad.Depth = 0; - this.btLoad.Location = new System.Drawing.Point(44, 47); - this.btLoad.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); - this.btLoad.MouseState = MaterialSkin.MouseState.HOVER; - this.btLoad.Name = "btLoad"; - this.btLoad.Primary = false; - this.btLoad.Size = new System.Drawing.Size(86, 36); - this.btLoad.TabIndex = 0; - this.btLoad.Text = "Load data"; - this.btLoad.UseVisualStyleBackColor = true; - this.btLoad.Click += new System.EventHandler(this.btLoad_Click); - // - // btSimulate - // - this.btSimulate.AutoSize = true; - this.btSimulate.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btSimulate.Depth = 0; - this.btSimulate.Location = new System.Drawing.Point(44, 95); - this.btSimulate.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); - this.btSimulate.MouseState = MaterialSkin.MouseState.HOVER; - this.btSimulate.Name = "btSimulate"; - this.btSimulate.Primary = false; - this.btSimulate.Size = new System.Drawing.Size(139, 36); - this.btSimulate.TabIndex = 1; - this.btSimulate.Text = "simulation start"; - this.btSimulate.UseVisualStyleBackColor = true; - this.btSimulate.Click += new System.EventHandler(this.btSimulate_Click); - // // AutoSeller // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -665,5 +675,6 @@ private System.Windows.Forms.TabPage tabPage3; private MaterialSkin.Controls.MaterialFlatButton btLoad; private MaterialSkin.Controls.MaterialFlatButton btSimulate; + private System.Windows.Forms.RichTextBox tbSimulationLog; } } \ No newline at end of file diff --git a/AutoSeller.cs b/AutoSeller.cs index f933c7c..1451ec8 100644 --- a/AutoSeller.cs +++ b/AutoSeller.cs @@ -366,13 +366,13 @@ namespace AutoSellerNS #region Simulation private void btLoad_Click(object sender, EventArgs e) { - SimulationHelper helper = new SimulationHelper(m_CybosHelper); + SimulationHelper helper = new SimulationHelper(m_CybosHelper, tbSimulationLog); helper.LoadExcel(); } private void btSimulate_Click(object sender, EventArgs e) { - SimulationHelper helper = new SimulationHelper(m_CybosHelper); + SimulationHelper helper = new SimulationHelper(m_CybosHelper, tbSimulationLog); helper.StartSimuation(); } #endregion diff --git a/SimulationHelper.cs b/SimulationHelper.cs index 5db3127..a18670f 100644 --- a/SimulationHelper.cs +++ b/SimulationHelper.cs @@ -6,19 +6,19 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace AutoSellerNS { class SimulationHelper { CybosHelper m_CybosHelper = null; - class SIMUL_ITEM - { - } + RichTextBox m_tbLogView = null; - public SimulationHelper(CybosHelper CybosHelper) + public SimulationHelper(CybosHelper CybosHelper, RichTextBox tbLog) { m_CybosHelper = CybosHelper; + m_tbLogView = tbLog; } public void LoadTxt() @@ -92,7 +92,7 @@ namespace AutoSellerNS if(bContinue == true) CPStockChart.BlockRequest2(0); - Console.WriteLine(string.Format("RequestRQ({0})", m_CybosHelper.GetLimitRemainCountRQ())); + m_tbLogView.AppendText(string.Format("RequestRQ({0})", m_CybosHelper.GetLimitRemainCountRQ())); } if(strOutLine.Length > 0) @@ -101,10 +101,10 @@ namespace AutoSellerNS strOutLine = ""; } - Console.WriteLine("[Load] " + strOutFileName + " End"); + m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End")); } - Console.WriteLine("[Load] All End"); + m_tbLogView.AppendText(string.Format("[Load] All End")); } public void LoadExcel() @@ -162,20 +162,22 @@ namespace AutoSellerNS if(bContinue == true) CPStockChart.BlockRequest2(0); - Console.WriteLine(string.Format("RequestRQ({0})", m_CybosHelper.GetLimitRemainCountRQ())); + m_tbLogView.AppendText(string.Format("RequestRQ({0})\n", m_CybosHelper.GetLimitRemainCountRQ())); } aRows.Reverse(); Excel.AddRows(aRows.ToArray()); - Console.WriteLine("[Load] " + strOutFileName + " End"); + m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End\n")); } - Console.WriteLine("[Load] All End"); + m_tbLogView.AppendText(string.Format("[Load] All End\n\n")); } public void StartSimuation() { + m_tbLogView.AppendText(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n", Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt())); + int iTotalProfit = 0; int iTotalBid = 0; @@ -243,14 +245,14 @@ namespace AutoSellerNS if(iAskCount >= Config.GetBidCount()) { - Console.WriteLine("[{0}] 시뮬레이션 매도 {1} {2} {3} ({4} : {5:n2}%)", + m_tbLogView.AppendText(string.Format("[{0}] 시뮬레이션 매도 {1} {2} {3} ({4} : {5:n2}%)\n", strCodeName, RowDT.ToString("yyyy-MM-dd HH:mm:00"), iRow, iPrice, iPrice-iStartPrice, (iPrice-iStartPrice)*100/(float)iStartPrice - ); + )); iTotalProfit += (iPrice-iStartPrice)*iStockCount; iTotalBid += iStartPrice*iStockCount; break; @@ -264,14 +266,14 @@ namespace AutoSellerNS if(iTrailingCount >= Config.GetTrailingCnt()) { - Console.WriteLine("[{0}] 트레일링 매도 {1} {2} {3} ({4} : {5:n2}%)", + m_tbLogView.AppendText(string.Format("[{0}] 트레일링 매도 {1} {2} {3} ({4} : {5:n2}%)\n", strCodeName, RowDT.ToString("yyyy-MM-dd HH:mm:00"), iRow, iPrice, iPrice-iStartPrice, (iPrice-iStartPrice)*100/(float)iStartPrice - ); + )); iTotalProfit += (iPrice-iStartPrice)*iStockCount; iTotalBid += iStartPrice*iStockCount; break; @@ -283,7 +285,7 @@ namespace AutoSellerNS } } - Console.WriteLine("[시뮬레이션 종료] 총수익 : {0} : {1:n2}%", iTotalProfit, iTotalProfit*100/iTotalBid); + m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0} : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/iTotalBid)); } } }