From 231b0d48cacaf16b8b51b09b3f5594405db09e86 Mon Sep 17 00:00:00 2001 From: mjjo Date: Thu, 9 Feb 2017 15:24:37 +0900 Subject: [PATCH] =?UTF-8?q?-=20=EB=A7=A4=EC=88=98=EC=A3=BC=EB=AC=B8=20?= =?UTF-8?q?=ED=98=B8=EA=B0=80=20=EB=8B=A8=EC=9C=84=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CybosHelper.cs | 30 +++++- NewsForm.Designer.cs | 212 +++++++++++++++++++++---------------------- NewsForm.resx | 3 - 3 files changed, 132 insertions(+), 113 deletions(-) diff --git a/CybosHelper.cs b/CybosHelper.cs index 44144cb..b831afd 100644 --- a/CybosHelper.cs +++ b/CybosHelper.cs @@ -162,6 +162,27 @@ namespace NewsCrawler } } + int GetCallUnitValue(int iValue) + { + int iUnit = 1; + if(iValue < 1000) + iUnit = 1; + else if(iValue < 5000) + iUnit = 5; + else if(iValue < 10000) + iUnit = 10; + else if(iValue < 50000) + iUnit = 50; + else if(iValue < 100000) + iUnit = 100; + else if(iValue < 500000) + iUnit = 500; + else + iUnit = 1000; + + return (iValue/iUnit)*iUnit; + } + public void Buy(CodeList.CODE_VALUE Code, int iMaxPrice) { if(m_bInitialized == false) @@ -172,21 +193,22 @@ namespace NewsCrawler try { + int iCurPrice = GetCurPrice(Code); - iCurPrice = (int)(iCurPrice*1.015); - int iCount = iMaxPrice/iCurPrice; + int iCallValue = GetCallUnitValue((int)(iCurPrice*1.015)); + int iCount = iMaxPrice/iCallValue; m_CP0311.SetInputValue(0, 2); m_CP0311.SetInputValue(1, Config.GetAccount()); m_CP0311.SetInputValue(2, Config.GetSubAccount()); m_CP0311.SetInputValue(3, Code.m_strCode); m_CP0311.SetInputValue(4, iCount); - m_CP0311.SetInputValue(5, iCurPrice); + m_CP0311.SetInputValue(5, iCallValue); m_CP0311.SetInputValue(7, "01"); m_CP0311.SetInputValue(8, "01"); m_CP0311.BlockRequest2(1); - Util.Log(Util.LOG_TYPE.BUY, string.Format("code:{0} {1}주 현재가 {2}원, 시장가 매수", Code.ToString(), iCount, iCurPrice)); + Util.Log(Util.LOG_TYPE.BUY, string.Format("code:{0} {1}주 현재가 {2}원, 지정가 IOC 매수", Code.ToString(), iCount, iCallValue)); } catch(Exception ex) { diff --git a/NewsForm.Designer.cs b/NewsForm.Designer.cs index a63d9e5..f9bcf33 100644 --- a/NewsForm.Designer.cs +++ b/NewsForm.Designer.cs @@ -30,19 +30,6 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewsForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.statusBar = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); - this.tbLog = new System.Windows.Forms.RichTextBox(); - this.chAutoReload = new System.Windows.Forms.CheckBox(); - this.chAutoSelect = new System.Windows.Forms.CheckBox(); - this.tbInterval = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.btnConfig = new System.Windows.Forms.Button(); - this.chBuy = new System.Windows.Forms.CheckBox(); - this.cbPriceCheck = new System.Windows.Forms.CheckBox(); this.lvList = new NewsCrawler.ListViewNF(); this.chId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -57,6 +44,19 @@ this.chPriceHigh = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chPriceHighP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chLink = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.statusBar = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); + this.tbLog = new System.Windows.Forms.RichTextBox(); + this.chAutoReload = new System.Windows.Forms.CheckBox(); + this.chAutoSelect = new System.Windows.Forms.CheckBox(); + this.tbInterval = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnConfig = new System.Windows.Forms.Button(); + this.chBuy = new System.Windows.Forms.CheckBox(); + this.cbPriceCheck = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -85,6 +85,99 @@ this.splitContainer1.SplitterDistance = 587; this.splitContainer1.TabIndex = 2; // + // lvList + // + this.lvList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chId, + this.chTime, + this.chResT, + this.chResponseT, + this.chReference, + this.chTitle, + this.chCodeName, + this.chPriceS, + this.chPriceLow, + this.chPriceLowP, + this.chPriceHigh, + this.chPriceHighP, + this.chLink}); + this.lvList.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvList.FullRowSelect = true; + this.lvList.GridLines = true; + this.lvList.HideSelection = false; + this.lvList.Location = new System.Drawing.Point(0, 0); + this.lvList.MultiSelect = false; + this.lvList.Name = "lvList"; + this.lvList.Size = new System.Drawing.Size(1412, 587); + this.lvList.TabIndex = 0; + this.lvList.UseCompatibleStateImageBehavior = false; + this.lvList.View = System.Windows.Forms.View.Details; + this.lvList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvList_ColumnClick); + this.lvList.DoubleClick += new System.EventHandler(this.lvList_DoubleClick); + // + // chId + // + this.chId.Text = "ID"; + this.chId.Width = 29; + // + // chTime + // + this.chTime.Text = "기사 시간"; + // + // chResT + // + this.chResT.Text = "받은 시간"; + this.chResT.Width = 66; + // + // chResponseT + // + this.chResponseT.Text = "요청 시간"; + this.chResponseT.Width = 69; + // + // chReference + // + this.chReference.Text = "출처"; + this.chReference.Width = 72; + // + // chTitle + // + this.chTitle.Text = "제목"; + this.chTitle.Width = 366; + // + // chCodeName + // + this.chCodeName.Text = "종목명"; + // + // chPriceS + // + this.chPriceS.Text = "시가"; + this.chPriceS.Width = 65; + // + // chPriceLow + // + this.chPriceLow.Text = "최저가"; + this.chPriceLow.Width = 61; + // + // chPriceLowP + // + this.chPriceLowP.Text = "대비"; + this.chPriceLowP.Width = 33; + // + // chPriceHigh + // + this.chPriceHigh.Text = "최고가"; + this.chPriceHigh.Width = 58; + // + // chPriceHighP + // + this.chPriceHighP.Text = "대비"; + this.chPriceHighP.Width = 35; + // + // chLink + // + this.chLink.Text = "링크"; + this.chLink.Width = 241; + // // statusBar // this.statusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -213,99 +306,6 @@ this.cbPriceCheck.Text = "가격 체크"; this.cbPriceCheck.UseVisualStyleBackColor = true; // - // lvList - // - this.lvList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.chId, - this.chTime, - this.chResT, - this.chResponseT, - this.chReference, - this.chTitle, - this.chCodeName, - this.chPriceS, - this.chPriceLow, - this.chPriceLowP, - this.chPriceHigh, - this.chPriceHighP, - this.chLink}); - this.lvList.Dock = System.Windows.Forms.DockStyle.Fill; - this.lvList.FullRowSelect = true; - this.lvList.GridLines = true; - this.lvList.HideSelection = false; - this.lvList.Location = new System.Drawing.Point(0, 0); - this.lvList.MultiSelect = false; - this.lvList.Name = "lvList"; - this.lvList.Size = new System.Drawing.Size(1412, 587); - this.lvList.TabIndex = 0; - this.lvList.UseCompatibleStateImageBehavior = false; - this.lvList.View = System.Windows.Forms.View.Details; - this.lvList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvList_ColumnClick); - this.lvList.DoubleClick += new System.EventHandler(this.lvList_DoubleClick); - // - // chId - // - this.chId.Text = "ID"; - this.chId.Width = 29; - // - // chTime - // - this.chTime.Text = "기사 시간"; - // - // chResT - // - this.chResT.Text = "받은 시간"; - this.chResT.Width = 66; - // - // chResponseT - // - this.chResponseT.Text = "요청 시간"; - this.chResponseT.Width = 69; - // - // chReference - // - this.chReference.Text = "출처"; - this.chReference.Width = 72; - // - // chTitle - // - this.chTitle.Text = "제목"; - this.chTitle.Width = 366; - // - // chCodeName - // - this.chCodeName.Text = "종목명"; - // - // chPriceS - // - this.chPriceS.Text = "시가"; - this.chPriceS.Width = 65; - // - // chPriceLow - // - this.chPriceLow.Text = "최저가"; - this.chPriceLow.Width = 61; - // - // chPriceLowP - // - this.chPriceLowP.Text = "대비"; - this.chPriceLowP.Width = 33; - // - // chPriceHigh - // - this.chPriceHigh.Text = "최고가"; - this.chPriceHigh.Width = 58; - // - // chPriceHighP - // - this.chPriceHighP.Text = "대비"; - this.chPriceHighP.Width = 35; - // - // chLink - // - this.chLink.Text = "링크"; - this.chLink.Width = 241; - // // NewsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); diff --git a/NewsForm.resx b/NewsForm.resx index 994036b..2bd1d36 100644 --- a/NewsForm.resx +++ b/NewsForm.resx @@ -120,9 +120,6 @@ 17, 17 - - 119, 17 - 96