- 시간에 따른 감소폭 추가
- 정정주문 수정 - crash 수정
This commit is contained in:
121
AutoSeller.Designer.cs
generated
121
AutoSeller.Designer.cs
generated
@@ -35,6 +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.tbLog = new System.Windows.Forms.RichTextBox();
|
||||
this.btUpdate = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
this.btCybos = new MaterialSkin.Controls.MaterialRaisedButton();
|
||||
@@ -58,13 +59,14 @@
|
||||
this.cbSMMethod = new System.Windows.Forms.ComboBox();
|
||||
this.tbSMListSize = new System.Windows.Forms.TextBox();
|
||||
this.tbSMSlowUpCnt = new System.Windows.Forms.TextBox();
|
||||
this.tbSMTimeDiffLimit = new System.Windows.Forms.TextBox();
|
||||
this.tbSMTimeSub = new System.Windows.Forms.TextBox();
|
||||
this.tbSMSlowSD = new System.Windows.Forms.TextBox();
|
||||
this.tbSMFastUpCnt = new System.Windows.Forms.TextBox();
|
||||
this.tbSMFastSD = new System.Windows.Forms.TextBox();
|
||||
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()));
|
||||
@@ -76,6 +78,7 @@
|
||||
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.chCheckCountLimit = ((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()));
|
||||
@@ -98,12 +101,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
|
||||
@@ -115,7 +118,7 @@
|
||||
this.materialTabSelector1.Location = new System.Drawing.Point(0, 64);
|
||||
this.materialTabSelector1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.materialTabSelector1.Name = "materialTabSelector1";
|
||||
this.materialTabSelector1.Size = new System.Drawing.Size(1074, 49);
|
||||
this.materialTabSelector1.Size = new System.Drawing.Size(1147, 49);
|
||||
this.materialTabSelector1.TabIndex = 1;
|
||||
this.materialTabSelector1.Text = "materialTabSelector1";
|
||||
//
|
||||
@@ -132,7 +135,7 @@
|
||||
this.materialTabControl1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.materialTabControl1.Name = "materialTabControl1";
|
||||
this.materialTabControl1.SelectedIndex = 0;
|
||||
this.materialTabControl1.Size = new System.Drawing.Size(1068, 719);
|
||||
this.materialTabControl1.Size = new System.Drawing.Size(1141, 719);
|
||||
this.materialTabControl1.TabIndex = 2;
|
||||
//
|
||||
// tabPage1
|
||||
@@ -144,7 +147,7 @@
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(1060, 693);
|
||||
this.tabPage1.Size = new System.Drawing.Size(1133, 693);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Items";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
@@ -179,8 +182,8 @@
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.lvCurPrice);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1054, 655);
|
||||
this.splitContainer2.SplitterDistance = 804;
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1127, 655);
|
||||
this.splitContainer2.SplitterDistance = 859;
|
||||
this.splitContainer2.TabIndex = 2;
|
||||
this.splitContainer2.SizeChanged += new System.EventHandler(this.splitContainer2_SizeChanged);
|
||||
//
|
||||
@@ -198,16 +201,34 @@
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.tbLog);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(804, 655);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(859, 655);
|
||||
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(859, 455);
|
||||
this.splitContainer3.SplitterDistance = 300;
|
||||
this.splitContainer3.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, 196);
|
||||
this.tbLog.Size = new System.Drawing.Size(859, 196);
|
||||
this.tbLog.TabIndex = 0;
|
||||
this.tbLog.Text = "";
|
||||
//
|
||||
@@ -258,7 +279,7 @@
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(1060, 693);
|
||||
this.tabPage2.Size = new System.Drawing.Size(1133, 693);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Preference";
|
||||
//
|
||||
@@ -358,7 +379,7 @@
|
||||
this.materialLabel3.Name = "materialLabel3";
|
||||
this.materialLabel3.Size = new System.Drawing.Size(162, 18);
|
||||
this.materialLabel3.TabIndex = 6;
|
||||
this.materialLabel3.Text = "Version : 2017.02.22.23";
|
||||
this.materialLabel3.Text = "Version : 2017.03.07.15";
|
||||
//
|
||||
// materialLabel2
|
||||
//
|
||||
@@ -451,6 +472,8 @@
|
||||
this.tabPage3.Controls.Add(this.cbSMMethod);
|
||||
this.tabPage3.Controls.Add(this.tbSMListSize);
|
||||
this.tabPage3.Controls.Add(this.tbSMSlowUpCnt);
|
||||
this.tabPage3.Controls.Add(this.tbSMTimeDiffLimit);
|
||||
this.tabPage3.Controls.Add(this.tbSMTimeSub);
|
||||
this.tabPage3.Controls.Add(this.tbSMSlowSD);
|
||||
this.tabPage3.Controls.Add(this.tbSMFastUpCnt);
|
||||
this.tabPage3.Controls.Add(this.tbSMFastSD);
|
||||
@@ -460,7 +483,7 @@
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage3.Size = new System.Drawing.Size(1060, 693);
|
||||
this.tabPage3.Size = new System.Drawing.Size(1133, 693);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "Simulation";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
@@ -471,7 +494,7 @@
|
||||
this.tbSMSlowDownCnt.Name = "tbSMSlowDownCnt";
|
||||
this.tbSMSlowDownCnt.Size = new System.Drawing.Size(36, 21);
|
||||
this.tbSMSlowDownCnt.TabIndex = 8;
|
||||
this.tbSMSlowDownCnt.Text = "0.1";
|
||||
this.tbSMSlowDownCnt.Text = "0.4";
|
||||
//
|
||||
// tbSMFastDownCnt
|
||||
//
|
||||
@@ -479,7 +502,7 @@
|
||||
this.tbSMFastDownCnt.Name = "tbSMFastDownCnt";
|
||||
this.tbSMFastDownCnt.Size = new System.Drawing.Size(36, 21);
|
||||
this.tbSMFastDownCnt.TabIndex = 6;
|
||||
this.tbSMFastDownCnt.Text = "0.3";
|
||||
this.tbSMFastDownCnt.Text = "0.05";
|
||||
//
|
||||
// cbSMMethod
|
||||
//
|
||||
@@ -487,7 +510,8 @@
|
||||
this.cbSMMethod.FormattingEnabled = true;
|
||||
this.cbSMMethod.Items.AddRange(new object[] {
|
||||
"평균 비교",
|
||||
"마지막 비교"});
|
||||
"마지막 비교",
|
||||
"호가 비교"});
|
||||
this.cbSMMethod.Location = new System.Drawing.Point(477, 24);
|
||||
this.cbSMMethod.Name = "cbSMMethod";
|
||||
this.cbSMMethod.Size = new System.Drawing.Size(121, 20);
|
||||
@@ -507,7 +531,23 @@
|
||||
this.tbSMSlowUpCnt.Name = "tbSMSlowUpCnt";
|
||||
this.tbSMSlowUpCnt.Size = new System.Drawing.Size(36, 21);
|
||||
this.tbSMSlowUpCnt.TabIndex = 7;
|
||||
this.tbSMSlowUpCnt.Text = "0.1";
|
||||
this.tbSMSlowUpCnt.Text = "0.4";
|
||||
//
|
||||
// tbSMTimeDiffLimit
|
||||
//
|
||||
this.tbSMTimeDiffLimit.Location = new System.Drawing.Point(375, 101);
|
||||
this.tbSMTimeDiffLimit.Name = "tbSMTimeDiffLimit";
|
||||
this.tbSMTimeDiffLimit.Size = new System.Drawing.Size(36, 21);
|
||||
this.tbSMTimeDiffLimit.TabIndex = 6;
|
||||
this.tbSMTimeDiffLimit.Text = "5";
|
||||
//
|
||||
// tbSMTimeSub
|
||||
//
|
||||
this.tbSMTimeSub.Location = new System.Drawing.Point(333, 101);
|
||||
this.tbSMTimeSub.Name = "tbSMTimeSub";
|
||||
this.tbSMTimeSub.Size = new System.Drawing.Size(36, 21);
|
||||
this.tbSMTimeSub.TabIndex = 6;
|
||||
this.tbSMTimeSub.Text = "0.02";
|
||||
//
|
||||
// tbSMSlowSD
|
||||
//
|
||||
@@ -523,7 +563,7 @@
|
||||
this.tbSMFastUpCnt.Name = "tbSMFastUpCnt";
|
||||
this.tbSMFastUpCnt.Size = new System.Drawing.Size(36, 21);
|
||||
this.tbSMFastUpCnt.TabIndex = 5;
|
||||
this.tbSMFastUpCnt.Text = "0.3";
|
||||
this.tbSMFastUpCnt.Text = "0.05";
|
||||
//
|
||||
// tbSMFastSD
|
||||
//
|
||||
@@ -538,9 +578,10 @@
|
||||
this.tbSimulationLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbSimulationLog.HideSelection = false;
|
||||
this.tbSimulationLog.Location = new System.Drawing.Point(0, 204);
|
||||
this.tbSimulationLog.Name = "tbSimulationLog";
|
||||
this.tbSimulationLog.Size = new System.Drawing.Size(1060, 489);
|
||||
this.tbSimulationLog.Size = new System.Drawing.Size(1133, 489);
|
||||
this.tbSimulationLog.TabIndex = 2;
|
||||
this.tbSimulationLog.Text = "";
|
||||
//
|
||||
@@ -576,24 +617,6 @@
|
||||
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[] {
|
||||
@@ -607,13 +630,14 @@
|
||||
this.chValuation,
|
||||
this.chYield,
|
||||
this.chMaxPrice,
|
||||
this.chCheckCountLimit,
|
||||
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.Size = new System.Drawing.Size(859, 300);
|
||||
this.lvItems.TabIndex = 0;
|
||||
this.lvItems.UseCompatibleStateImageBehavior = false;
|
||||
this.lvItems.View = System.Windows.Forms.View.Details;
|
||||
@@ -675,6 +699,10 @@
|
||||
this.chMaxPrice.Text = "최고가";
|
||||
this.chMaxPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// chCheckCountLimit
|
||||
//
|
||||
this.chCheckCountLimit.Text = "조건제한";
|
||||
//
|
||||
// chCheckCount
|
||||
//
|
||||
this.chCheckCount.Text = "조건횟수";
|
||||
@@ -693,7 +721,7 @@
|
||||
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.Size = new System.Drawing.Size(859, 151);
|
||||
this.lvNCItem.TabIndex = 1;
|
||||
this.lvNCItem.UseCompatibleStateImageBehavior = false;
|
||||
this.lvNCItem.View = System.Windows.Forms.View.Details;
|
||||
@@ -737,7 +765,7 @@
|
||||
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.Size = new System.Drawing.Size(264, 655);
|
||||
this.lvCurPrice.TabIndex = 0;
|
||||
this.lvCurPrice.UseCompatibleStateImageBehavior = false;
|
||||
this.lvCurPrice.View = System.Windows.Forms.View.Details;
|
||||
@@ -767,7 +795,7 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1074, 837);
|
||||
this.ClientSize = new System.Drawing.Size(1147, 837);
|
||||
this.Controls.Add(this.materialTabSelector1);
|
||||
this.Controls.Add(this.materialTabControl1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
@@ -784,14 +812,14 @@
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.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.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -856,5 +884,8 @@
|
||||
public System.Windows.Forms.ComboBox cbSMMethod;
|
||||
public System.Windows.Forms.TextBox tbSMSlowDownCnt;
|
||||
public System.Windows.Forms.TextBox tbSMFastDownCnt;
|
||||
private System.Windows.Forms.ColumnHeader chCheckCountLimit;
|
||||
public System.Windows.Forms.TextBox tbSMTimeSub;
|
||||
public System.Windows.Forms.TextBox tbSMTimeDiffLimit;
|
||||
}
|
||||
}
|
||||
@@ -104,16 +104,28 @@ namespace AutoSellerNS
|
||||
|
||||
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
foreach(var NCItem in m_NCItems)
|
||||
if(m_bSell == false)
|
||||
return;
|
||||
|
||||
lock(m_NCItems)
|
||||
{
|
||||
if(NCItem.m_bAsk == true && DateTime.Now-NCItem.m_Time >= TimeSpan.FromSeconds(3))
|
||||
var NCList = m_NCItems;
|
||||
foreach(var NCItem in NCList)
|
||||
{
|
||||
m_CybosHelper.CorrectionItem(NCItem.m_strCode, NCItem.m_iOrgOrderNo, m_CybosHelper.GetItem(NCItem.m_strCode).m_aiAskPrice[0]);
|
||||
if(NCItem.m_bAsk == true && DateTime.Now-NCItem.m_Time >= TimeSpan.FromSeconds(5))
|
||||
{
|
||||
var CurItem = m_CybosHelper.GetItem(NCItem.m_strCode);
|
||||
if(CurItem == null)
|
||||
continue;
|
||||
|
||||
int iAskPrice = CurItem.m_aiAskPrice[0];
|
||||
m_CybosHelper.CorrectionItem(NCItem.m_strCode, NCItem.m_iOrgOrderNo, NCItem.m_iRemainCnt, iAskPrice);
|
||||
NCItem.m_Time = DateTime.Now;
|
||||
Util.Log(Util.LOG_TYPE.SELL, string.Format("[{0}] 정정 주문", NCItem.m_strCodeName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAccountList(string[] aAccountList)
|
||||
{
|
||||
@@ -169,6 +181,7 @@ namespace AutoSellerNS
|
||||
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:n2}", ItemCur.m_dCheckCountLimit) : "",
|
||||
ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iCheckCount) : "",
|
||||
}));
|
||||
|
||||
@@ -196,6 +209,7 @@ namespace AutoSellerNS
|
||||
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:n2}", ItemCur.m_dCheckCountLimit) : "",
|
||||
ItemCur != null ? string.Format("{0:n0}", ItemCur.m_iCheckCount) : "",
|
||||
}));
|
||||
|
||||
@@ -315,7 +329,7 @@ namespace AutoSellerNS
|
||||
return m_bSell;
|
||||
}
|
||||
|
||||
public void OnReceivedCurPrice(string strCode, int iPrice, int iMaxPrice, int iCheckCount, bool bReal)
|
||||
public void OnReceivedCurPrice(string strCode, int iPrice, int iMaxPrice, double dCheckCountLimit, int iCheckCount, bool bReal)
|
||||
{
|
||||
ITEM Item = m_Items.FirstOrDefault(s => s.m_strCode == strCode);
|
||||
if (Item == default(ITEM))
|
||||
@@ -337,6 +351,7 @@ namespace AutoSellerNS
|
||||
row.SubItems[chAssessedValue.Index].Text = string.Format("{0:n0}", Item.m_iAssessedValue);
|
||||
row.SubItems[chYield.Index].Text = string.Format("{0:n2}", Item.m_dYield);
|
||||
row.SubItems[chMaxPrice.Index].Text = string.Format("{0:n0}", iMaxPrice);
|
||||
row.SubItems[chCheckCountLimit.Index].Text = string.Format("{0:n2}", dCheckCountLimit);
|
||||
row.SubItems[chCheckCount.Index].Text = string.Format("{0:n0}", iCheckCount);
|
||||
}));
|
||||
}
|
||||
@@ -350,6 +365,7 @@ namespace AutoSellerNS
|
||||
row.SubItems[chAssessedValue.Index].Text = string.Format("{0:n0}", Item.m_iAssessedValue);
|
||||
row.SubItems[chYield.Index].Text = string.Format("{0:n2}", Item.m_dYield);
|
||||
row.SubItems[chMaxPrice.Index].Text = string.Format("{0:n0}", iMaxPrice);
|
||||
row.SubItems[chCheckCountLimit.Index].Text = string.Format("{0:n2}", dCheckCountLimit);
|
||||
row.SubItems[chCheckCount.Index].Text = string.Format("{0:n0}", iCheckCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoSellerNS
|
||||
{
|
||||
class CybosHelper
|
||||
public class CybosHelper
|
||||
{
|
||||
public class STOCK_CUR_ITEM
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace AutoSellerNS
|
||||
public int m_iTrailingCount = 0;
|
||||
|
||||
public List<int> m_PriceList = new List<int>();
|
||||
public double m_dCheckCount = 5;
|
||||
public double m_dCheckCountLimit = 5;
|
||||
|
||||
double m_dFastSD = 0.75;
|
||||
double m_dFastUpCnt = 0.05;
|
||||
@@ -36,12 +37,22 @@ namespace AutoSellerNS
|
||||
double m_dSlowSD = 0.2;
|
||||
double m_dSlowUpCnt = 0.4;
|
||||
double m_dSlowDownCnt = 0.4;
|
||||
int m_iTimeLimit = 5;
|
||||
int m_iPrevTime = 0;
|
||||
double m_dTimeSub = 0.02;
|
||||
|
||||
public void OnRecievedPrice()
|
||||
{
|
||||
bool bReal = (m_StockCur.GetHeaderValue(19) == '2');
|
||||
m_iCurPrice = m_StockCur.GetHeaderValue(13);
|
||||
int iTime = m_StockCur.GetHeaderValue(18); // *** 초단위 시간 확인
|
||||
|
||||
int iTimeDiff = 0;
|
||||
if(m_iPrevTime > 0)
|
||||
iTimeDiff = ((iTime/10000)*60*60 + ((iTime%10000)/100)*60 + (iTime%100)) - ((m_iPrevTime/10000)*60*60 + ((m_iPrevTime%10000)/100)*60 + (m_iPrevTime%100));
|
||||
|
||||
if(bReal == true)
|
||||
{
|
||||
m_PriceList.Add(m_iCurPrice);
|
||||
double dAverage = (float)m_PriceList.Average();
|
||||
double sumOfSquaresOfDifferences = m_PriceList.Select(val => Math.Pow((val-dAverage)/m_CybosHelper.GetUnitValue(val), 2)).Sum();
|
||||
@@ -49,19 +60,21 @@ namespace AutoSellerNS
|
||||
if(dStdDev >= m_dFastSD)
|
||||
{
|
||||
if(m_iCurPrice >= dAverage)
|
||||
m_dCheckCount += m_dFastUpCnt;
|
||||
m_dCheckCountLimit += m_dFastUpCnt;
|
||||
else
|
||||
m_dCheckCount -= m_dFastDownCnt;
|
||||
|
||||
m_dCheckCountLimit -= m_dFastDownCnt;
|
||||
}
|
||||
else if(dStdDev <= m_dSlowSD)
|
||||
{
|
||||
if(m_iCurPrice >= dAverage)
|
||||
m_dCheckCount += m_dSlowUpCnt;
|
||||
m_dCheckCountLimit += m_dSlowUpCnt;
|
||||
else
|
||||
m_dCheckCount -= m_dSlowDownCnt;
|
||||
m_dCheckCountLimit -= m_dSlowDownCnt;
|
||||
}
|
||||
|
||||
m_dCheckCountLimit -= iTimeDiff*m_dTimeSub;
|
||||
|
||||
|
||||
if(m_iCurPrice > m_iMaxPrice)
|
||||
m_iTrailingCount = 0;
|
||||
|
||||
@@ -69,29 +82,48 @@ namespace AutoSellerNS
|
||||
|
||||
int iAskPrice = m_StockCur.GetHeaderValue(7);
|
||||
int iBidPrice = m_StockCur.GetHeaderValue(8);
|
||||
if(bReal == true)
|
||||
{
|
||||
|
||||
if(m_iCurPrice <= iBidPrice)
|
||||
m_iCheckCount++;
|
||||
else
|
||||
m_iCheckCount = 0;
|
||||
}
|
||||
|
||||
if(m_iCheckCount >= m_dCheckCount && m_Listener.IsSelling() == true)
|
||||
if(m_iCheckCount >= m_dCheckCountLimit && m_Listener.IsSelling() == true)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
if(bReal == true && m_iCurPrice < (m_iMaxPrice*(100.0f-Config.GetTrailingRate())/100.0f))
|
||||
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_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}회) (현재가 {3:n0}원, 최고가 {4:n0}원)",
|
||||
m_strCodeName,
|
||||
Config.GetTrailingRate(),
|
||||
Config.GetTrailingCnt(),
|
||||
m_iCurPrice,
|
||||
m_iMaxPrice));
|
||||
}
|
||||
|
||||
m_Listener.OnReceivedCurPrice(m_strCode, m_iCurPrice, m_iMaxPrice, m_iCheckCount, bReal);
|
||||
if(iTimeDiff >= m_iTimeLimit)
|
||||
{
|
||||
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,
|
||||
iTimeDiff,
|
||||
m_iCurPrice,
|
||||
m_iMaxPrice));
|
||||
}
|
||||
}
|
||||
|
||||
m_Listener.OnReceivedCurPrice(m_strCode, m_iCurPrice, m_iMaxPrice, m_dCheckCountLimit, m_iCheckCount, bReal);
|
||||
m_iPrevTime = iTime;
|
||||
}
|
||||
|
||||
public void OnReceivedCall()
|
||||
@@ -125,6 +157,8 @@ namespace AutoSellerNS
|
||||
CPTRADELib.CpTd6033 m_6033 = new CPTRADELib.CpTd6033();
|
||||
Dictionary<string, STOCK_CUR_ITEM> m_aStockCur = new Dictionary<string, STOCK_CUR_ITEM>();
|
||||
|
||||
object m_NCItemLock = new object();
|
||||
|
||||
public CybosHelper(AutoSeller Listener)
|
||||
{
|
||||
m_Listener = Listener;
|
||||
@@ -245,7 +279,8 @@ namespace AutoSellerNS
|
||||
public List<AutoSeller.NCITEM> UpdateNC()
|
||||
{
|
||||
List<AutoSeller.NCITEM> NCItems = new List<AutoSeller.NCITEM>();
|
||||
|
||||
lock(m_NCItemLock)
|
||||
{
|
||||
CPTRADELib.CpTd5339 CP5339 = new CPTRADELib.CpTd5339();
|
||||
CP5339.SetInputValue(0, Config.GetAccount());
|
||||
CP5339.SetInputValue(1, Config.GetSubAccount());
|
||||
@@ -266,6 +301,8 @@ namespace AutoSellerNS
|
||||
Item.m_iRemainCnt = CP5339.GetDataValue(11, i);
|
||||
Item.m_bAsk = (CP5339.GetDataValue(13, i) == "1");
|
||||
Item.m_iOrgOrderNo = CP5339.GetDataValue(2, i);
|
||||
if(Item.m_iOrgOrderNo == 0)
|
||||
Item.m_iOrgOrderNo = CP5339.GetDataValue(1, i);
|
||||
|
||||
NCItems.Add(Item);
|
||||
}
|
||||
@@ -274,6 +311,7 @@ namespace AutoSellerNS
|
||||
if(bContinue)
|
||||
CP5339.BlockRequest2(0);
|
||||
}
|
||||
}
|
||||
|
||||
return NCItems;
|
||||
}
|
||||
@@ -421,10 +459,25 @@ namespace AutoSellerNS
|
||||
Td0311.BlockRequest2(0);
|
||||
}
|
||||
|
||||
public void CorrectionItem(string strCode, int iOrgOrderNo, int iAskPrice)
|
||||
public void CancelItem(string strCode, int iOrgOrderNo)
|
||||
{
|
||||
CPTRADELib.CpTd0314 Td0314 = new CPTRADELib.CpTd0314();
|
||||
Td0314.SetInputValue(1, iOrgOrderNo);
|
||||
Td0314.SetInputValue(2, Config.GetAccount());
|
||||
Td0314.SetInputValue(3, Config.GetSubAccount());
|
||||
Td0314.SetInputValue(4, strCode);
|
||||
Td0314.SetInputValue(5, 0);
|
||||
Td0314.BlockRequest2(0);
|
||||
}
|
||||
|
||||
public void CorrectionItem(string strCode, int iOrgOrderNo, int iCnt, int iAskPrice)
|
||||
{
|
||||
int iSellPrice = iAskPrice-GetUnitValue(iAskPrice);
|
||||
|
||||
//CancelItem(strCode, iOrgOrderNo);
|
||||
//Thread.Sleep(1000);
|
||||
//SellItem(strCode, iCnt, iAskPrice);
|
||||
|
||||
CPTRADELib.CpTd0313 Td0313 = new CPTRADELib.CpTd0313();
|
||||
Td0313.SetInputValue(1, iOrgOrderNo);
|
||||
Td0313.SetInputValue(2, Config.GetAccount());
|
||||
|
||||
@@ -27,178 +27,178 @@ namespace AutoSellerNS
|
||||
m_tbLogView = tbLog;
|
||||
}
|
||||
|
||||
public void LoadTxt()
|
||||
{
|
||||
List<string> aItems = new List<string>();
|
||||
StockChart CPStockChart = new StockChart();
|
||||
//public void LoadTxt()
|
||||
//{
|
||||
// List<string> aItems = new List<string>();
|
||||
// StockChart CPStockChart = new StockChart();
|
||||
|
||||
foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
{
|
||||
var tokens = strLine.Split('\t');
|
||||
// foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
// {
|
||||
// var tokens = strLine.Split('\t');
|
||||
|
||||
var strDate = tokens[0];
|
||||
var strNewTime = tokens[1];
|
||||
var strSimulationTime = tokens[2];
|
||||
var strCodeName = tokens[3];
|
||||
var strCode = tokens[4];
|
||||
var strStartPrice = tokens[5];
|
||||
// var strDate = tokens[0];
|
||||
// var strNewTime = tokens[1];
|
||||
// var strSimulationTime = tokens[2];
|
||||
// var strCodeName = tokens[3];
|
||||
// var strCode = tokens[4];
|
||||
// var strStartPrice = tokens[5];
|
||||
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
uint uiStartDate;
|
||||
uint.TryParse(StartDT.ToString("yyyyMMdd"), out uiStartDate);
|
||||
// DateTime StartDT;
|
||||
// DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
// uint uiStartDate;
|
||||
// uint.TryParse(StartDT.ToString("yyyyMMdd"), out uiStartDate);
|
||||
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + strCodeName + "-" + StartDT.ToString("yyyy-MM-dd") + ".txt";
|
||||
if(File.Exists(strOutFileName) == true)
|
||||
continue;
|
||||
// string strOutFileName = Util.GetSimulationPath() + "/" + strCodeName + "-" + StartDT.ToString("yyyy-MM-dd") + ".txt";
|
||||
// if(File.Exists(strOutFileName) == true)
|
||||
// continue;
|
||||
|
||||
CPStockChart.SetInputValue(0, "A"+strCode);
|
||||
CPStockChart.SetInputValue(1, '1');
|
||||
CPStockChart.SetInputValue(2, uiStartDate);
|
||||
CPStockChart.SetInputValue(3, uiStartDate);
|
||||
CPStockChart.SetInputValue(4, 100000);
|
||||
CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
CPStockChart.SetInputValue(6, 'T');
|
||||
CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.SetInputValue(0, "A"+strCode);
|
||||
// CPStockChart.SetInputValue(1, '1');
|
||||
// CPStockChart.SetInputValue(2, uiStartDate);
|
||||
// CPStockChart.SetInputValue(3, uiStartDate);
|
||||
// CPStockChart.SetInputValue(4, 100000);
|
||||
// CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
// CPStockChart.SetInputValue(6, 'T');
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
|
||||
int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
// int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
// string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
|
||||
string strOutLine = "";
|
||||
for(int j = 0; j<iFieldCnt; j++)
|
||||
{
|
||||
strOutLine += astrFieldName[j];
|
||||
strOutLine += '\t';
|
||||
}
|
||||
File.AppendAllText(strOutFileName, strOutLine+Environment.NewLine, new UTF8Encoding(true));
|
||||
strOutLine = "";
|
||||
// string strOutLine = "";
|
||||
// for(int j = 0; j<iFieldCnt; j++)
|
||||
// {
|
||||
// strOutLine += astrFieldName[j];
|
||||
// strOutLine += '\t';
|
||||
// }
|
||||
// File.AppendAllText(strOutFileName, strOutLine+Environment.NewLine, new UTF8Encoding(true));
|
||||
// strOutLine = "";
|
||||
|
||||
bool bContinue = true;
|
||||
while(bContinue == true)
|
||||
{
|
||||
int iCnt = CPStockChart.GetHeaderValue(3);
|
||||
for(int i = 0; i<iCnt; i++)
|
||||
{
|
||||
for(int j = 0; j<iFieldCnt; j++)
|
||||
{
|
||||
strOutLine += CPStockChart.GetDataValue(j, i);
|
||||
strOutLine += '\t';
|
||||
}
|
||||
// bool bContinue = true;
|
||||
// while(bContinue == true)
|
||||
// {
|
||||
// int iCnt = CPStockChart.GetHeaderValue(3);
|
||||
// for(int i = 0; i<iCnt; i++)
|
||||
// {
|
||||
// for(int j = 0; j<iFieldCnt; j++)
|
||||
// {
|
||||
// strOutLine += CPStockChart.GetDataValue(j, i);
|
||||
// strOutLine += '\t';
|
||||
// }
|
||||
|
||||
strOutLine += Environment.NewLine;
|
||||
// strOutLine += Environment.NewLine;
|
||||
|
||||
if(i % 1000 == 999)
|
||||
{
|
||||
File.AppendAllText(strOutFileName, strOutLine, new UTF8Encoding(true));
|
||||
strOutLine = "";
|
||||
}
|
||||
}
|
||||
// if(i % 1000 == 999)
|
||||
// {
|
||||
// File.AppendAllText(strOutFileName, strOutLine, new UTF8Encoding(true));
|
||||
// strOutLine = "";
|
||||
// }
|
||||
// }
|
||||
|
||||
bContinue = (CPStockChart.Continue==1);
|
||||
if(bContinue == true)
|
||||
CPStockChart.BlockRequest2(0);
|
||||
// bContinue = (CPStockChart.Continue==1);
|
||||
// if(bContinue == true)
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
|
||||
m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
// }
|
||||
|
||||
if(strOutLine.Length > 0)
|
||||
{
|
||||
File.AppendAllText(strOutFileName, strOutLine, new UTF8Encoding(true));
|
||||
strOutLine = "";
|
||||
}
|
||||
// if(strOutLine.Length > 0)
|
||||
// {
|
||||
// File.AppendAllText(strOutFileName, strOutLine, new UTF8Encoding(true));
|
||||
// strOutLine = "";
|
||||
// }
|
||||
|
||||
m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End"));
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End"));
|
||||
// }
|
||||
|
||||
m_tbLogView.AppendText(string.Format("[Load] All End"));
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("[Load] All End"));
|
||||
//}
|
||||
|
||||
public void LoadExcel()
|
||||
{
|
||||
List<string> aItems = new List<string>();
|
||||
StockChart CPStockChart = new StockChart();
|
||||
ExcelHandler Excel = null;
|
||||
//public void LoadExcel()
|
||||
//{
|
||||
// List<string> aItems = new List<string>();
|
||||
// StockChart CPStockChart = new StockChart();
|
||||
// ExcelHandler Excel = null;
|
||||
|
||||
foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
{
|
||||
var tokens = strLine.Split('\t');
|
||||
// foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
// {
|
||||
// var tokens = strLine.Split('\t');
|
||||
|
||||
var strDate = tokens[0];
|
||||
var strNewTime = tokens[1];
|
||||
var strSimulationTime = tokens[2];
|
||||
var strCodeName = tokens[3];
|
||||
strCodeName = strCodeName.Trim();
|
||||
var strCode = tokens[4];
|
||||
var strStartPrice = tokens[5];
|
||||
// var strDate = tokens[0];
|
||||
// var strNewTime = tokens[1];
|
||||
// var strSimulationTime = tokens[2];
|
||||
// var strCodeName = tokens[3];
|
||||
// strCodeName = strCodeName.Trim();
|
||||
// var strCode = tokens[4];
|
||||
// var strStartPrice = tokens[5];
|
||||
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
// DateTime StartDT;
|
||||
// DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-StockChart-" + strCodeName + ".xlsx";
|
||||
if(File.Exists(strOutFileName) == true)
|
||||
{
|
||||
if(StartDT.DayOfYear == DateTime.Now.DayOfYear)
|
||||
File.Delete(strOutFileName);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
// string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-StockChart-" + strCodeName + ".xlsx";
|
||||
// if(File.Exists(strOutFileName) == true)
|
||||
// {
|
||||
// if(StartDT.DayOfYear == DateTime.Now.DayOfYear)
|
||||
// File.Delete(strOutFileName);
|
||||
// else
|
||||
// continue;
|
||||
// }
|
||||
|
||||
CPStockChart.SetInputValue(0, "A"+strCode);
|
||||
CPStockChart.SetInputValue(1, '1');
|
||||
CPStockChart.SetInputValue(2, StartDT.ToString("yyyyMMdd"));
|
||||
CPStockChart.SetInputValue(3, StartDT.ToString("yyyyMMdd"));
|
||||
CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
CPStockChart.SetInputValue(6, 'T');
|
||||
CPStockChart.BlockRequest2(0);
|
||||
// CPStockChart.SetInputValue(0, "A"+strCode);
|
||||
// CPStockChart.SetInputValue(1, '1');
|
||||
// CPStockChart.SetInputValue(2, StartDT.ToString("yyyyMMdd"));
|
||||
// CPStockChart.SetInputValue(3, StartDT.ToString("yyyyMMdd"));
|
||||
// CPStockChart.SetInputValue(5, new int[] { 0, 1, 5, 8, 9, 10, 11 });
|
||||
// CPStockChart.SetInputValue(6, 'T');
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
|
||||
int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
List<object> aRow = new List<object>();
|
||||
List<object[]> aaRows = new List<object[]>();
|
||||
// int iFieldCnt = CPStockChart.GetHeaderValue(1);
|
||||
// string[] astrFieldName = CPStockChart.GetHeaderValue(2);
|
||||
// List<object> aRow = new List<object>();
|
||||
// List<object[]> aaRows = new List<object[]>();
|
||||
|
||||
Excel = new ExcelHandler(strOutFileName, astrFieldName);
|
||||
// Excel = new ExcelHandler(strOutFileName, astrFieldName);
|
||||
|
||||
bool bContinue = true;
|
||||
while(bContinue == true)
|
||||
{
|
||||
int iCnt = CPStockChart.GetHeaderValue(3);
|
||||
for(int i = 0; i<iCnt; i++)
|
||||
{
|
||||
for(int j = 0; j<iFieldCnt; j++)
|
||||
aRow.Add(CPStockChart.GetDataValue(j, i));
|
||||
// bool bContinue = true;
|
||||
// while(bContinue == true)
|
||||
// {
|
||||
// int iCnt = CPStockChart.GetHeaderValue(3);
|
||||
// for(int i = 0; i<iCnt; i++)
|
||||
// {
|
||||
// for(int j = 0; j<iFieldCnt; j++)
|
||||
// aRow.Add(CPStockChart.GetDataValue(j, i));
|
||||
|
||||
if(aaRows.Count == 0)
|
||||
{
|
||||
aRow.Add(0);
|
||||
aRow.Add(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
aRow.Add((uint)aaRows.Last()[5]-(uint)aRow[5]);
|
||||
aRow.Add((uint)aaRows.Last()[6]-(uint)aRow[6]);
|
||||
}
|
||||
// if(aaRows.Count == 0)
|
||||
// {
|
||||
// aRow.Add(0);
|
||||
// aRow.Add(0);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// aRow.Add((uint)aaRows.Last()[5]-(uint)aRow[5]);
|
||||
// aRow.Add((uint)aaRows.Last()[6]-(uint)aRow[6]);
|
||||
// }
|
||||
|
||||
aaRows.Add(aRow.ToArray());
|
||||
aRow.Clear();
|
||||
}
|
||||
// aaRows.Add(aRow.ToArray());
|
||||
// aRow.Clear();
|
||||
// }
|
||||
|
||||
bContinue = (CPStockChart.Continue==1);
|
||||
if(bContinue == true)
|
||||
CPStockChart.BlockRequest2(0);
|
||||
// bContinue = (CPStockChart.Continue==1);
|
||||
// if(bContinue == true)
|
||||
// CPStockChart.BlockRequest2(0);
|
||||
|
||||
m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("RequestRQ({0}) ", m_CybosHelper.GetLimitRemainCountRQ()));
|
||||
// }
|
||||
|
||||
aaRows.Reverse();
|
||||
Excel.AddRows(aaRows.ToArray());
|
||||
// aaRows.Reverse();
|
||||
// Excel.AddRows(aaRows.ToArray());
|
||||
|
||||
m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End\n"));
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("[Load] " + strOutFileName + " End\n"));
|
||||
// }
|
||||
|
||||
m_tbLogView.AppendText(string.Format("[Load] All End\n\n"));
|
||||
m_tbLogView.SelectionStart = m_tbLogView.TextLength;
|
||||
m_tbLogView.ScrollToCaret();
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("[Load] All End\n\n"));
|
||||
// m_tbLogView.SelectionStart = m_tbLogView.TextLength;
|
||||
// m_tbLogView.ScrollToCaret();
|
||||
//}
|
||||
|
||||
public void LoadExcel2()
|
||||
{
|
||||
@@ -221,6 +221,8 @@ namespace AutoSellerNS
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
|
||||
|
||||
|
||||
string strOutFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-JpBid-" + strCodeName + ".xlsx";
|
||||
if(File.Exists(strOutFileName) == true)
|
||||
{
|
||||
@@ -279,131 +281,136 @@ namespace AutoSellerNS
|
||||
m_tbLogView.ScrollToCaret();
|
||||
}
|
||||
|
||||
public void StartSimuation()
|
||||
{
|
||||
m_tbLogView.AppendText(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n", Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt()));
|
||||
//public void StartSimuation()
|
||||
//{
|
||||
// m_tbLogView.AppendText(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n", Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt()));
|
||||
|
||||
int iTotalProfit = 0;
|
||||
int iTotalBid = 0;
|
||||
// int iTotalProfit = 0;
|
||||
// int iTotalBid = 0;
|
||||
|
||||
foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
{
|
||||
var tokens = strLine.Split('\t');
|
||||
// foreach(string strLine in File.ReadLines(Util.GetSimulationPath()+"/0-input.txt", Encoding.UTF8))
|
||||
// {
|
||||
// var tokens = strLine.Split('\t');
|
||||
|
||||
var strDate = tokens[0];
|
||||
var strNewTime = tokens[1];
|
||||
var strSimulationTime = tokens[2];
|
||||
var strCodeName = tokens[3];
|
||||
strCodeName = strCodeName.Trim();
|
||||
var strCode = tokens[4];
|
||||
var strStartPrice = tokens[5];
|
||||
// var strDate = tokens[0];
|
||||
// var strNewTime = tokens[1];
|
||||
// var strSimulationTime = tokens[2];
|
||||
// var strCodeName = tokens[3];
|
||||
// strCodeName = strCodeName.Trim();
|
||||
// var strCode = tokens[4];
|
||||
// var strStartPrice = tokens[5];
|
||||
|
||||
DateTime StartDT;
|
||||
DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
// DateTime StartDT;
|
||||
// DateTime.TryParse(strDate+" "+strSimulationTime, out StartDT);
|
||||
|
||||
int iStartPrice;
|
||||
int.TryParse(strStartPrice, NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out iStartPrice);
|
||||
// int iStartPrice;
|
||||
// int.TryParse(strStartPrice, NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out iStartPrice);
|
||||
|
||||
string strFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-StockChart-" + strCodeName + ".xlsx";
|
||||
// string strFileName = Util.GetSimulationPath() + "/" + StartDT.ToString("yyyy-MM-dd") + "-StockChart-" + strCodeName + ".xlsx";
|
||||
|
||||
|
||||
FileInfo newFile = new FileInfo(strFileName);
|
||||
ExcelPackage package = new ExcelPackage(newFile);
|
||||
ExcelWorksheet Sheet = package.Workbook.Worksheets["sheet"];
|
||||
// FileInfo newFile = new FileInfo(strFileName);
|
||||
// ExcelPackage package = new ExcelPackage(newFile);
|
||||
// ExcelWorksheet Sheet = package.Workbook.Worksheets["sheet"];
|
||||
|
||||
int iMaxRow = Sheet.Dimension.Rows;
|
||||
// int iMaxRow = Sheet.Dimension.Rows;
|
||||
|
||||
DateTime RowDT;
|
||||
bool bStart = false;
|
||||
int iTotalAskCount = 0;
|
||||
int iTotalBidCount = 0;
|
||||
int iPrevAskCount = 0;
|
||||
int iPrevBidCount = 0;
|
||||
bool bBid = false;
|
||||
int iAskCount = 0;
|
||||
int iTrailingCount = 0;
|
||||
int iMaxPrice = int.MinValue;
|
||||
int iStockCount = 0;
|
||||
int iStartRow = 0;
|
||||
int iPrevPrice = 0;
|
||||
for(int iRow = 2; iRow<=iMaxRow; iRow++)
|
||||
{
|
||||
int iTime = (int)(double)Sheet.Cells[iRow, 2].Value;
|
||||
int iPrice = (int)(double)Sheet.Cells[iRow, 3].Value;
|
||||
iTotalAskCount = (int)(double)Sheet.Cells[iRow, 6].Value;
|
||||
iTotalBidCount = (int)(double)Sheet.Cells[iRow, 7].Value;
|
||||
// DateTime RowDT;
|
||||
// bool bStart = false;
|
||||
// int iTotalAskCount = 0;
|
||||
// int iTotalBidCount = 0;
|
||||
// int iPrevAskCount = 0;
|
||||
// int iPrevBidCount = 0;
|
||||
// bool bBid = false;
|
||||
// int iAskCount = 0;
|
||||
// int iTrailingCount = 0;
|
||||
// int iMaxPrice = int.MinValue;
|
||||
// int iStockCount = 0;
|
||||
// int iStartRow = 0;
|
||||
// int iPrevPrice = 0;
|
||||
// for(int iRow = 2; iRow<=iMaxRow; iRow++)
|
||||
// {
|
||||
// int iTime = (int)(double)Sheet.Cells[iRow, 2].Value;
|
||||
// int iPrice = (int)(double)Sheet.Cells[iRow, 3].Value;
|
||||
// iTotalAskCount = (int)(double)Sheet.Cells[iRow, 6].Value;
|
||||
// iTotalBidCount = (int)(double)Sheet.Cells[iRow, 7].Value;
|
||||
|
||||
bBid = (iTotalAskCount == iPrevAskCount);
|
||||
DateTime.TryParse(strDate+" "+string.Format("{0}:{1}:{2}", iTime/100, iTime%100, 59), out RowDT);
|
||||
// bBid = (iTotalAskCount == iPrevAskCount);
|
||||
// DateTime.TryParse(strDate+" "+string.Format("{0}:{1}:{2}", iTime/100, iTime%100, 59), out RowDT);
|
||||
|
||||
iStockCount = 1000000/iStartPrice;
|
||||
// iStockCount = 1000000/iStartPrice;
|
||||
|
||||
if(bStart == false)
|
||||
{
|
||||
if(RowDT >= StartDT && iPrice==iStartPrice)
|
||||
{
|
||||
bStart = true;
|
||||
iStartRow = iRow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bBid == false)
|
||||
iAskCount++;
|
||||
else
|
||||
iAskCount = 0;
|
||||
// if(bStart == false)
|
||||
// {
|
||||
// if(RowDT >= StartDT && iPrice==iStartPrice)
|
||||
// {
|
||||
// bStart = true;
|
||||
// iStartRow = iRow;
|
||||
// }
|
||||
// else if((RowDT-StartDT).Minutes > 10)
|
||||
// {
|
||||
// InsertLog(string.Format("[{0,-10}] 매수 가격 찾기 실패", strCodeName));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if(bBid == false)
|
||||
// iAskCount++;
|
||||
// else
|
||||
// iAskCount = 0;
|
||||
|
||||
if(iAskCount >= Config.GetBidCount())
|
||||
{
|
||||
m_tbLogView.AppendText(string.Format("[{0,-10}] 조건 매도 {1} line:{2} {3:n0}원 ({4} : {5:n2}%) (매수 : {6:n0}원, line:{7})\n",
|
||||
strCodeName,
|
||||
RowDT.ToString("yyyy-MM-dd HH:mm:00"),
|
||||
iRow,
|
||||
iPrice,
|
||||
iPrice-iStartPrice,
|
||||
(iPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
iStartPrice,
|
||||
iStartRow
|
||||
));
|
||||
iTotalProfit += (iPrice-iStartPrice)*iStockCount;
|
||||
iTotalBid += iStartPrice*iStockCount;
|
||||
break;
|
||||
}
|
||||
// if(iAskCount >= Config.GetBidCount())
|
||||
// {
|
||||
// m_tbLogView.AppendText(string.Format("[{0,-10}] 조건 매도 {1} line:{2} {3:n0}원 ({4} : {5:n2}%) (매수 : {6:n0}원, line:{7})\n",
|
||||
// strCodeName,
|
||||
// RowDT.ToString("yyyy-MM-dd HH:mm:00"),
|
||||
// iRow,
|
||||
// iPrice,
|
||||
// iPrice-iStartPrice,
|
||||
// (iPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
// iStartPrice,
|
||||
// iStartRow
|
||||
// ));
|
||||
// iTotalProfit += (iPrice-iStartPrice)*iStockCount;
|
||||
// iTotalBid += iStartPrice*iStockCount;
|
||||
// break;
|
||||
// }
|
||||
|
||||
if(iPrice > iMaxPrice)
|
||||
iTrailingCount = 0;
|
||||
else if(iPrice <= iMaxPrice*(100-Config.GetTrailingRate())/100)
|
||||
iTrailingCount++;
|
||||
iMaxPrice = Math.Max(iPrice, iMaxPrice);
|
||||
// if(iPrice > iMaxPrice)
|
||||
// iTrailingCount = 0;
|
||||
// else if(iPrice <= iMaxPrice*(100-Config.GetTrailingRate())/100)
|
||||
// iTrailingCount++;
|
||||
// iMaxPrice = Math.Max(iPrice, iMaxPrice);
|
||||
|
||||
if(iTrailingCount >= Config.GetTrailingCnt())
|
||||
{
|
||||
m_tbLogView.AppendText(string.Format("[{0}] 트레일링 매도 {1} line:{2} {3:n0}원 ({4} : {5:n2}%) (매수 : {6:n0}원, line:{7})\n",
|
||||
strCodeName,
|
||||
RowDT.ToString("yyyy-MM-dd HH:mm:00"),
|
||||
iRow,
|
||||
iPrice,
|
||||
iPrice-iStartPrice,
|
||||
(iPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
iStartPrice,
|
||||
iStartRow
|
||||
));
|
||||
iTotalProfit += (iPrice-iStartPrice)*iStockCount;
|
||||
iTotalBid += iStartPrice*iStockCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if(iTrailingCount >= Config.GetTrailingCnt())
|
||||
// {
|
||||
// m_tbLogView.AppendText(string.Format("[{0}] 트레일링 매도 {1} line:{2} {3:n0}원 ({4} : {5:n2}%) (매수 : {6:n0}원, line:{7})\n",
|
||||
// strCodeName,
|
||||
// RowDT.ToString("yyyy-MM-dd HH:mm:00"),
|
||||
// iRow,
|
||||
// iPrice,
|
||||
// iPrice-iStartPrice,
|
||||
// (iPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
// iStartPrice,
|
||||
// iStartRow
|
||||
// ));
|
||||
// iTotalProfit += (iPrice-iStartPrice)*iStockCount;
|
||||
// iTotalBid += iStartPrice*iStockCount;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
iPrevPrice = iPrice;
|
||||
iPrevAskCount = iTotalAskCount;
|
||||
iPrevBidCount = iTotalBidCount;
|
||||
}
|
||||
}
|
||||
// iPrevPrice = iPrice;
|
||||
// iPrevAskCount = iTotalAskCount;
|
||||
// iPrevBidCount = iTotalBidCount;
|
||||
// }
|
||||
// }
|
||||
|
||||
m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0}원 : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/(float)iTotalBid));
|
||||
m_tbLogView.SelectionStart = m_tbLogView.TextLength;
|
||||
m_tbLogView.ScrollToCaret();
|
||||
}
|
||||
// m_tbLogView.AppendText(string.Format("[시뮬레이션 종료] 총수익 : {0:n0}원 : {1:n2}%\n\n", iTotalProfit, iTotalProfit*100/(float)iTotalBid));
|
||||
// m_tbLogView.SelectionStart = m_tbLogView.TextLength;
|
||||
// m_tbLogView.ScrollToCaret();
|
||||
//}
|
||||
|
||||
void InsertLog(string strMsg)
|
||||
{
|
||||
@@ -437,10 +444,11 @@ namespace AutoSellerNS
|
||||
double dSlowSD = (double)aParams[4];
|
||||
double dSlowUpCnt = (double)aParams[5];
|
||||
double dSlowDownCnt = (double)aParams[6];
|
||||
bool bAverageCompare = (bool)aParams[7];
|
||||
int iCompareType = (int)aParams[7];
|
||||
string strMethod = (string)aParams[8];
|
||||
string strLine = (string)aParams[9];
|
||||
|
||||
double dTimeSub = (double)aParams[10];
|
||||
int iTimeDiffLimit = (int)aParams[11];
|
||||
|
||||
var tokens = strLine.Split('\t');
|
||||
|
||||
@@ -484,28 +492,36 @@ namespace AutoSellerNS
|
||||
double dCheckCount = 5.0;
|
||||
List<int> m_PriceList = new List<int>();
|
||||
|
||||
//Sheet.Column(7).Style.Font.Color.SetColor(Color.Black);
|
||||
//Sheet.DeleteColumn(8, 11);
|
||||
Sheet.Column(7).Style.Font.Color.SetColor(Color.Black);
|
||||
Sheet.DeleteColumn(8, 11);
|
||||
|
||||
//Sheet.Cells[1, 8].Value = "평균";
|
||||
//Sheet.Cells[1, 9].Value = "표준편차";
|
||||
//Sheet.Cells[1, 10].Value = "매도 제한";
|
||||
//Sheet.Cells[1, 11].Value = "매도 수";
|
||||
//Sheet.View.FreezePanes(2, 1);
|
||||
Sheet.Cells[1, 8].Value = "평균";
|
||||
Sheet.Cells[1, 9].Value = "표준편차";
|
||||
Sheet.Cells[1, 10].Value = "매도 제한";
|
||||
Sheet.Cells[1, 11].Value = "매도 수";
|
||||
Sheet.View.FreezePanes(2, 1);
|
||||
|
||||
double dPrevStdDev = 0;
|
||||
string strReturnMsg = "";
|
||||
int iPrevTime = 0;
|
||||
|
||||
for(int iRow = 2; iRow<=iMaxRow; iRow++)
|
||||
{
|
||||
if((string)Sheet.Cells[iRow, 2].Value == "*")
|
||||
continue;
|
||||
|
||||
int iTime = (int)(double)Sheet.Cells[iRow, 1].Value;
|
||||
int iPrice = (int)(double)Sheet.Cells[iRow, 3].Value;
|
||||
int iAskPrice = (int)(double)Sheet.Cells[iRow, 4].Value;
|
||||
int iBidPrice = (int)(double)Sheet.Cells[iRow, 5].Value;
|
||||
|
||||
int iTimeDiff = 0;
|
||||
if(iPrevTime > 0)
|
||||
iTimeDiff = ((iTime/10000)*60*60 + ((iTime%10000)/100)*60 + (iTime%100)) - ((iPrevTime/10000)*60*60 + ((iPrevTime%10000)/100)*60 + (iPrevTime%100));
|
||||
|
||||
if((string)Sheet.Cells[iRow, 2].Value == "*")
|
||||
{
|
||||
iPrevTime = iTime;
|
||||
continue;
|
||||
}
|
||||
|
||||
DateTime.TryParse(strDate+" "+string.Format("{0}:{1}:{2}", iTime/10000, (iTime/100)%100, iTime%100), out RowDT);
|
||||
|
||||
iStockCount = 1000000/iStartPrice;
|
||||
@@ -520,6 +536,13 @@ namespace AutoSellerNS
|
||||
m_PriceList.Clear();
|
||||
m_PriceList.Add(iPrice);
|
||||
}
|
||||
else if((RowDT-StartDT).Minutes > 10)
|
||||
{
|
||||
InsertLog(string.Format("[{0}] [{1}] 매수 가격 찾기 실패\n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -530,53 +553,68 @@ namespace AutoSellerNS
|
||||
double dAverage = (float)m_PriceList.Average();
|
||||
double sumOfSquaresOfDifferences = m_PriceList.Select(val => Math.Pow((val-dAverage)/m_CybosHelper.GetUnitValue(val), 2)).Sum();
|
||||
double dStdDev = Math.Sqrt(sumOfSquaresOfDifferences / m_PriceList.Count);
|
||||
//if(dStdDev < dPrevStdDev)
|
||||
//{
|
||||
// dCheckCount -= dSlowDownCnt;
|
||||
//}
|
||||
//else
|
||||
if(dStdDev >= dFastSD)
|
||||
{
|
||||
if(bAverageCompare == true)
|
||||
switch(iCompareType)
|
||||
{
|
||||
case 1:
|
||||
if(iPrice >= dAverage)
|
||||
dCheckCount += dFastUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dFastDownCnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
dCheckCount -= dFastDownCnt;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(iPrice >= m_PriceList[m_PriceList.Count-2])
|
||||
dCheckCount += dFastUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
else
|
||||
dCheckCount -= dFastDownCnt;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(iPrice <= iBidPrice)
|
||||
dCheckCount -= dFastDownCnt;
|
||||
else
|
||||
dCheckCount += dFastUpCnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(dStdDev <= dSlowSD)
|
||||
{
|
||||
if(bAverageCompare == true)
|
||||
switch(iCompareType)
|
||||
{
|
||||
case 1:
|
||||
if(iPrice >= dAverage)
|
||||
dCheckCount += dSlowUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dSlowDownCnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
dCheckCount -= dSlowDownCnt;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(iPrice >= m_PriceList[m_PriceList.Count-2])
|
||||
dCheckCount += dSlowUpCnt;
|
||||
else// if(dCheckCount > 3)
|
||||
dCheckCount -= dSlowUpCnt;
|
||||
else
|
||||
dCheckCount -= dSlowDownCnt;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(iPrice <= iBidPrice)
|
||||
dCheckCount -= dSlowDownCnt;
|
||||
else
|
||||
dCheckCount += dSlowUpCnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dCheckCount -= iTimeDiff*dTimeSub;
|
||||
|
||||
//dCheckCount = Math.Min(Math.Max(dCheckCount, 0), 15);
|
||||
|
||||
//Sheet.Cells[iRow, 8].Value = dAverage;
|
||||
//Sheet.Cells[iRow, 9].Value = dStdDev;
|
||||
//Sheet.Cells[iRow, 9].Style.Numberformat.Format = "0.00";
|
||||
//Sheet.Cells[iRow, 10].Value = dCheckCount;
|
||||
Sheet.Cells[iRow, 8].Value = dAverage;
|
||||
Sheet.Cells[iRow, 9].Value = dStdDev;
|
||||
Sheet.Cells[iRow, 9].Style.Numberformat.Format = "0.00";
|
||||
Sheet.Cells[iRow, 10].Value = dCheckCount;
|
||||
|
||||
// 호가 비교 - 매수호가 기준
|
||||
if(iPrice <= iBidPrice)
|
||||
@@ -590,7 +628,7 @@ namespace AutoSellerNS
|
||||
Sheet.Cells[iRow, 7].Style.Font.Color.SetColor(Color.Red);
|
||||
}
|
||||
|
||||
//Sheet.Cells[iRow, 11].Value = iAskCount;
|
||||
Sheet.Cells[iRow, 11].Value = iAskCount;
|
||||
|
||||
if(iAskCount >= Math.Round(dCheckCount))
|
||||
{
|
||||
@@ -650,33 +688,32 @@ namespace AutoSellerNS
|
||||
break;
|
||||
}
|
||||
|
||||
//if(iPrice < iStartPrice)
|
||||
//{
|
||||
// iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
// strReturnMsg = string.Format("[{0}] 손절 매도 (매수: {1:n0}원, {2}, line:{3}) (매도: {4:n0}원(매도가:{5:n0}원) {6} line:{7}) (손익: {8}, {9:n0} : {10:n2}%) {11} \n",
|
||||
// strCodeName,
|
||||
if(iTimeDiff >= iTimeDiffLimit)
|
||||
{
|
||||
iSellPrice = iPrice - m_CybosHelper.GetUnitValue(iPrice);
|
||||
strReturnMsg = string.Format("[{0}] [{1}] 제한시간 매도 (매수: {2:n0}원, {3}, line:{4}) (매도: {5:n0}원(매도가:{6:n0}원) {7} line:{8}) (손익: {9}, {10:n0} : {11:n2}%) {12} \n",
|
||||
StartDT.ToString("yyyy-MM-dd"),
|
||||
strCodeName,
|
||||
|
||||
// iStartPrice,
|
||||
// StartDT.ToString("HH:mm:ss"),
|
||||
// iStartRow,
|
||||
iStartPrice,
|
||||
StartDT.ToString("HH:mm:ss"),
|
||||
iStartRow,
|
||||
|
||||
// iPrice,
|
||||
// iSellPrice,
|
||||
// RowDT.ToString("HH:mm:ss"),
|
||||
// iRow,
|
||||
iPrice,
|
||||
iSellPrice,
|
||||
RowDT.ToString("HH:mm:ss"),
|
||||
iRow,
|
||||
|
||||
// iSellPrice-iStartPrice,
|
||||
// (iSellPrice-iStartPrice)*iStockCount,
|
||||
// (iSellPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
iSellPrice-iStartPrice,
|
||||
(iSellPrice-iStartPrice)*iStockCount,
|
||||
(iSellPrice-iStartPrice)*100/(float)iStartPrice,
|
||||
|
||||
// dCheckCount
|
||||
dCheckCount
|
||||
|
||||
// );
|
||||
);
|
||||
|
||||
// iTotalProfit += (iSellPrice-iStartPrice)*iStockCount;
|
||||
// iTotalBid += iStartPrice*iStockCount;
|
||||
// break;
|
||||
//}
|
||||
break;
|
||||
}
|
||||
|
||||
dPrevStdDev = dStdDev;
|
||||
}
|
||||
@@ -709,12 +746,13 @@ namespace AutoSellerNS
|
||||
}
|
||||
|
||||
iPrevPrice = iPrice;
|
||||
iPrevTime = iTime;
|
||||
}
|
||||
|
||||
//Sheet.Cells.AutoFitColumns(0);
|
||||
//Sheet.Select(ExcelAddress.GetAddress(Math.Max(iStartRow, 1), 1), true);
|
||||
Sheet.Cells.AutoFitColumns(0);
|
||||
Sheet.Select(ExcelAddress.GetAddress(Math.Max(iStartRow, 1), 1), true);
|
||||
|
||||
//package.Save();
|
||||
package.Save();
|
||||
|
||||
return new object[] { strReturnMsg, (iSellPrice-iStartPrice)*iStockCount };
|
||||
}
|
||||
@@ -730,12 +768,16 @@ namespace AutoSellerNS
|
||||
double dSlowSD = (double)aParams[4];
|
||||
double dSlowUpCnt = (double)aParams[5];
|
||||
double dSlowDownCnt = (double)aParams[6];
|
||||
bool bAverageCompare = (bool)aParams[7];
|
||||
int iCompareType = (int)aParams[7];
|
||||
string strMethod = (string)aParams[8];
|
||||
double dTimeSub = (double)aParams[9];
|
||||
int iTimeDiffLimit = (int)aParams[10];
|
||||
|
||||
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 비교 방식 : {10}\n",
|
||||
InsertLog(string.Format("[시뮬레이션 시작] 조건 : {0}회, 트레일링 : {1}%, {2}회\n \t\t리스트 크기:{3}, Fast : {4}, {5}, {6}, Slow : {7}, {8}, {9}, 초당 {10} 감소, 제한 시간: {11} 비교 방식 : {12}\n",
|
||||
Config.GetBidCount(), Config.GetTrailingRate(), Config.GetTrailingCnt(),
|
||||
iListCnt, dFastSD, dFastUpCnt, dFastDownCnt, dSlowSD, dSlowUpCnt, dSlowDownCnt, strMethod
|
||||
iListCnt, dFastSD, dFastUpCnt, dFastDownCnt, dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
dTimeSub, iTimeDiffLimit,
|
||||
strMethod
|
||||
));
|
||||
|
||||
|
||||
@@ -748,8 +790,8 @@ namespace AutoSellerNS
|
||||
iListCnt,
|
||||
dFastSD, dFastUpCnt, dFastDownCnt,
|
||||
dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
bAverageCompare, strMethod,
|
||||
strLine }));
|
||||
iCompareType, strMethod,
|
||||
strLine, dTimeSub, iTimeDiffLimit }));
|
||||
|
||||
aTasks.Add(task);
|
||||
}
|
||||
@@ -776,6 +818,8 @@ namespace AutoSellerNS
|
||||
double dSlowSD;
|
||||
double dSlowUpCnt;
|
||||
double dSlowDownCnt;
|
||||
double dTimeSub;
|
||||
int iTimeDiffLimit;
|
||||
|
||||
int.TryParse(m_AutoSeller.tbSMListSize.Text, out iListCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMFastSD.Text, out dFastSD);
|
||||
@@ -784,17 +828,22 @@ namespace AutoSellerNS
|
||||
double.TryParse(m_AutoSeller.tbSMSlowSD.Text, out dSlowSD);
|
||||
double.TryParse(m_AutoSeller.tbSMSlowUpCnt.Text, out dSlowUpCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMSlowDownCnt.Text, out dSlowDownCnt);
|
||||
double.TryParse(m_AutoSeller.tbSMTimeSub.Text, out dTimeSub);
|
||||
int.TryParse(m_AutoSeller.tbSMTimeDiffLimit.Text, out iTimeDiffLimit);
|
||||
|
||||
string strMethod = "";
|
||||
m_AutoSeller.cbSMMethod.Invoke(new Action(() => {
|
||||
strMethod = (string)m_AutoSeller.cbSMMethod.SelectedItem;
|
||||
}));
|
||||
|
||||
bool bAverageCompare;
|
||||
int iCompareType;
|
||||
if(strMethod == "평균 비교")
|
||||
bAverageCompare = true;
|
||||
iCompareType = 1;
|
||||
else if(strMethod == "마지막 비교")
|
||||
iCompareType = 2;
|
||||
else
|
||||
bAverageCompare = false;
|
||||
iCompareType = 3;
|
||||
|
||||
|
||||
Task.Factory.StartNew(() => {
|
||||
// for(double dFastSD = 0.75; dFastSD<=0.75; dFastSD+=0.05)
|
||||
@@ -807,9 +856,9 @@ namespace AutoSellerNS
|
||||
// {
|
||||
Simulation(new object[] {
|
||||
iListCnt,
|
||||
dFastSD, dFastUpCnt, dFastUpCnt,
|
||||
dSlowSD, dSlowUpCnt, dSlowUpCnt,
|
||||
bAverageCompare, strMethod
|
||||
dFastSD, dFastUpCnt, dFastDownCnt,
|
||||
dSlowSD, dSlowUpCnt, dSlowDownCnt,
|
||||
iCompareType, strMethod, dTimeSub, iTimeDiffLimit
|
||||
});
|
||||
// }
|
||||
// }
|
||||
|
||||
2
Util.cs
2
Util.cs
@@ -25,6 +25,7 @@ namespace AutoSellerNS
|
||||
|
||||
delegate void InsertLogDelegate(RichTextBox LogBox, LOG_TYPE enType, string strLog);
|
||||
static InsertLogDelegate m_InsertLogDelegate = new InsertLogDelegate(InsertLog);
|
||||
static object m_LogLock = new object();
|
||||
|
||||
public static void SetLogView(RichTextBox logBox)
|
||||
{
|
||||
@@ -95,6 +96,7 @@ namespace AutoSellerNS
|
||||
string strTime = DateTime.Now.ToString("[HH:mm:ss:fff] ");
|
||||
string strMessage = strTime+strLogLevel+strLog;
|
||||
|
||||
lock(m_LogLock)
|
||||
File.AppendAllText(m_strLogFile, strMessage+Environment.NewLine, new UTF8Encoding(true));
|
||||
if(m_LogBox != null)
|
||||
InsertLog(m_LogBox, enType, strMessage+Environment.NewLine);
|
||||
|
||||
Reference in New Issue
Block a user