- 매도 가격을 매도호가의 한호가 아래로 설정

- 미체결 화면 추가
This commit is contained in:
2017-02-17 04:00:59 +09:00
parent fb1195d8f4
commit ed97e19e96
3 changed files with 216 additions and 20 deletions

115
AutoSeller.Designer.cs generated
View File

@@ -56,6 +56,7 @@
this.tbSimulationLog = new System.Windows.Forms.RichTextBox(); this.tbSimulationLog = new System.Windows.Forms.RichTextBox();
this.btSimulate = new MaterialSkin.Controls.MaterialFlatButton(); this.btSimulate = new MaterialSkin.Controls.MaterialFlatButton();
this.btLoad = new MaterialSkin.Controls.MaterialFlatButton(); this.btLoad = new MaterialSkin.Controls.MaterialFlatButton();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.lvItems = new AutoSellerNS.ListViewNF(); this.lvItems = new AutoSellerNS.ListViewNF();
this.chCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -68,6 +69,12 @@
this.chYield = ((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.chMaxPrice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chCheckCount = ((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.lvCurPrice = new AutoSellerNS.ListViewNF();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chAskCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chAskCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -85,6 +92,10 @@
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// materialTabSelector1 // materialTabSelector1
@@ -113,7 +124,7 @@
this.materialTabControl1.MouseState = MaterialSkin.MouseState.HOVER; this.materialTabControl1.MouseState = MaterialSkin.MouseState.HOVER;
this.materialTabControl1.Name = "materialTabControl1"; this.materialTabControl1.Name = "materialTabControl1";
this.materialTabControl1.SelectedIndex = 0; this.materialTabControl1.SelectedIndex = 0;
this.materialTabControl1.Size = new System.Drawing.Size(1068, 572); this.materialTabControl1.Size = new System.Drawing.Size(1068, 719);
this.materialTabControl1.TabIndex = 2; this.materialTabControl1.TabIndex = 2;
// //
// tabPage1 // tabPage1
@@ -125,7 +136,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1060, 546); this.tabPage1.Size = new System.Drawing.Size(1060, 693);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Items"; this.tabPage1.Text = "Items";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
@@ -160,7 +171,7 @@
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.lvCurPrice); this.splitContainer2.Panel2.Controls.Add(this.lvCurPrice);
this.splitContainer2.Size = new System.Drawing.Size(1054, 508); this.splitContainer2.Size = new System.Drawing.Size(1054, 655);
this.splitContainer2.SplitterDistance = 804; this.splitContainer2.SplitterDistance = 804;
this.splitContainer2.TabIndex = 2; this.splitContainer2.TabIndex = 2;
this.splitContainer2.SizeChanged += new System.EventHandler(this.splitContainer2_SizeChanged); this.splitContainer2.SizeChanged += new System.EventHandler(this.splitContainer2_SizeChanged);
@@ -174,13 +185,13 @@
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.lvItems); this.splitContainer1.Panel1.Controls.Add(this.splitContainer3);
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.tbLog); this.splitContainer1.Panel2.Controls.Add(this.tbLog);
this.splitContainer1.Size = new System.Drawing.Size(804, 508); this.splitContainer1.Size = new System.Drawing.Size(804, 655);
this.splitContainer1.SplitterDistance = 353; this.splitContainer1.SplitterDistance = 455;
this.splitContainer1.TabIndex = 1; this.splitContainer1.TabIndex = 1;
// //
// tbLog // tbLog
@@ -188,7 +199,7 @@
this.tbLog.Dock = System.Windows.Forms.DockStyle.Fill; this.tbLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbLog.Location = new System.Drawing.Point(0, 0); this.tbLog.Location = new System.Drawing.Point(0, 0);
this.tbLog.Name = "tbLog"; this.tbLog.Name = "tbLog";
this.tbLog.Size = new System.Drawing.Size(804, 151); this.tbLog.Size = new System.Drawing.Size(804, 196);
this.tbLog.TabIndex = 0; this.tbLog.TabIndex = 0;
this.tbLog.Text = ""; this.tbLog.Text = "";
// //
@@ -239,7 +250,7 @@
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1060, 546); this.tabPage2.Size = new System.Drawing.Size(1060, 693);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Preference"; this.tabPage2.Text = "Preference";
// //
@@ -334,12 +345,12 @@
this.materialLabel3.Depth = 0; this.materialLabel3.Depth = 0;
this.materialLabel3.Font = new System.Drawing.Font("Microsoft Sans Serif", 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.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.Location = new System.Drawing.Point(6, 671);
this.materialLabel3.MouseState = MaterialSkin.MouseState.HOVER; this.materialLabel3.MouseState = MaterialSkin.MouseState.HOVER;
this.materialLabel3.Name = "materialLabel3"; this.materialLabel3.Name = "materialLabel3";
this.materialLabel3.Size = new System.Drawing.Size(162, 18); this.materialLabel3.Size = new System.Drawing.Size(162, 18);
this.materialLabel3.TabIndex = 6; this.materialLabel3.TabIndex = 6;
this.materialLabel3.Text = "Version : 2017.02.07.09"; this.materialLabel3.Text = "Version : 2017.02.17.04";
// //
// materialLabel2 // materialLabel2
// //
@@ -433,7 +444,7 @@
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3); this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1060, 546); this.tabPage3.Size = new System.Drawing.Size(1060, 693);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Simulation"; this.tabPage3.Text = "Simulation";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
@@ -445,7 +456,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tbSimulationLog.Location = new System.Drawing.Point(0, 204); this.tbSimulationLog.Location = new System.Drawing.Point(0, 204);
this.tbSimulationLog.Name = "tbSimulationLog"; this.tbSimulationLog.Name = "tbSimulationLog";
this.tbSimulationLog.Size = new System.Drawing.Size(1060, 342); this.tbSimulationLog.Size = new System.Drawing.Size(1060, 489);
this.tbSimulationLog.TabIndex = 2; this.tbSimulationLog.TabIndex = 2;
this.tbSimulationLog.Text = ""; this.tbSimulationLog.Text = "";
// //
@@ -481,6 +492,24 @@
this.btLoad.UseVisualStyleBackColor = true; this.btLoad.UseVisualStyleBackColor = true;
this.btLoad.Click += new System.EventHandler(this.btLoad_Click); 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 // lvItems
// //
this.lvItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
@@ -500,7 +529,7 @@
this.lvItems.GridLines = true; this.lvItems.GridLines = true;
this.lvItems.Location = new System.Drawing.Point(0, 0); this.lvItems.Location = new System.Drawing.Point(0, 0);
this.lvItems.Name = "lvItems"; this.lvItems.Name = "lvItems";
this.lvItems.Size = new System.Drawing.Size(804, 353); this.lvItems.Size = new System.Drawing.Size(804, 300);
this.lvItems.TabIndex = 0; this.lvItems.TabIndex = 0;
this.lvItems.UseCompatibleStateImageBehavior = false; this.lvItems.UseCompatibleStateImageBehavior = false;
this.lvItems.View = System.Windows.Forms.View.Details; this.lvItems.View = System.Windows.Forms.View.Details;
@@ -567,6 +596,51 @@
this.chCheckCount.Text = "조건횟수"; this.chCheckCount.Text = "조건횟수";
this.chCheckCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 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 // lvCurPrice
// //
this.lvCurPrice.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvCurPrice.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
@@ -579,7 +653,7 @@
this.lvCurPrice.GridLines = true; this.lvCurPrice.GridLines = true;
this.lvCurPrice.Location = new System.Drawing.Point(0, 0); this.lvCurPrice.Location = new System.Drawing.Point(0, 0);
this.lvCurPrice.Name = "lvCurPrice"; this.lvCurPrice.Name = "lvCurPrice";
this.lvCurPrice.Size = new System.Drawing.Size(246, 508); this.lvCurPrice.Size = new System.Drawing.Size(246, 655);
this.lvCurPrice.TabIndex = 0; this.lvCurPrice.TabIndex = 0;
this.lvCurPrice.UseCompatibleStateImageBehavior = false; this.lvCurPrice.UseCompatibleStateImageBehavior = false;
this.lvCurPrice.View = System.Windows.Forms.View.Details; this.lvCurPrice.View = System.Windows.Forms.View.Details;
@@ -609,7 +683,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1074, 690); this.ClientSize = new System.Drawing.Size(1074, 837);
this.Controls.Add(this.materialTabSelector1); this.Controls.Add(this.materialTabSelector1);
this.Controls.Add(this.materialTabControl1); this.Controls.Add(this.materialTabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -630,6 +704,10 @@
this.tabPage2.PerformLayout(); this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout(); 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); this.ResumeLayout(false);
} }
@@ -679,5 +757,12 @@
private MaterialSkin.Controls.MaterialFlatButton btLoad; private MaterialSkin.Controls.MaterialFlatButton btLoad;
private MaterialSkin.Controls.MaterialFlatButton btSimulate; private MaterialSkin.Controls.MaterialFlatButton btSimulate;
private System.Windows.Forms.RichTextBox tbSimulationLog; private System.Windows.Forms.RichTextBox tbSimulationLog;
private System.Windows.Forms.SplitContainer splitContainer3;
private ListViewNF lvNCItem;
private System.Windows.Forms.ColumnHeader chNCCode;
private System.Windows.Forms.ColumnHeader chNCCodeName;
private System.Windows.Forms.ColumnHeader chNCType;
private System.Windows.Forms.ColumnHeader chNCCount;
private System.Windows.Forms.ColumnHeader chNCPrice;
} }
} }

