- 매수주문 호가 단위로

This commit is contained in:
2017-02-09 15:24:37 +09:00
parent 31791b2dd7
commit 231b0d48ca
3 changed files with 132 additions and 113 deletions

View File

@@ -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)
{

212
NewsForm.Designer.cs generated
View File

@@ -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);

View File

@@ -120,9 +120,6 @@
<metadata name="statusBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="materialContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>119, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>96</value>
</metadata>