diff --git a/AutoSeller.Designer.cs b/AutoSeller.Designer.cs index 989ebcd..fe117c3 100644 --- a/AutoSeller.Designer.cs +++ b/AutoSeller.Designer.cs @@ -31,19 +31,26 @@ this.materialTabSelector1 = new MaterialSkin.Controls.MaterialTabSelector(); this.materialTabControl1 = new MaterialSkin.Controls.MaterialTabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.btSell = new MaterialSkin.Controls.MaterialRaisedButton(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.tbLog = new System.Windows.Forms.RichTextBox(); this.btUpdate = new MaterialSkin.Controls.MaterialRaisedButton(); this.btCybos = new MaterialSkin.Controls.MaterialRaisedButton(); this.tabPage2 = new System.Windows.Forms.TabPage(); - this.cbAccount = new System.Windows.Forms.ComboBox(); - this.tbSubAccount = new MaterialSkin.Controls.MaterialSingleLineTextField(); - this.btApply = new MaterialSkin.Controls.MaterialFlatButton(); - this.materialLabel1 = new MaterialSkin.Controls.MaterialLabel(); - this.tbBidCount = new MaterialSkin.Controls.MaterialSingleLineTextField(); + this.materialLabel7 = new MaterialSkin.Controls.MaterialLabel(); + this.tbTrailingCnt = new MaterialSkin.Controls.MaterialSingleLineTextField(); + this.materialLabel6 = new MaterialSkin.Controls.MaterialLabel(); + this.tbTrailingP = new MaterialSkin.Controls.MaterialSingleLineTextField(); + this.materialLabel5 = new MaterialSkin.Controls.MaterialLabel(); + this.materialLabel4 = new MaterialSkin.Controls.MaterialLabel(); + this.materialLabel3 = new MaterialSkin.Controls.MaterialLabel(); this.materialLabel2 = new MaterialSkin.Controls.MaterialLabel(); - this.btSell = new MaterialSkin.Controls.MaterialRaisedButton(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.tbLog = new System.Windows.Forms.RichTextBox(); + this.tbBidCount = new MaterialSkin.Controls.MaterialSingleLineTextField(); + this.materialLabel1 = new MaterialSkin.Controls.MaterialLabel(); + this.btApply = new MaterialSkin.Controls.MaterialFlatButton(); + this.tbSubAccount = new MaterialSkin.Controls.MaterialSingleLineTextField(); + this.cbAccount = new System.Windows.Forms.ComboBox(); 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())); @@ -61,18 +68,17 @@ 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.materialLabel3 = new MaterialSkin.Controls.MaterialLabel(); this.materialTabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); - this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.tabPage2.SuspendLayout(); this.SuspendLayout(); // // materialTabSelector1 @@ -117,6 +123,20 @@ this.tabPage1.Text = "Items"; this.tabPage1.UseVisualStyleBackColor = true; // + // btSell + // + this.btSell.AutoSize = true; + this.btSell.Depth = 0; + this.btSell.Location = new System.Drawing.Point(148, 3); + this.btSell.MouseState = MaterialSkin.MouseState.HOVER; + this.btSell.Name = "btSell"; + this.btSell.Primary = true; + this.btSell.Size = new System.Drawing.Size(68, 28); + this.btSell.TabIndex = 4; + this.btSell.Text = "Sell"; + this.btSell.UseVisualStyleBackColor = true; + this.btSell.Click += new System.EventHandler(this.btSell_Click); + // // splitContainer2 // this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -138,6 +158,33 @@ this.splitContainer2.TabIndex = 2; this.splitContainer2.SizeChanged += new System.EventHandler(this.splitContainer2_SizeChanged); // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.lvItems); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tbLog); + this.splitContainer1.Size = new System.Drawing.Size(804, 508); + 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; @@ -169,6 +216,12 @@ // 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); @@ -183,29 +236,145 @@ this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Preference"; // - // cbAccount + // materialLabel7 // - 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; + 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 = "회"; // - // tbSubAccount + // tbTrailingCnt // - 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; + 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.01.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 // @@ -225,88 +394,29 @@ this.btApply.UseVisualStyleBackColor = true; this.btApply.Click += new System.EventHandler(this.btApply_Click); // - // materialLabel1 + // tbSubAccount // - 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"; + 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; // - // tbBidCount + // cbAccount // - 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; - // - // 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 = "회"; - // - // btSell - // - this.btSell.AutoSize = true; - this.btSell.Depth = 0; - this.btSell.Location = new System.Drawing.Point(148, 3); - this.btSell.MouseState = MaterialSkin.MouseState.HOVER; - this.btSell.Name = "btSell"; - this.btSell.Primary = true; - this.btSell.Size = new System.Drawing.Size(68, 28); - this.btSell.TabIndex = 4; - this.btSell.Text = "Sell"; - this.btSell.UseVisualStyleBackColor = true; - this.btSell.Click += new System.EventHandler(this.btSell_Click); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.lvItems); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.tbLog); - this.splitContainer1.Size = new System.Drawing.Size(804, 508); - 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 = ""; + 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; // // lvItems // @@ -432,19 +542,6 @@ this.chBidCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.chBidCount.Width = 75; // - // materialLabel3 - // - 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.01.26.14"; - // // AutoSeller // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -461,12 +558,12 @@ this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); this.ResumeLayout(false); } @@ -506,5 +603,11 @@ private System.Windows.Forms.ColumnHeader chMaxPrice; private System.Windows.Forms.ColumnHeader chCheckCount; private MaterialSkin.Controls.MaterialLabel materialLabel3; + private MaterialSkin.Controls.MaterialLabel materialLabel7; + private MaterialSkin.Controls.MaterialSingleLineTextField tbTrailingCnt; + private MaterialSkin.Controls.MaterialLabel materialLabel6; + private MaterialSkin.Controls.MaterialSingleLineTextField tbTrailingP; + private MaterialSkin.Controls.MaterialLabel materialLabel5; + private MaterialSkin.Controls.MaterialLabel materialLabel4; } } \ No newline at end of file diff --git a/AutoSeller.cs b/AutoSeller.cs index f13586a..6363e47 100644 --- a/AutoSeller.cs +++ b/AutoSeller.cs @@ -65,6 +65,12 @@ namespace AutoSellerNS lvCurPrice.Items[10].SubItems[chAskCount.Index].Text = "현재가"; lvCurPrice.Items[10].SubItems[chCallPrice.Index].Font = new Font(lvCurPrice.Items[0].SubItems[0].Font, FontStyle.Bold); + cbAccount.Text = Config.GetAccount(); + tbSubAccount.Text = Config.GetSubAccount(); + tbBidCount.Text = Config.GetBidCount().ToString(); + tbTrailingP.Text = Config.GetTrailingRate().ToString(); + tbTrailingCnt.Text = Config.GetTrailingCnt().ToString(); + m_CybosHelper = new CybosHelper(this); m_iCurPricePanelWith = splitContainer2.Panel2.Width; @@ -115,8 +121,10 @@ namespace AutoSellerNS if(lvItems.InvokeRequired) { + CybosHelper.STOCK_CUR_ITEM ItemCur = m_CybosHelper.GetItem(Item.m_strCode); + lvItems.Invoke(new Action(() => { - lvItems.Items.Add(new ListViewItem(new string[] { + lvItems.Items.Add(new ListViewItem(new string[] { Item.m_strCode, Item.m_strCodeName, string.Format("{0:n0}", Item.m_iCurPrice), @@ -126,8 +134,8 @@ namespace AutoSellerNS string.Format("{0:n0}", Item.m_iAssessedValue), string.Format("{0:n0}", Item.m_iValuationGains), string.Format("{0:n2}", Item.m_dYield), - "", - "", + ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iMaxPrice) : "", + ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iCheckCount) : "", })); var listviewItem = lvItems.Items[lvItems.Items.Count - 1]; @@ -141,6 +149,8 @@ namespace AutoSellerNS } else { + CybosHelper.STOCK_CUR_ITEM ItemCur = m_CybosHelper.GetItem(Item.m_strCode); + lvItems.Items.Add(new ListViewItem(new string[] { Item.m_strCode, Item.m_strCodeName, @@ -151,10 +161,12 @@ namespace AutoSellerNS string.Format("{0:n0}", Item.m_iAssessedValue), string.Format("{0:n0}", Item.m_iValuationGains), string.Format("{0:n2}", Item.m_dYield), - "", - "", + ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iMaxPrice) : "", + ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iCheckCount) : "", })); + + var listviewItem = lvItems.Items[lvItems.Items.Count - 1]; lvItems.Items[lvItems.Items.Count - 1].UseItemStyleForSubItems = false; @@ -262,7 +274,7 @@ namespace AutoSellerNS } } - public void OnReceivedCall(string strCode, int[] aiBidPrice, int[] aiBidCount, int[] aiAskPrice, int[] aiAskCount) + public void OnReceivedCall(string strCode, int iCurPrice, int[] aiBidPrice, int[] aiBidCount, int[] aiAskPrice, int[] aiAskCount) { if (strCode != m_strSelectedCode) return; @@ -274,6 +286,10 @@ namespace AutoSellerNS if (lvCurPrice.InvokeRequired) { lvCurPrice.Invoke(new Action(() => { + + if(iCurPrice > 0) + lvCurPrice.Items[10].SubItems[chCallPrice.Index].Text = string.Format("{0:n0}", iCurPrice); + for (int i = 0; i < 10; i++) { lvCurPrice.Items[i].SubItems[chAskCount.Index].Text = string.Format("{0:n0}", aiAskCount[9-i]); @@ -289,6 +305,9 @@ namespace AutoSellerNS } else { + if(iCurPrice > 0) + lvCurPrice.Items[10].SubItems[chCallPrice.Index].Text = string.Format("{0:n0}", iCurPrice); + for (int i = 0; i < 10; i++) { lvCurPrice.Items[i].SubItems[chAskCount.Index].Text = string.Format("{0:n0}", aiAskCount[9-i]); @@ -323,7 +342,7 @@ namespace AutoSellerNS return; m_strSelectedCode = strCode; - OnReceivedCall(strCode, Item.m_aiBidPrice, Item.m_aiBidCount, Item.m_aiAskPrice, Item.m_aiAskCount); + OnReceivedCall(strCode, Item.m_iCurPrice, Item.m_aiBidPrice, Item.m_aiBidCount, Item.m_aiAskPrice, Item.m_aiAskCount); //OnReceivedCurPrice(strCode, Item.m_iCurPrice); } @@ -336,6 +355,12 @@ namespace AutoSellerNS int iBidCount = 0; int.TryParse(tbBidCount.Text, out iBidCount); Config.SetBidCount(iBidCount); + + float fTrailingPercent = 0; + float.TryParse(tbTrailingP.Text, out fTrailingPercent); + int iTrailingCnt = 0; + int.TryParse(tbTrailingCnt.Text, out iTrailingCnt); + Config.SetTrailing(fTrailingPercent, iTrailingCnt); } } } diff --git a/Config.cs b/Config.cs index 4a34c44..c75611c 100644 --- a/Config.cs +++ b/Config.cs @@ -10,7 +10,7 @@ namespace AutoSellerNS { static class Config { - static Dictionary m_Data = new Dictionary(); + static Dictionary m_Data = new Dictionary(); static Random m_Random = new Random(); @@ -18,7 +18,9 @@ namespace AutoSellerNS { m_Data.Add("account", ""); m_Data.Add("sub-account", ""); - m_Data.Add("bid-count", "5"); + m_Data.Add("bid-count", 5); + m_Data.Add("trailing-rate", 1.0f); + m_Data.Add("trailing-count", 2); Load(); } @@ -40,7 +42,7 @@ namespace AutoSellerNS continue; if(m_Data.ContainsKey(aTokens[0]) == true) - m_Data[aTokens[0]] = aTokens[1]; + m_Data[aTokens[0]] = Convert.ChangeType(aTokens[1], m_Data[aTokens[0]].GetType()); else m_Data.Add(aTokens[0], aTokens[1]); } @@ -49,8 +51,8 @@ namespace AutoSellerNS static void Save() { string strContents = ""; - foreach(KeyValuePair pair in m_Data) - strContents += pair.Key + "=" + pair.Value + Environment.NewLine; + foreach(KeyValuePair pair in m_Data) + strContents += pair.Key + "=" + pair.Value.ToString() + Environment.NewLine; string strPath = Util.GetConfigPath()+"/config.ini"; File.WriteAllText(strPath, strContents, new UTF8Encoding(true)); @@ -58,32 +60,48 @@ namespace AutoSellerNS public static void SetAccount(string strAccount, string strAccountSub) { - m_Data["account"] = strAccount; + if(strAccount != null) + m_Data["account"] = strAccount; m_Data["sub-account"] = strAccountSub; Save(); } public static string GetAccount() { - return m_Data["account"]; + return (string)m_Data["account"]; } public static string GetSubAccount() { - return m_Data["sub-account"]; + return (string)m_Data["sub-account"]; } public static void SetBidCount(int iCount) { - m_Data["bid-count"] = iCount.ToString(); + m_Data["bid-count"] = iCount; Save(); } public static int GetBidCount() { - int iCount = 0; - int.TryParse(m_Data["bid-count"], out iCount); - return iCount; + return (int)m_Data["bid-count"]; + } + + public static void SetTrailing(float fTrailingRate, int iTrailingCnt) + { + m_Data["trailing-rate"] = fTrailingRate; + m_Data["trailing-count"] = iTrailingCnt; + Save(); + } + + public static float GetTrailingRate() + { + return (float)m_Data["trailing-rate"]; + } + + public static int GetTrailingCnt() + { + return (int)m_Data["trailing-count"]; } } } diff --git a/CybosHelper.cs b/CybosHelper.cs index 2b7f0e2..a1a2c0f 100644 --- a/CybosHelper.cs +++ b/CybosHelper.cs @@ -13,6 +13,7 @@ namespace AutoSellerNS public AutoSeller m_Listener = null; public CybosHelper m_CybosHelper = null; public string m_strCode; + public string m_strCodeName; public DSCBO1Lib.StockCur m_StockCur = null; public DSCBO1Lib.StockJpbid m_Jpbid = null; public int[] m_aiBidPrice = new int[10]; @@ -24,9 +25,14 @@ namespace AutoSellerNS public int m_iMaxPrice = 0; public int m_iCheckCount = 0; + public int m_iTrailingCount = 0; + public void OnRecievedPrice() { m_iCurPrice = m_StockCur.GetHeaderValue(13); + if(m_iCurPrice > m_iMaxPrice) + m_iTrailingCount = 0; + m_iMaxPrice = Math.Max(m_iCurPrice, m_iMaxPrice); int iAskPrice = m_StockCur.GetHeaderValue(7); @@ -36,8 +42,19 @@ namespace AutoSellerNS else m_iCheckCount = 0; - if (m_iCheckCount >= Config.GetBidCount() && m_Listener.IsSelling() == true) + if(m_iCheckCount >= Config.GetBidCount() && m_Listener.IsSelling() == true) + { m_CybosHelper.SellItem(m_strCode, m_iCurPrice, m_Listener.GetSellableCount(m_strCode)); + Util.Log(Util.LOG_TYPE.SELL, string.Format("[조건 완료 매도] {0} ({1}회)", m_strCodeName, Config.GetBidCount())); + } + + if(m_iCurPrice < (m_iMaxPrice*(100.0f-Config.GetTrailingRate())/100.0f)) + m_iTrailingCount++; + if(m_iTrailingCount >= Config.GetTrailingCnt() && m_Listener.IsSelling() == true) + { + m_CybosHelper.SellItem(m_strCode, m_iCurPrice, m_Listener.GetSellableCount(m_strCode)); + Util.Log(Util.LOG_TYPE.SELL, string.Format("[트레일링 매도] {0} ({1}% {2}회)", m_strCodeName, Config.GetTrailingRate(), Config.GetTrailingCnt())); + } m_Listener.OnReceivedCurPrice(m_strCode, m_iCurPrice, m_iMaxPrice, m_iCheckCount); } @@ -60,7 +77,7 @@ namespace AutoSellerNS m_aiAskCount[i+5] = m_Jpbid.GetHeaderValue(29 + 4*i); } - m_Listener.OnReceivedCall(m_strCode, m_aiBidPrice, m_aiBidCount, m_aiAskPrice, m_aiAskCount); + m_Listener.OnReceivedCall(m_strCode, 0, m_aiBidPrice, m_aiBidCount, m_aiAskPrice, m_aiAskCount); } } @@ -128,21 +145,24 @@ namespace AutoSellerNS AutoSeller.ITEM Item = new AutoSeller.ITEM(); Item.m_strCodeName = m_6033.GetDataValue(0, i); - Item.m_strCode = m_6033.GetDataValue(12, i); - Item.m_iItemCnt = m_6033.GetDataValue(7, i); - Item.m_iAssessedValue = m_6033.GetDataValue(9, i); - Item.m_iValuationGains = m_6033.GetDataValue(10, i); - Item.m_dYield = m_6033.GetDataValue(11, i); - Item.m_iAvailableQuantity = m_6033.GetDataValue(15, i); - Item.m_dBookUnitPrice = m_6033.GetDataValue(17, i); - Item.m_iProfitUnitPrice = m_6033.GetDataValue(18, i); - Item.m_iSellableCnt = m_6033.GetDataValue(15, i); + if(Item.m_strCodeName != "") + { + Item.m_strCode = m_6033.GetDataValue(12, i); + Item.m_iItemCnt = m_6033.GetDataValue(7, i); + Item.m_iAssessedValue = m_6033.GetDataValue(9, i); + Item.m_iValuationGains = m_6033.GetDataValue(10, i); + Item.m_dYield = m_6033.GetDataValue(11, i); + Item.m_iAvailableQuantity = m_6033.GetDataValue(15, i); + Item.m_dBookUnitPrice = m_6033.GetDataValue(17, i); + Item.m_iProfitUnitPrice = m_6033.GetDataValue(18, i); + Item.m_iSellableCnt = m_6033.GetDataValue(15, i); - if (strCodeList.Length > 0) - strCodeList += ","; - strCodeList += Item.m_strCode; + if(strCodeList.Length > 0) + strCodeList += ","; + strCodeList += Item.m_strCode; - aItems.Add(Item); + aItems.Add(Item); + } } if (strCodeList.Length > 0) @@ -161,6 +181,20 @@ namespace AutoSellerNS } } + // sync + List aRemoveKeys = new List(); + foreach(var Item in m_aStockCur) + { + if(aItems.Any(s => s.m_strCode == Item.Key) == false) + aRemoveKeys.Add(Item.Key); + } + + foreach(var Key in aRemoveKeys) + { + m_aStockCur[Key].m_StockCur.Unsubscribe(); + m_aStockCur[Key].m_Jpbid.Unsubscribe(); + m_aStockCur.Remove(Key); + } return aItems; } @@ -238,6 +272,7 @@ namespace AutoSellerNS StockCur.m_Listener = m_Listener; StockCur.m_CybosHelper = this; StockCur.m_strCode = Item.m_strCode; + StockCur.m_strCodeName = Item.m_strCodeName; StockCur.m_StockCur = new DSCBO1Lib.StockCur(); StockCur.m_StockCur.SetInputValue(0, Item.m_strCode); StockCur.m_StockCur.Received += StockCur.OnRecievedPrice;