View File

@@ -30,6 +30,15 @@ namespace AutoSellerNS
public int m_iCurPrice; public int m_iCurPrice;
} }
public class NCITEM
{
public string m_strCodeName;
public string m_strCode;
public int m_iRemainCnt;
public int m_iOrderPrice;
public string m_strDesc;
}
int m_iCurPricePanelWith; int m_iCurPricePanelWith;
CybosHelper m_CybosHelper = null; CybosHelper m_CybosHelper = null;
@@ -179,12 +188,45 @@ namespace AutoSellerNS
private void btUpdate_Click(object sender, EventArgs e) private void btUpdate_Click(object sender, EventArgs e)
{ {
// 잔고
var Items = m_CybosHelper.UpdateItems(); var Items = m_CybosHelper.UpdateItems();
m_Items.Clear(); m_Items.Clear();
lvItems.Items.Clear(); lvItems.Items.Clear();
foreach (var Item in Items) foreach (var Item in Items)
AddItem(Item); AddItem(Item);
// 미체결
var NCItems = m_CybosHelper.UpdateNC();
lvNCItem.Clear();
if(lvNCItem.InvokeRequired)
{
lvNCItem.Invoke(new Action(() => {
foreach(var NCItem in NCItems)
{
lvNCItem.Items.Add(new ListViewItem(new string[] {
NCItem.m_strCode,
NCItem.m_strCodeName,
NCItem.m_strDesc,
string.Format("{0:0n}", NCItem.m_iOrderPrice),
string.Format("{0:0n}", NCItem.m_iRemainCnt),
}));
}
}));
}
else
{
foreach(var NCItem in NCItems)
{
lvNCItem.Items.Add(new ListViewItem(new string[] {
NCItem.m_strCode,
NCItem.m_strCodeName,
NCItem.m_strDesc,
string.Format("{0:0n}", NCItem.m_iOrderPrice),
string.Format("{0:0n}", NCItem.m_iRemainCnt),
}));
}
}
} }
public void UpdateItem(string strCode, string strCodeName, bool bBid, int iConclusionCnt, int iRemainCnt, int iBookValue) public void UpdateItem(string strCode, string strCodeName, bool bBid, int iConclusionCnt, int iRemainCnt, int iBookValue)

