From f4872096c64cdfae164102ba8879fde48502e696 Mon Sep 17 00:00:00 2001 From: mjjo Date: Wed, 22 Feb 2017 23:44:44 +0900 Subject: [PATCH] =?UTF-8?q?-=20=EB=A7=A4=EB=8F=84=20=EC=A0=95=EC=A0=95=20?= =?UTF-8?q?=EC=A3=BC=EB=AC=B8=20=EC=B6=94=EA=B0=80=20(3=EC=B4=88=EB=A7=88?= =?UTF-8?q?=EB=8B=A4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoSeller.Designer.cs | 464 ++++++++++++++++++++--------------------- AutoSeller.cs | 58 +++++- CybosHelper.cs | 16 ++ 3 files changed, 297 insertions(+), 241 deletions(-) diff --git a/AutoSeller.Designer.cs b/AutoSeller.Designer.cs index 8237049..bdcdbcf 100644 --- a/AutoSeller.Designer.cs +++ b/AutoSeller.Designer.cs @@ -35,31 +35,7 @@ this.btSell = new MaterialSkin.Controls.MaterialRaisedButton(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.splitContainer3 = 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.lvNCItem = new AutoSellerNS.ListViewNF(); - this.chNCCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chNCCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chNCType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chNCPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chNCCount = ((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(); @@ -88,6 +64,30 @@ this.tbSimulationLog = new System.Windows.Forms.RichTextBox(); this.btSimulate = new MaterialSkin.Controls.MaterialFlatButton(); this.btLoad = new MaterialSkin.Controls.MaterialFlatButton(); + this.splitContainer3 = 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.lvNCItem = new AutoSellerNS.ListViewNF(); + this.chNCCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chNCCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chNCType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chNCPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chNCCount = ((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(); @@ -98,12 +98,12 @@ this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabPage3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout(); this.splitContainer3.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.tabPage3.SuspendLayout(); this.SuspendLayout(); // // materialTabSelector1 @@ -202,155 +202,6 @@ this.splitContainer1.SplitterDistance = 455; this.splitContainer1.TabIndex = 1; // - // splitContainer3 - // - this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer3.Location = new System.Drawing.Point(0, 0); - this.splitContainer3.Name = "splitContainer3"; - this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer3.Panel1 - // - this.splitContainer3.Panel1.Controls.Add(this.lvItems); - // - // splitContainer3.Panel2 - // - this.splitContainer3.Panel2.Controls.Add(this.lvNCItem); - this.splitContainer3.Size = new System.Drawing.Size(804, 455); - this.splitContainer3.SplitterDistance = 300; - this.splitContainer3.TabIndex = 1; - // - // lvItems - // - this.lvItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.chCode, - this.chCodeName, - this.chCurPrice, - this.chCount, - this.chBookValue, - this.chCapitalGains, - this.chAssessedValue, - this.chValuation, - this.chYield, - this.chMaxPrice, - this.chCheckCount}); - this.lvItems.Dock = System.Windows.Forms.DockStyle.Fill; - this.lvItems.FullRowSelect = true; - this.lvItems.GridLines = true; - this.lvItems.Location = new System.Drawing.Point(0, 0); - this.lvItems.Name = "lvItems"; - this.lvItems.Size = new System.Drawing.Size(804, 300); - this.lvItems.TabIndex = 0; - this.lvItems.UseCompatibleStateImageBehavior = false; - this.lvItems.View = System.Windows.Forms.View.Details; - this.lvItems.SelectedIndexChanged += new System.EventHandler(this.lvList_SelectedIndexChanged); - // - // chCode - // - this.chCode.Text = "코드"; - this.chCode.Width = 77; - // - // chCodeName - // - this.chCodeName.Text = "종목명"; - this.chCodeName.Width = 86; - // - // chCurPrice - // - this.chCurPrice.Text = "현재가"; - this.chCurPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chCurPrice.Width = 71; - // - // chCount - // - this.chCount.Text = "잔고수량"; - this.chCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // chBookValue - // - this.chBookValue.Text = "장부가"; - this.chBookValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chBookValue.Width = 72; - // - // chCapitalGains - // - this.chCapitalGains.Text = "손익단가"; - this.chCapitalGains.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chCapitalGains.Width = 73; - // - // chAssessedValue - // - this.chAssessedValue.Text = "평가금액"; - this.chAssessedValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chAssessedValue.Width = 76; - // - // chValuation - // - this.chValuation.Text = "평가손익"; - this.chValuation.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chValuation.Width = 79; - // - // chYield - // - this.chYield.Text = "수익률"; - this.chYield.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chYield.Width = 79; - // - // chMaxPrice - // - this.chMaxPrice.Text = "최고가"; - this.chMaxPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // chCheckCount - // - this.chCheckCount.Text = "조건횟수"; - this.chCheckCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // lvNCItem - // - this.lvNCItem.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.chNCCode, - this.chNCCodeName, - this.chNCType, - this.chNCPrice, - this.chNCCount}); - this.lvNCItem.Dock = System.Windows.Forms.DockStyle.Fill; - this.lvNCItem.FullRowSelect = true; - this.lvNCItem.GridLines = true; - this.lvNCItem.Location = new System.Drawing.Point(0, 0); - this.lvNCItem.Name = "lvNCItem"; - this.lvNCItem.Size = new System.Drawing.Size(804, 151); - this.lvNCItem.TabIndex = 1; - this.lvNCItem.UseCompatibleStateImageBehavior = false; - this.lvNCItem.View = System.Windows.Forms.View.Details; - // - // chNCCode - // - this.chNCCode.Text = "코드"; - this.chNCCode.Width = 77; - // - // chNCCodeName - // - this.chNCCodeName.Text = "종목명"; - this.chNCCodeName.Width = 86; - // - // chNCType - // - this.chNCType.Text = "매매구분"; - this.chNCType.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chNCType.Width = 71; - // - // chNCPrice - // - this.chNCPrice.Text = "주문단가"; - this.chNCPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chNCPrice.Width = 72; - // - // chNCCount - // - this.chNCCount.Text = "미체결량"; - this.chNCCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // // tbLog // this.tbLog.Dock = System.Windows.Forms.DockStyle.Fill; @@ -360,44 +211,6 @@ this.tbLog.TabIndex = 0; this.tbLog.Text = ""; // - // lvCurPrice - // - this.lvCurPrice.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.chAskCount, - this.chCallPrice, - this.chBidCount}); - this.lvCurPrice.Dock = System.Windows.Forms.DockStyle.Fill; - this.lvCurPrice.FullRowSelect = true; - this.lvCurPrice.GridLines = true; - this.lvCurPrice.Location = new System.Drawing.Point(0, 0); - this.lvCurPrice.Name = "lvCurPrice"; - this.lvCurPrice.Size = new System.Drawing.Size(246, 655); - this.lvCurPrice.TabIndex = 0; - this.lvCurPrice.UseCompatibleStateImageBehavior = false; - this.lvCurPrice.View = System.Windows.Forms.View.Details; - // - // columnHeader1 - // - this.columnHeader1.Width = 10; - // - // chAskCount - // - this.chAskCount.Text = "매도잔량"; - this.chAskCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chAskCount.Width = 75; - // - // chCallPrice - // - this.chCallPrice.Text = "호가"; - this.chCallPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // chBidCount - // - this.chBidCount.Text = "매수잔량"; - this.chBidCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.chBidCount.Width = 75; - // // btUpdate // this.btUpdate.AutoSize = true; @@ -453,12 +266,12 @@ // this.materialLabel7.AutoSize = true; this.materialLabel7.Depth = 0; - this.materialLabel7.Font = new System.Drawing.Font("Roboto", 11F); + 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(20, 19); + this.materialLabel7.Size = new System.Drawing.Size(21, 18); this.materialLabel7.TabIndex = 12; this.materialLabel7.Text = "회"; // @@ -482,12 +295,12 @@ // this.materialLabel6.AutoSize = true; this.materialLabel6.Depth = 0; - this.materialLabel6.Font = new System.Drawing.Font("Roboto", 11F); + 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(20, 19); + this.materialLabel6.Size = new System.Drawing.Size(21, 18); this.materialLabel6.TabIndex = 10; this.materialLabel6.Text = "%"; // @@ -511,12 +324,12 @@ // this.materialLabel5.AutoSize = true; this.materialLabel5.Depth = 0; - this.materialLabel5.Font = new System.Drawing.Font("Roboto", 11F); + 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(68, 19); + this.materialLabel5.Size = new System.Drawing.Size(77, 18); this.materialLabel5.TabIndex = 8; this.materialLabel5.Text = "최고가 대비"; // @@ -524,12 +337,12 @@ // this.materialLabel4.AutoSize = true; this.materialLabel4.Depth = 0; - this.materialLabel4.Font = new System.Drawing.Font("Roboto", 11F); + 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(57, 19); + this.materialLabel4.Size = new System.Drawing.Size(64, 18); this.materialLabel4.TabIndex = 7; this.materialLabel4.Text = "조건 횟수"; // @@ -538,25 +351,25 @@ 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.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, 671); this.materialLabel3.MouseState = MaterialSkin.MouseState.HOVER; this.materialLabel3.Name = "materialLabel3"; - this.materialLabel3.Size = new System.Drawing.Size(165, 19); + this.materialLabel3.Size = new System.Drawing.Size(162, 18); this.materialLabel3.TabIndex = 6; - this.materialLabel3.Text = "Version : 2017.02.22.20"; + this.materialLabel3.Text = "Version : 2017.02.22.23"; // // materialLabel2 // this.materialLabel2.AutoSize = true; this.materialLabel2.Depth = 0; - this.materialLabel2.Font = new System.Drawing.Font("Roboto", 11F); + 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(20, 19); + this.materialLabel2.Size = new System.Drawing.Size(21, 18); this.materialLabel2.TabIndex = 5; this.materialLabel2.Text = "회"; // @@ -580,12 +393,12 @@ // this.materialLabel1.AutoSize = true; this.materialLabel1.Depth = 0; - this.materialLabel1.Font = new System.Drawing.Font("Roboto", 11F); + 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(65, 19); + this.materialLabel1.Size = new System.Drawing.Size(62, 18); this.materialLabel1.TabIndex = 3; this.materialLabel1.Text = "Account"; // @@ -763,6 +576,193 @@ this.btLoad.UseVisualStyleBackColor = true; this.btLoad.Click += new System.EventHandler(this.btLoad_Click); // + // splitContainer3 + // + this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer3.Location = new System.Drawing.Point(0, 0); + this.splitContainer3.Name = "splitContainer3"; + this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer3.Panel1 + // + this.splitContainer3.Panel1.Controls.Add(this.lvItems); + // + // splitContainer3.Panel2 + // + this.splitContainer3.Panel2.Controls.Add(this.lvNCItem); + this.splitContainer3.Size = new System.Drawing.Size(804, 455); + this.splitContainer3.SplitterDistance = 300; + this.splitContainer3.TabIndex = 1; + // + // lvItems + // + this.lvItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chCode, + this.chCodeName, + this.chCurPrice, + this.chCount, + this.chBookValue, + this.chCapitalGains, + this.chAssessedValue, + this.chValuation, + this.chYield, + this.chMaxPrice, + this.chCheckCount}); + this.lvItems.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvItems.FullRowSelect = true; + this.lvItems.GridLines = true; + this.lvItems.Location = new System.Drawing.Point(0, 0); + this.lvItems.Name = "lvItems"; + this.lvItems.Size = new System.Drawing.Size(804, 300); + this.lvItems.TabIndex = 0; + this.lvItems.UseCompatibleStateImageBehavior = false; + this.lvItems.View = System.Windows.Forms.View.Details; + this.lvItems.SelectedIndexChanged += new System.EventHandler(this.lvList_SelectedIndexChanged); + // + // chCode + // + this.chCode.Text = "코드"; + this.chCode.Width = 77; + // + // chCodeName + // + this.chCodeName.Text = "종목명"; + this.chCodeName.Width = 86; + // + // chCurPrice + // + this.chCurPrice.Text = "현재가"; + this.chCurPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chCurPrice.Width = 71; + // + // chCount + // + this.chCount.Text = "잔고수량"; + this.chCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // chBookValue + // + this.chBookValue.Text = "장부가"; + this.chBookValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chBookValue.Width = 72; + // + // chCapitalGains + // + this.chCapitalGains.Text = "손익단가"; + this.chCapitalGains.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chCapitalGains.Width = 73; + // + // chAssessedValue + // + this.chAssessedValue.Text = "평가금액"; + this.chAssessedValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chAssessedValue.Width = 76; + // + // chValuation + // + this.chValuation.Text = "평가손익"; + this.chValuation.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chValuation.Width = 79; + // + // chYield + // + this.chYield.Text = "수익률"; + this.chYield.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chYield.Width = 79; + // + // chMaxPrice + // + this.chMaxPrice.Text = "최고가"; + this.chMaxPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // chCheckCount + // + this.chCheckCount.Text = "조건횟수"; + this.chCheckCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // lvNCItem + // + this.lvNCItem.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chNCCode, + this.chNCCodeName, + this.chNCType, + this.chNCPrice, + this.chNCCount}); + this.lvNCItem.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvNCItem.FullRowSelect = true; + this.lvNCItem.GridLines = true; + this.lvNCItem.Location = new System.Drawing.Point(0, 0); + this.lvNCItem.Name = "lvNCItem"; + this.lvNCItem.Size = new System.Drawing.Size(804, 151); + this.lvNCItem.TabIndex = 1; + this.lvNCItem.UseCompatibleStateImageBehavior = false; + this.lvNCItem.View = System.Windows.Forms.View.Details; + // + // chNCCode + // + this.chNCCode.Text = "코드"; + this.chNCCode.Width = 77; + // + // chNCCodeName + // + this.chNCCodeName.Text = "종목명"; + this.chNCCodeName.Width = 86; + // + // chNCType + // + this.chNCType.Text = "매매구분"; + this.chNCType.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chNCType.Width = 71; + // + // chNCPrice + // + this.chNCPrice.Text = "주문단가"; + this.chNCPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chNCPrice.Width = 72; + // + // chNCCount + // + this.chNCCount.Text = "미체결량"; + this.chNCCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // lvCurPrice + // + this.lvCurPrice.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.chAskCount, + this.chCallPrice, + this.chBidCount}); + this.lvCurPrice.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvCurPrice.FullRowSelect = true; + this.lvCurPrice.GridLines = true; + this.lvCurPrice.Location = new System.Drawing.Point(0, 0); + this.lvCurPrice.Name = "lvCurPrice"; + this.lvCurPrice.Size = new System.Drawing.Size(246, 655); + this.lvCurPrice.TabIndex = 0; + this.lvCurPrice.UseCompatibleStateImageBehavior = false; + this.lvCurPrice.View = System.Windows.Forms.View.Details; + // + // columnHeader1 + // + this.columnHeader1.Width = 10; + // + // chAskCount + // + this.chAskCount.Text = "매도잔량"; + this.chAskCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chAskCount.Width = 75; + // + // chCallPrice + // + this.chCallPrice.Text = "호가"; + this.chCallPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // chBidCount + // + this.chBidCount.Text = "매수잔량"; + this.chBidCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.chBidCount.Width = 75; + // // AutoSeller // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -784,14 +784,14 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.splitContainer3.Panel1.ResumeLayout(false); - this.splitContainer3.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); - this.splitContainer3.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); this.tabPage3.ResumeLayout(false); this.tabPage3.PerformLayout(); + this.splitContainer3.Panel1.ResumeLayout(false); + this.splitContainer3.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); + this.splitContainer3.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/AutoSeller.cs b/AutoSeller.cs index 5863561..b646551 100644 --- a/AutoSeller.cs +++ b/AutoSeller.cs @@ -37,15 +37,21 @@ namespace AutoSellerNS public int m_iRemainCnt; public int m_iOrderPrice; public string m_strDesc; + public bool m_bAsk; + public int m_iOrgOrderNo; + public DateTime m_Time; } int m_iCurPricePanelWith; CybosHelper m_CybosHelper = null; List m_Items = new List(); + List m_NCItems = new List(); string m_strSelectedCode = ""; bool m_bSell = false; + System.Timers.Timer m_Timer = new System.Timers.Timer(); + public AutoSeller() { InitializeComponent(); @@ -90,6 +96,23 @@ namespace AutoSellerNS materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); + + m_Timer.Interval = 500; + m_Timer.Elapsed += Timer_Elapsed; + m_Timer.Start(); + } + + private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + foreach(var NCItem in m_NCItems) + { + if(NCItem.m_bAsk == true && DateTime.Now-NCItem.m_Time >= TimeSpan.FromSeconds(3)) + { + m_CybosHelper.CorrectionItem(NCItem.m_strCode, NCItem.m_iOrgOrderNo, m_CybosHelper.GetItem(NCItem.m_strCode).m_aiAskPrice[0]); + NCItem.m_Time = DateTime.Now; + Util.Log(Util.LOG_TYPE.SELL, string.Format("[{0}] 정정 주문", NCItem.m_strCodeName)); + } + } } public void SetAccountList(string[] aAccountList) @@ -205,19 +228,33 @@ namespace AutoSellerNS void UpdateNC() { var NCItems = m_CybosHelper.UpdateNC(); + + m_NCItems.RemoveAll(s => NCItems.Any(t => t.m_iOrgOrderNo== s.m_iOrgOrderNo) == false); + foreach(var NCItem in NCItems) + { + if(m_NCItems.Any(s => s.m_iOrgOrderNo == NCItem.m_iOrgOrderNo) == false) + { + NCItem.m_Time = DateTime.Now; + m_NCItems.Add(NCItem); + } + } + lvNCItem.Items.Clear(); if(lvNCItem.InvokeRequired) { lvNCItem.Invoke(new Action(() => { foreach(var NCItem in NCItems) { - lvNCItem.Items.Add(new ListViewItem(new string[] { + ListViewItem viewItem = new ListViewItem(new string[] { NCItem.m_strCode, NCItem.m_strCodeName, NCItem.m_strDesc, string.Format("{0:n0}", NCItem.m_iOrderPrice), string.Format("{0:n0}", NCItem.m_iRemainCnt), - })); + }); + lvNCItem.Items.Add(viewItem); + viewItem.UseItemStyleForSubItems = false; + viewItem.SubItems[chNCType.Index].ForeColor = NCItem.m_bAsk ? Color.Blue : Color.Red; } })); } @@ -225,13 +262,16 @@ namespace AutoSellerNS { foreach(var NCItem in NCItems) { - lvNCItem.Items.Add(new ListViewItem(new string[] { - NCItem.m_strCode, - NCItem.m_strCodeName, - NCItem.m_strDesc, - string.Format("{0:n0}", NCItem.m_iOrderPrice), - string.Format("{0:n0}", NCItem.m_iRemainCnt), - })); + ListViewItem viewItem = new ListViewItem(new string[] { + NCItem.m_strCode, + NCItem.m_strCodeName, + NCItem.m_strDesc, + string.Format("{0:n0}", NCItem.m_iOrderPrice), + string.Format("{0:n0}", NCItem.m_iRemainCnt), + }); + lvNCItem.Items.Add(viewItem); + viewItem.UseItemStyleForSubItems = false; + viewItem.SubItems[chNCType.Index].ForeColor = NCItem.m_bAsk ? Color.Blue : Color.Red; } } } diff --git a/CybosHelper.cs b/CybosHelper.cs index 1750218..16ca01a 100644 --- a/CybosHelper.cs +++ b/CybosHelper.cs @@ -264,6 +264,8 @@ namespace AutoSellerNS Item.m_strDesc = CP5339.GetDataValue(5, i); Item.m_iOrderPrice = CP5339.GetDataValue(7, i); Item.m_iRemainCnt = CP5339.GetDataValue(11, i); + Item.m_bAsk = (CP5339.GetDataValue(13, i) == "1"); + Item.m_iOrgOrderNo = CP5339.GetDataValue(2, i); NCItems.Add(Item); } @@ -418,5 +420,19 @@ namespace AutoSellerNS Td0311.SetInputValue(8, "01"); Td0311.BlockRequest2(0); } + + public void CorrectionItem(string strCode, int iOrgOrderNo, int iAskPrice) + { + int iSellPrice = iAskPrice-GetUnitValue(iAskPrice); + + CPTRADELib.CpTd0313 Td0313 = new CPTRADELib.CpTd0313(); + Td0313.SetInputValue(1, iOrgOrderNo); + Td0313.SetInputValue(2, Config.GetAccount()); + Td0313.SetInputValue(3, Config.GetSubAccount()); + Td0313.SetInputValue(4, strCode); + Td0313.SetInputValue(5, 0); + Td0313.SetInputValue(6, iSellPrice); + Td0313.BlockRequest2(0); + } } }