View File

@@ -48,7 +48,7 @@ namespace AutoSellerNS
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)); m_CybosHelper.SellItem(m_strCode, m_Listener.GetSellableCount(m_strCode), m_aiAskPrice[0]);
Util.Log(Util.LOG_TYPE.SELL, string.Format("[조건 완료 매도] {0} ({1}회) (현재가 {2:n0}원, 최고가 {3:n0}원)", m_strCodeName, Config.GetBidCount(), m_iCurPrice, m_iMaxPrice)); Util.Log(Util.LOG_TYPE.SELL, string.Format("[조건 완료 매도] {0} ({1}회) (현재가 {2:n0}원, 최고가 {3:n0}원)", m_strCodeName, Config.GetBidCount(), m_iCurPrice, m_iMaxPrice));
} }
@@ -56,7 +56,7 @@ namespace AutoSellerNS
m_iTrailingCount++; m_iTrailingCount++;
if(m_iTrailingCount >= Config.GetTrailingCnt() && m_Listener.IsSelling() == true) if(m_iTrailingCount >= Config.GetTrailingCnt() && m_Listener.IsSelling() == true)
{ {
m_CybosHelper.SellItem(m_strCode, m_iCurPrice, m_Listener.GetSellableCount(m_strCode)); m_CybosHelper.SellItem(m_strCode, m_Listener.GetSellableCount(m_strCode), m_aiAskPrice[0]);
Util.Log(Util.LOG_TYPE.SELL, string.Format("[트레일링 매도] {0} ({1}% {2}회) (현재가 {2:n0}원, 최고가 {3:n0}원)", m_strCodeName, Config.GetTrailingRate(), Config.GetTrailingCnt(), m_iCurPrice, m_iMaxPrice)); Util.Log(Util.LOG_TYPE.SELL, string.Format("[트레일링 매도] {0} ({1}% {2}회) (현재가 {2:n0}원, 최고가 {3:n0}원)", m_strCodeName, Config.GetTrailingRate(), Config.GetTrailingCnt(), m_iCurPrice, m_iMaxPrice));
} }
@@ -211,6 +211,40 @@ namespace AutoSellerNS
return aItems; return aItems;
} }
public List<AutoSeller.NCITEM> UpdateNC()
{
List<AutoSeller.NCITEM> NCItems = new List<AutoSeller.NCITEM>();
CPTRADELib.CpTd5339 CP5339 = new CPTRADELib.CpTd5339();
CP5339.SetInputValue(0, Config.GetAccount());
CP5339.SetInputValue(1, Config.GetSubAccount());
CP5339.BlockRequest2(0);
bool bContinue = true;
while(bContinue)
{
int iCnt = CP5339.GetHeaderValue(5);
for(int i = 0; i<iCnt; i++)
{
AutoSeller.NCITEM Item = new AutoSeller.NCITEM();
Item.m_strCode = CP5339.GetDataValue(3, i);
Item.m_strCodeName = CP5339.GetDataValue(4, i);
Item.m_strDesc = CP5339.GetDataValue(5, i);
Item.m_iOrderPrice = CP5339.GetDataValue(7, i);
Item.m_iRemainCnt = CP5339.GetDataValue(11, i);
NCItems.Add(Item);
}
bContinue = (CP5339.Continue != 0);
if(bContinue)
CP5339.BlockRequest2(0);
}
return NCItems;
}
private void CpConclusion_Received() private void CpConclusion_Received()
{ {
string strType = m_CpConclusion.GetHeaderValue(14); string strType = m_CpConclusion.GetHeaderValue(14);
@@ -285,6 +319,18 @@ namespace AutoSellerNS
StockCur.m_CybosHelper = this; StockCur.m_CybosHelper = this;
StockCur.m_strCode = Item.m_strCode; StockCur.m_strCode = Item.m_strCode;
StockCur.m_strCodeName = Item.m_strCodeName; StockCur.m_strCodeName = Item.m_strCodeName;
DSCBO1Lib.StockJpbid2 JpBid = new DSCBO1Lib.StockJpbid2();
JpBid.SetInputValue(0, Item.m_strCode);
JpBid.BlockRequest2(0);
for(int i=0; i<10; i++)
{
StockCur.m_aiAskPrice[i] = JpBid.GetDataValue(0, i);
StockCur.m_aiAskCount[i] = JpBid.GetDataValue(2, i);
StockCur.m_aiBidPrice[i] = JpBid.GetDataValue(1, i);
StockCur.m_aiBidCount[i] = JpBid.GetDataValue(3, i);
}
StockCur.m_StockCur = new DSCBO1Lib.StockCur(); StockCur.m_StockCur = new DSCBO1Lib.StockCur();
StockCur.m_StockCur.SetInputValue(0, Item.m_strCode); StockCur.m_StockCur.SetInputValue(0, Item.m_strCode);
StockCur.m_StockCur.Received += StockCur.OnRecievedPrice; StockCur.m_StockCur.Received += StockCur.OnRecievedPrice;
@@ -299,16 +345,39 @@ namespace AutoSellerNS
} }
} }
public void SellItem(string strCode, int iPrice, int iCnt) 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 SellItem(string strCode, int iCnt, int iAskPrice)
{
int iSellPrice = iAskPrice-GetCallUnitValue(iAskPrice);
CPTRADELib.CpTd0311 Td0311 = new CPTRADELib.CpTd0311(); CPTRADELib.CpTd0311 Td0311 = new CPTRADELib.CpTd0311();
Td0311.SetInputValue(0, "1"); Td0311.SetInputValue(0, "1");
Td0311.SetInputValue(1, Config.GetAccount()); Td0311.SetInputValue(1, Config.GetAccount());
Td0311.SetInputValue(2, Config.GetSubAccount()); Td0311.SetInputValue(2, Config.GetSubAccount());
Td0311.SetInputValue(3, strCode); Td0311.SetInputValue(3, strCode);
Td0311.SetInputValue(4, iCnt); Td0311.SetInputValue(4, iCnt);
Td0311.SetInputValue(5, 0); Td0311.SetInputValue(5, iSellPrice);
Td0311.SetInputValue(8, "03"); Td0311.SetInputValue(8, "01");
Td0311.BlockRequest2(0); Td0311.BlockRequest2(0);
} }
} }