1분 candle chart, 5MA 추가

This commit is contained in:
2016-07-25 03:11:55 +09:00
parent 7c63795f12
commit 604795159e
9 changed files with 955 additions and 410 deletions

769
MainForm.Designer.cs generated
View File

@@ -28,335 +28,441 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.tbLog = new System.Windows.Forms.TextBox(); this.tbLog = new System.Windows.Forms.TextBox();
this.tbSearchMax = new System.Windows.Forms.TextBox(); this.tbSearchMax = new System.Windows.Forms.TextBox();
this.tbBidMin = new System.Windows.Forms.TextBox(); this.tbBidMin = new System.Windows.Forms.TextBox();
this.tbBidAmount = new System.Windows.Forms.TextBox(); this.tbBidAmount = new System.Windows.Forms.TextBox();
this.tbTimeout = new System.Windows.Forms.TextBox(); this.tbTimeout = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.tbTrailing = new System.Windows.Forms.TextBox(); this.tbTrailing = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.tbLossCut = new System.Windows.Forms.TextBox(); this.tbLossCut = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.tbSearchMin = new System.Windows.Forms.TextBox(); this.tbSearchMin = new System.Windows.Forms.TextBox();
this.btApply = new System.Windows.Forms.Button(); this.btApply = new System.Windows.Forms.Button();
this.btCancel = new System.Windows.Forms.Button(); this.btCancel = new System.Windows.Forms.Button();
this.tbBidMax = new System.Windows.Forms.TextBox(); this.tbBidMax = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.btBalance = new System.Windows.Forms.Button(); this.btBalance = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.lbSBCnt = new System.Windows.Forms.Label(); this.btTimeSync = new System.Windows.Forms.Button();
this.lbRQCnt = new System.Windows.Forms.Label(); this.cbStart = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.btCybosPlus = new System.Windows.Forms.Button();
this.splitContainer1.Panel1.SuspendLayout(); this.btCybos5 = new System.Windows.Forms.Button();
this.splitContainer1.Panel2.SuspendLayout(); this.lbSBCnt = new System.Windows.Forms.Label();
this.splitContainer1.SuspendLayout(); this.lbRQCnt = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.statusBar1 = new System.Windows.Forms.StatusBar();
this.splitContainer2.Panel1.SuspendLayout(); this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.splitContainer2.Panel2.SuspendLayout(); this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.splitContainer2.SuspendLayout(); this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.btMATest = new System.Windows.Forms.Button();
this.splitContainer3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
// this.splitContainer1.Panel2.SuspendLayout();
// tbLog this.splitContainer1.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.tbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
this.SuspendLayout();
//
// tbLog
//
this.tbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tbLog.BackColor = System.Drawing.SystemColors.Control; this.tbLog.BackColor = System.Drawing.SystemColors.Control;
this.tbLog.HideSelection = false; this.tbLog.HideSelection = false;
this.tbLog.Location = new System.Drawing.Point(12, 3); this.tbLog.Location = new System.Drawing.Point(12, 3);
this.tbLog.Multiline = true; this.tbLog.Multiline = true;
this.tbLog.Name = "tbLog"; this.tbLog.Name = "tbLog";
this.tbLog.ReadOnly = true; this.tbLog.ReadOnly = true;
this.tbLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.tbLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tbLog.Size = new System.Drawing.Size(862, 73); this.tbLog.Size = new System.Drawing.Size(862, 84);
this.tbLog.TabIndex = 2; this.tbLog.TabIndex = 2;
// //
// tbSearchMax // tbSearchMax
// //
this.tbSearchMax.Location = new System.Drawing.Point(160, 23); this.tbSearchMax.Location = new System.Drawing.Point(160, 23);
this.tbSearchMax.Name = "tbSearchMax"; this.tbSearchMax.Name = "tbSearchMax";
this.tbSearchMax.Size = new System.Drawing.Size(37, 21); this.tbSearchMax.Size = new System.Drawing.Size(37, 21);
this.tbSearchMax.TabIndex = 6; this.tbSearchMax.TabIndex = 6;
this.tbSearchMax.Text = "10.5%"; this.tbSearchMax.Text = "10.5%";
this.tbSearchMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbSearchMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// tbBidMin // tbBidMin
// //
this.tbBidMin.Location = new System.Drawing.Point(97, 50); this.tbBidMin.Location = new System.Drawing.Point(97, 50);
this.tbBidMin.Name = "tbBidMin"; this.tbBidMin.Name = "tbBidMin";
this.tbBidMin.Size = new System.Drawing.Size(37, 21); this.tbBidMin.Size = new System.Drawing.Size(37, 21);
this.tbBidMin.TabIndex = 8; this.tbBidMin.TabIndex = 8;
this.tbBidMin.Text = "9.0%"; this.tbBidMin.Text = "9.0%";
this.tbBidMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbBidMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// tbBidAmount // tbBidAmount
// //
this.tbBidAmount.Location = new System.Drawing.Point(97, 77); this.tbBidAmount.Location = new System.Drawing.Point(97, 77);
this.tbBidAmount.Name = "tbBidAmount"; this.tbBidAmount.Name = "tbBidAmount";
this.tbBidAmount.Size = new System.Drawing.Size(100, 21); this.tbBidAmount.Size = new System.Drawing.Size(100, 21);
this.tbBidAmount.TabIndex = 9; this.tbBidAmount.TabIndex = 9;
this.tbBidAmount.Text = "100,000"; this.tbBidAmount.Text = "100,000";
this.tbBidAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbBidAmount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// tbTimeout // tbTimeout
// //
this.tbTimeout.Location = new System.Drawing.Point(97, 104); this.tbTimeout.Location = new System.Drawing.Point(97, 104);
this.tbTimeout.Name = "tbTimeout"; this.tbTimeout.Name = "tbTimeout";
this.tbTimeout.Size = new System.Drawing.Size(100, 21); this.tbTimeout.Size = new System.Drawing.Size(100, 21);
this.tbTimeout.TabIndex = 10; this.tbTimeout.TabIndex = 10;
this.tbTimeout.Text = "120"; this.tbTimeout.Text = "120";
this.tbTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(38, 26); this.label1.Location = new System.Drawing.Point(38, 26);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12); this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 11; this.label1.TabIndex = 11;
this.label1.Text = "검색범위"; this.label1.Text = "검색범위";
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(38, 53); this.label2.Location = new System.Drawing.Point(38, 53);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12); this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 12; this.label2.TabIndex = 12;
this.label2.Text = "매수범위"; this.label2.Text = "매수범위";
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(38, 80); this.label3.Location = new System.Drawing.Point(38, 80);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 12); this.label3.Size = new System.Drawing.Size(41, 12);
this.label3.TabIndex = 13; this.label3.TabIndex = 13;
this.label3.Text = "매수금"; this.label3.Text = "매수금";
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(38, 107); this.label4.Location = new System.Drawing.Point(38, 107);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 12); this.label4.Size = new System.Drawing.Size(53, 12);
this.label4.TabIndex = 13; this.label4.TabIndex = 13;
this.label4.Text = "타임아웃"; this.label4.Text = "타임아웃";
// //
// tbTrailing // tbTrailing
// //
this.tbTrailing.Location = new System.Drawing.Point(97, 131); this.tbTrailing.Location = new System.Drawing.Point(97, 131);
this.tbTrailing.Name = "tbTrailing"; this.tbTrailing.Name = "tbTrailing";
this.tbTrailing.Size = new System.Drawing.Size(100, 21); this.tbTrailing.Size = new System.Drawing.Size(100, 21);
this.tbTrailing.TabIndex = 10; this.tbTrailing.TabIndex = 10;
this.tbTrailing.Text = "3.0%"; this.tbTrailing.Text = "3.0%";
this.tbTrailing.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbTrailing.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(38, 134); this.label5.Location = new System.Drawing.Point(38, 134);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 12); this.label5.Size = new System.Drawing.Size(53, 12);
this.label5.TabIndex = 13; this.label5.TabIndex = 13;
this.label5.Text = "트레일링"; this.label5.Text = "트레일링";
// //
// tbLossCut // tbLossCut
// //
this.tbLossCut.Location = new System.Drawing.Point(97, 158); this.tbLossCut.Location = new System.Drawing.Point(97, 158);
this.tbLossCut.Name = "tbLossCut"; this.tbLossCut.Name = "tbLossCut";
this.tbLossCut.Size = new System.Drawing.Size(100, 21); this.tbLossCut.Size = new System.Drawing.Size(100, 21);
this.tbLossCut.TabIndex = 10; this.tbLossCut.TabIndex = 10;
this.tbLossCut.Text = "3.0%"; this.tbLossCut.Text = "3.0%";
this.tbLossCut.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbLossCut.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(38, 161); this.label6.Location = new System.Drawing.Point(38, 161);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(29, 12); this.label6.Size = new System.Drawing.Size(29, 12);
this.label6.TabIndex = 13; this.label6.TabIndex = 13;
this.label6.Text = "손절"; this.label6.Text = "손절";
// //
// label7 // label7
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(140, 26); this.label7.Location = new System.Drawing.Point(140, 26);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(14, 12); this.label7.Size = new System.Drawing.Size(14, 12);
this.label7.TabIndex = 11; this.label7.TabIndex = 11;
this.label7.Text = "~"; this.label7.Text = "~";
// //
// tbSearchMin // tbSearchMin
// //
this.tbSearchMin.Location = new System.Drawing.Point(97, 23); this.tbSearchMin.Location = new System.Drawing.Point(97, 23);
this.tbSearchMin.Name = "tbSearchMin"; this.tbSearchMin.Name = "tbSearchMin";
this.tbSearchMin.Size = new System.Drawing.Size(37, 21); this.tbSearchMin.Size = new System.Drawing.Size(37, 21);
this.tbSearchMin.TabIndex = 14; this.tbSearchMin.TabIndex = 14;
this.tbSearchMin.Text = "7.0%"; this.tbSearchMin.Text = "7.0%";
this.tbSearchMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbSearchMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// btApply // btApply
// //
this.btApply.Location = new System.Drawing.Point(97, 185); this.btApply.Location = new System.Drawing.Point(97, 185);
this.btApply.Name = "btApply"; this.btApply.Name = "btApply";
this.btApply.Size = new System.Drawing.Size(44, 23); this.btApply.Size = new System.Drawing.Size(44, 23);
this.btApply.TabIndex = 15; this.btApply.TabIndex = 15;
this.btApply.Text = "적용"; this.btApply.Text = "적용";
this.btApply.UseVisualStyleBackColor = true; this.btApply.UseVisualStyleBackColor = true;
this.btApply.Click += new System.EventHandler(this.btApply_Click); this.btApply.Click += new System.EventHandler(this.btApply_Click);
// //
// btCancel // btCancel
// //
this.btCancel.Location = new System.Drawing.Point(153, 185); this.btCancel.Location = new System.Drawing.Point(153, 185);
this.btCancel.Name = "btCancel"; this.btCancel.Name = "btCancel";
this.btCancel.Size = new System.Drawing.Size(44, 23); this.btCancel.Size = new System.Drawing.Size(44, 23);
this.btCancel.TabIndex = 16; this.btCancel.TabIndex = 16;
this.btCancel.Text = "취소"; this.btCancel.Text = "취소";
this.btCancel.UseVisualStyleBackColor = true; this.btCancel.UseVisualStyleBackColor = true;
this.btCancel.Click += new System.EventHandler(this.btCancel_Click); this.btCancel.Click += new System.EventHandler(this.btCancel_Click);
// //
// tbBidMax // tbBidMax
// //
this.tbBidMax.Location = new System.Drawing.Point(160, 50); this.tbBidMax.Location = new System.Drawing.Point(160, 50);
this.tbBidMax.Name = "tbBidMax"; this.tbBidMax.Name = "tbBidMax";
this.tbBidMax.Size = new System.Drawing.Size(37, 21); this.tbBidMax.Size = new System.Drawing.Size(37, 21);
this.tbBidMax.TabIndex = 8; this.tbBidMax.TabIndex = 8;
this.tbBidMax.Text = "10.0%"; this.tbBidMax.Text = "10.0%";
this.tbBidMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.tbBidMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// label8 // label8
// //
this.label8.AutoSize = true; this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(140, 53); this.label8.Location = new System.Drawing.Point(140, 53);
this.label8.Name = "label8"; this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(14, 12); this.label8.Size = new System.Drawing.Size(14, 12);
this.label8.TabIndex = 11; this.label8.TabIndex = 11;
this.label8.Text = "~"; this.label8.Text = "~";
// //
// btBalance // btBalance
// //
this.btBalance.Location = new System.Drawing.Point(122, 214); this.btBalance.Location = new System.Drawing.Point(122, 214);
this.btBalance.Name = "btBalance"; this.btBalance.Name = "btBalance";
this.btBalance.Size = new System.Drawing.Size(75, 23); this.btBalance.Size = new System.Drawing.Size(75, 23);
this.btBalance.TabIndex = 17; this.btBalance.TabIndex = 17;
this.btBalance.Text = "잔고"; this.btBalance.Text = "잔고";
this.btBalance.UseVisualStyleBackColor = true; this.btBalance.UseVisualStyleBackColor = true;
// //
// splitContainer1 // splitContainer1
// //
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; //
// // splitContainer1.Panel1
// splitContainer1.Panel1 //
// this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); //
// // 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(886, 714);
this.splitContainer1.Size = new System.Drawing.Size(886, 642); this.splitContainer1.SplitterDistance = 611;
this.splitContainer1.SplitterDistance = 550; this.splitContainer1.TabIndex = 20;
this.splitContainer1.TabIndex = 20; //
// // splitContainer2
// splitContainer2 //
// this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Location = new System.Drawing.Point(0, 0); this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Name = "splitContainer2"; //
// // splitContainer2.Panel1
// splitContainer2.Panel1 //
// this.splitContainer2.Panel1.Controls.Add(this.splitContainer3);
this.splitContainer2.Panel1.Controls.Add(this.splitContainer3); //
// // splitContainer2.Panel2
// splitContainer2.Panel2 //
// this.splitContainer2.Panel2.Controls.Add(this.btMATest);
this.splitContainer2.Panel2.Controls.Add(this.lbSBCnt); this.splitContainer2.Panel2.Controls.Add(this.button1);
this.splitContainer2.Panel2.Controls.Add(this.lbRQCnt); this.splitContainer2.Panel2.Controls.Add(this.btTimeSync);
this.splitContainer2.Panel2.Controls.Add(this.btBalance); this.splitContainer2.Panel2.Controls.Add(this.cbStart);
this.splitContainer2.Panel2.Controls.Add(this.label1); this.splitContainer2.Panel2.Controls.Add(this.btCybosPlus);
this.splitContainer2.Panel2.Controls.Add(this.label5); this.splitContainer2.Panel2.Controls.Add(this.btCybos5);
this.splitContainer2.Panel2.Controls.Add(this.tbTimeout); this.splitContainer2.Panel2.Controls.Add(this.lbSBCnt);
this.splitContainer2.Panel2.Controls.Add(this.tbSearchMax); this.splitContainer2.Panel2.Controls.Add(this.lbRQCnt);
this.splitContainer2.Panel2.Controls.Add(this.label7); this.splitContainer2.Panel2.Controls.Add(this.btBalance);
this.splitContainer2.Panel2.Controls.Add(this.btCancel); this.splitContainer2.Panel2.Controls.Add(this.label1);
this.splitContainer2.Panel2.Controls.Add(this.label6); this.splitContainer2.Panel2.Controls.Add(this.label5);
this.splitContainer2.Panel2.Controls.Add(this.label2); this.splitContainer2.Panel2.Controls.Add(this.tbTimeout);
this.splitContainer2.Panel2.Controls.Add(this.label4); this.splitContainer2.Panel2.Controls.Add(this.tbSearchMax);
this.splitContainer2.Panel2.Controls.Add(this.tbBidMin); this.splitContainer2.Panel2.Controls.Add(this.label7);
this.splitContainer2.Panel2.Controls.Add(this.tbBidAmount); this.splitContainer2.Panel2.Controls.Add(this.btCancel);
this.splitContainer2.Panel2.Controls.Add(this.tbLossCut); this.splitContainer2.Panel2.Controls.Add(this.label6);
this.splitContainer2.Panel2.Controls.Add(this.label8); this.splitContainer2.Panel2.Controls.Add(this.label2);
this.splitContainer2.Panel2.Controls.Add(this.btApply); this.splitContainer2.Panel2.Controls.Add(this.label4);
this.splitContainer2.Panel2.Controls.Add(this.tbSearchMin); this.splitContainer2.Panel2.Controls.Add(this.tbBidMin);
this.splitContainer2.Panel2.Controls.Add(this.tbTrailing); this.splitContainer2.Panel2.Controls.Add(this.tbBidAmount);
this.splitContainer2.Panel2.Controls.Add(this.label3); this.splitContainer2.Panel2.Controls.Add(this.tbLossCut);
this.splitContainer2.Panel2.Controls.Add(this.tbBidMax); this.splitContainer2.Panel2.Controls.Add(this.label8);
this.splitContainer2.Size = new System.Drawing.Size(886, 550); this.splitContainer2.Panel2.Controls.Add(this.btApply);
this.splitContainer2.SplitterDistance = 645; this.splitContainer2.Panel2.Controls.Add(this.tbSearchMin);
this.splitContainer2.TabIndex = 0; this.splitContainer2.Panel2.Controls.Add(this.tbTrailing);
// this.splitContainer2.Panel2.Controls.Add(this.label3);
// splitContainer3 this.splitContainer2.Panel2.Controls.Add(this.tbBidMax);
// this.splitContainer2.Size = new System.Drawing.Size(886, 611);
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.SplitterDistance = 645;
this.splitContainer3.Location = new System.Drawing.Point(0, 0); this.splitContainer2.TabIndex = 0;
this.splitContainer3.Name = "splitContainer3"; //
this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; // splitContainer3
this.splitContainer3.Size = new System.Drawing.Size(645, 550); //
this.splitContainer3.SplitterDistance = 231; this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer3.TabIndex = 0; this.splitContainer3.Location = new System.Drawing.Point(0, 0);
// this.splitContainer3.Name = "splitContainer3";
// lbSBCnt this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
// this.splitContainer3.Size = new System.Drawing.Size(645, 611);
this.lbSBCnt.AutoSize = true; this.splitContainer3.SplitterDistance = 256;
this.lbSBCnt.Location = new System.Drawing.Point(29, 278); this.splitContainer3.TabIndex = 0;
this.lbSBCnt.Name = "lbSBCnt"; //
this.lbSBCnt.Size = new System.Drawing.Size(70, 12); // btTimeSync
this.lbSBCnt.TabIndex = 19; //
this.lbSBCnt.Text = "SB Count : "; this.btTimeSync.Location = new System.Drawing.Point(16, 341);
// this.btTimeSync.Name = "btTimeSync";
// lbRQCnt this.btTimeSync.Size = new System.Drawing.Size(84, 57);
// this.btTimeSync.TabIndex = 22;
this.lbRQCnt.AutoSize = true; this.btTimeSync.Text = "Time Sync";
this.lbRQCnt.Location = new System.Drawing.Point(29, 254); this.btTimeSync.UseVisualStyleBackColor = true;
this.lbRQCnt.Name = "lbRQCnt"; this.btTimeSync.Click += new System.EventHandler(this.btTimeSync_Click);
this.lbRQCnt.Size = new System.Drawing.Size(71, 12); //
this.lbRQCnt.TabIndex = 18; // cbStart
this.lbRQCnt.Text = "RQ Count : "; //
// this.cbStart.Appearance = System.Windows.Forms.Appearance.Button;
// MainForm this.cbStart.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter;
// this.cbStart.Location = new System.Drawing.Point(16, 404);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.cbStart.Name = "cbStart";
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.cbStart.Size = new System.Drawing.Size(84, 57);
this.ClientSize = new System.Drawing.Size(886, 642); this.cbStart.TabIndex = 21;
this.Controls.Add(this.splitContainer1); this.cbStart.Text = "Start";
this.Name = "MainForm"; this.cbStart.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.Text = "Upper Limit"; this.cbStart.UseVisualStyleBackColor = true;
this.splitContainer1.Panel1.ResumeLayout(false); this.cbStart.CheckedChanged += new System.EventHandler(this.cbStart_CheckedChanged);
this.splitContainer1.Panel2.ResumeLayout(false); //
this.splitContainer1.Panel2.PerformLayout(); // btCybosPlus
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); //
this.splitContainer1.ResumeLayout(false); this.btCybosPlus.Location = new System.Drawing.Point(113, 467);
this.splitContainer2.Panel1.ResumeLayout(false); this.btCybosPlus.Name = "btCybosPlus";
this.splitContainer2.Panel2.ResumeLayout(false); this.btCybosPlus.Size = new System.Drawing.Size(84, 67);
this.splitContainer2.Panel2.PerformLayout(); this.btCybosPlus.TabIndex = 20;
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.btCybosPlus.Text = "Cybos Plus";
this.splitContainer2.ResumeLayout(false); this.btCybosPlus.UseVisualStyleBackColor = true;
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); this.btCybosPlus.Click += new System.EventHandler(this.btCybosPlus_Click);
this.splitContainer3.ResumeLayout(false); //
this.ResumeLayout(false); // btCybos5
//
this.btCybos5.Location = new System.Drawing.Point(16, 467);
this.btCybos5.Name = "btCybos5";
this.btCybos5.Size = new System.Drawing.Size(84, 67);
this.btCybos5.TabIndex = 20;
this.btCybos5.Text = "Cybos 5";
this.btCybos5.UseVisualStyleBackColor = true;
this.btCybos5.Click += new System.EventHandler(this.btCybos5_Click);
//
// lbSBCnt
//
this.lbSBCnt.AutoSize = true;
this.lbSBCnt.Location = new System.Drawing.Point(29, 278);
this.lbSBCnt.Name = "lbSBCnt";
this.lbSBCnt.Size = new System.Drawing.Size(70, 12);
this.lbSBCnt.TabIndex = 19;
this.lbSBCnt.Text = "SB Count : ";
//
// lbRQCnt
//
this.lbRQCnt.AutoSize = true;
this.lbRQCnt.Location = new System.Drawing.Point(29, 254);
this.lbRQCnt.Name = "lbRQCnt";
this.lbRQCnt.Size = new System.Drawing.Size(71, 12);
this.lbRQCnt.TabIndex = 18;
this.lbRQCnt.Text = "RQ Count : ";
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 720);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(886, 22);
this.statusBar1.TabIndex = 21;
this.statusBar1.Text = "statusBar1";
//
// statusBarPanel1
//
this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel1.Name = "statusBarPanel1";
this.statusBarPanel1.Width = 749;
//
// statusBarPanel2
//
this.statusBarPanel2.MinWidth = 120;
this.statusBarPanel2.Name = "statusBarPanel2";
this.statusBarPanel2.Width = 120;
//
// button1
//
this.button1.Location = new System.Drawing.Point(142, 371);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 23;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// btMATest
//
this.btMATest.Location = new System.Drawing.Point(138, 430);
this.btMATest.Name = "btMATest";
this.btMATest.Size = new System.Drawing.Size(75, 23);
this.btMATest.TabIndex = 24;
this.btMATest.Text = "ma test";
this.btMATest.UseVisualStyleBackColor = true;
this.btMATest.Click += new System.EventHandler(this.btMATest_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(886, 742);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.splitContainer1);
this.Name = "MainForm";
this.Text = "Upper Limit";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
this.ResumeLayout(false);
} }
@@ -386,6 +492,15 @@
private System.Windows.Forms.SplitContainer splitContainer3; private System.Windows.Forms.SplitContainer splitContainer3;
private System.Windows.Forms.Label lbRQCnt; private System.Windows.Forms.Label lbRQCnt;
private System.Windows.Forms.Label lbSBCnt; private System.Windows.Forms.Label lbSBCnt;
private System.Windows.Forms.Button btCybosPlus;
private System.Windows.Forms.Button btCybos5;
private System.Windows.Forms.CheckBox cbStart;
private System.Windows.Forms.Button btTimeSync;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btMATest;
} }
} }

View File

@@ -2,6 +2,7 @@
using System.Windows.Forms; using System.Windows.Forms;
using System.Collections; using System.Collections;
using System.Reflection; using System.Reflection;
using System.Diagnostics;
namespace upper_limit_crawler namespace upper_limit_crawler
{ {
@@ -37,7 +38,6 @@ namespace upper_limit_crawler
SetDoubleBuffered(tbLog); SetDoubleBuffered(tbLog);
UlUtil.Init(tbLog); UlUtil.Init(tbLog);
//UlUtil.GetServerTime();
btApply_Click(null, null); btApply_Click(null, null);
@@ -96,6 +96,12 @@ namespace upper_limit_crawler
return; return;
} }
if(cbStart.Checked == true && UlUtil.IsConnected() == false)
{
cbStart.Checked = false;
return;
}
int iDeltaT = iCurTime - m_iLastTime; int iDeltaT = iCurTime - m_iLastTime;
m_Own.Refresh(iCurTime); m_Own.Refresh(iCurTime);
@@ -103,10 +109,49 @@ namespace upper_limit_crawler
lbRQCnt.Text = "RQ Count : " + UlUtil.GetLimitRemainCountRQ().ToString(); lbRQCnt.Text = "RQ Count : " + UlUtil.GetLimitRemainCountRQ().ToString();
lbSBCnt.Text = "SB Count : " + UlUtil.GetLimitRemainCountSB().ToString(); lbSBCnt.Text = "SB Count : " + UlUtil.GetLimitRemainCountSB().ToString();
statusBar1.Panels[1].Text = UlUtil.GetCurTimeString() + " ";
m_iLastTime = iCurTime; m_iLastTime = iCurTime;
} }
private void AddTrace(string strCode) void StartAll()
{
m_MonitorDlg.Start();
m_BalanceDlg.Start();
m_DataMgr.StartAll();
}
void StopAll()
{
m_MonitorDlg.Stop();
m_BalanceDlg.Stop();
m_DataMgr.StopAll();
}
private void cbStart_CheckedChanged(object sender, EventArgs e)
{
if (cbStart.Checked == true)
{
if (UlUtil.IsConnected() == false)
UlUtil.Reset();
if (UlUtil.IsConnected() == false)
{
cbStart.Checked = false;
MessageBox.Show("Cybos Plus를 실행해주세요");
return;
}
m_DataMgr.Init();
StartAll();
}
else
{
StopAll();
}
}
private void AddTrace(string strCode)
{ {
if (m_TraceList.Contains(strCode) == true) if (m_TraceList.Contains(strCode) == true)
return; return;
@@ -146,5 +191,104 @@ namespace upper_limit_crawler
tbTrailing.Text = (m_DataMgr.m_Setting.m_fTrailing*100).ToString("0.0") + "%"; tbTrailing.Text = (m_DataMgr.m_Setting.m_fTrailing*100).ToString("0.0") + "%";
tbLossCut.Text = (m_DataMgr.m_Setting.m_fLossCut*100).ToString("0.0") + "%"; tbLossCut.Text = (m_DataMgr.m_Setting.m_fLossCut*100).ToString("0.0") + "%";
} }
}
private void btCybos5_Click(object sender, EventArgs e)
{
string strappname = @"C:\DAISHIN\STARTER\ncStarter.exe";
Process.Start(strappname);
}
private void btCybosPlus_Click(object sender, EventArgs e)
{
string strappname = @"C:\DAISHIN\STARTER\ncStarter.exe";
Process.Start(strappname, @"/prj:cp");
}
private void btTimeSync_Click(object sender, EventArgs e)
{
UlUtil.SyncServerTime();
}
DSCBO1Lib.StockCur cur = new DSCBO1Lib.StockCur();
DSCBO1Lib.StockOutCur outCur = new DSCBO1Lib.StockOutCur();
string strCheckCode = "A004565";
private void button1_Click(object sender, EventArgs e)
{
{
DSCBO1Lib.StockMst mst = new DSCBO1Lib.StockMst();
mst.SetInputValue(0, strCheckCode);
mst.BlockRequest();
short time = mst.GetHeaderValue(4);
Console.WriteLine("StockMst : {0}", time);
}
{
DSCBO1Lib.StockMst2 mst2 = new DSCBO1Lib.StockMst2();
mst2.SetInputValue(0, strCheckCode);
mst2.BlockRequest();
long time = mst2.GetDataValue(2, 0);
Console.WriteLine("StockMst2 : {0}", time);
}
{
cur.SetInputValue(0, strCheckCode);
cur.Received += Cur_Received;
cur.SubscribeLatest();
}
{
outCur.SetInputValue(0, strCheckCode);
outCur.Received += OutCur_Received;
outCur.SubscribeLatest();
}
}
private void OutCur_Received()
{
long time = outCur.GetHeaderValue(1);
Console.WriteLine("StockOutCur : {0}", time);
}
private void Cur_Received()
{
long time = cur.GetHeaderValue(3);
long time2 = cur.GetHeaderValue(18);
Console.WriteLine("StockCur : {0} / {1}", time, time2);
}
private void btMATest_Click(object sender, EventArgs e)
{
CPSYSDIBLib.StockChart stockChart = new CPSYSDIBLib.StockChart();
stockChart.SetInputValue(0, "A043580");
stockChart.SetInputValue(1, '1');
stockChart.SetInputValue(2, "20160722");
stockChart.SetInputValue(3, "20160722");
stockChart.SetInputValue(5, new int[] { 0, 1, 2, 3, 4, 5, 6, 10 });
stockChart.SetInputValue(6, 'm');
stockChart.BlockRequest2(1);
int iCnt = (int)stockChart.GetHeaderValue(3);
int iFieldCnt = stockChart.GetHeaderValue(1);
string[] astrFieldName = stockChart.GetHeaderValue(2);
ULWatchItem item = new ULWatchItem();
for (int i=iCnt-1; i>=0; i--)
{
int iTime = (int)stockChart.GetDataValue(1, i);
int iPrice = (int)stockChart.GetDataValue(5, i);
int iVolume = (int)stockChart.GetDataValue(5, i);
iTime *= 100;
item.m_iCurPrice = iPrice;
item.InsertPriceNode(iTime, iPrice);
}
//item.MakeChart();
//item.MakeMAChart();
item.PrintChart();
}
}
} }

View File

@@ -37,7 +37,6 @@ namespace upper_limit_crawler
List<OWN_ITEM> m_OwnList = new List<OWN_ITEM>(); List<OWN_ITEM> m_OwnList = new List<OWN_ITEM>();
DSCBO1Lib.StockMst2 m_StockMst2 = new DSCBO1Lib.StockMst2();
Timer m_MainTimer = new Timer(); Timer m_MainTimer = new Timer();
int m_iLastTime = 0; int m_iLastTime = 0;
@@ -45,8 +44,7 @@ namespace upper_limit_crawler
ULDataMgr m_DataMgr = null; ULDataMgr m_DataMgr = null;
CPTRADELib.CpTd6033 m_Td6033 = new CPTRADELib.CpTd6033(); CPTRADELib.CpTd6033 m_Td6033 = null;
DSCBO1Lib.StockCur m_StockCur = new DSCBO1Lib.StockCur();
public ULBalanceDlg(ULDataMgr DataMgr) public ULBalanceDlg(ULDataMgr DataMgr)
{ {
@@ -61,18 +59,28 @@ namespace upper_limit_crawler
MainForm.SetDoubleBuffered(lvBalance); MainForm.SetDoubleBuffered(lvBalance);
btSell.Enabled = false; btSell.Enabled = false;
RefreshBalance();
m_MainTimer.Interval=15; m_MainTimer.Interval=15;
m_MainTimer.Tick+=RefreshData; m_MainTimer.Tick+=RefreshData;
m_MainTimer.Start();
} }
public void Start()
{
m_Td6033 = new CPTRADELib.CpTd6033();
RefreshBalance();
m_MainTimer.Start();
}
public void Stop()
{
m_MainTimer.Stop();
}
private void RefreshBalance() private void RefreshBalance()
{ {
m_Td6033.SetInputValue(0, m_DataMgr.GetAccount()); m_Td6033.SetInputValue(0, m_DataMgr.GetAccount());
m_Td6033.SetInputValue(2, 50); m_Td6033.SetInputValue(2, 50);
m_Td6033.BlockRequest2(1); m_Td6033.BlockRequest2(1);
lvBalance.Items.Clear(); lvBalance.Items.Clear();
@@ -147,13 +155,13 @@ namespace upper_limit_crawler
private void RefreshCurPrice() private void RefreshCurPrice()
{ {
Dictionary<string, WATCH_ITEM> WatchList = m_DataMgr.GetWatchList(); Dictionary<string, ULWatchItem> WatchList = m_DataMgr.GetWatchList();
foreach (ListViewItem lvItem in lvBalance.Items) foreach (ListViewItem lvItem in lvBalance.Items)
{ {
string strCode = lvItem.SubItems[chCode.Index].Text; string strCode = lvItem.SubItems[chCode.Index].Text;
if (WatchList.ContainsKey(strCode) == true) if (WatchList.ContainsKey(strCode) == true)
{ {
WATCH_ITEM WatchItem = WatchList[strCode]; ULWatchItem WatchItem = WatchList[strCode];
OWN_ITEM OwnItem = m_OwnList.Find(itemFind => itemFind.m_strCode == strCode); OWN_ITEM OwnItem = m_OwnList.Find(itemFind => itemFind.m_strCode == strCode);
if (OwnItem == null) if (OwnItem == null)
continue; continue;
@@ -192,7 +200,7 @@ namespace upper_limit_crawler
// loss cut // loss cut
if (iCurPrice <= OwnItem.m_iUnitBEP * (1.0f - m_DataMgr.m_Setting.m_fLossCut)) if (iCurPrice <= OwnItem.m_iUnitBEP * (1.0f - m_DataMgr.m_Setting.m_fLossCut))
{ {
UlUtil.Trace(string.Format("[{0}] 손절 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice/OwnItem.m_iUnitBEP-1.0f).ToString("0.00%"))); UlUtil.Trace(string.Format("[{0}] 손절 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice/(float)OwnItem.m_iUnitBEP-1.0f).ToString("0.00%")));
m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance); m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
m_OwnList.Remove(OwnItem); m_OwnList.Remove(OwnItem);
m_DataMgr.RemoveWatch(strCode); m_DataMgr.RemoveWatch(strCode);
@@ -204,7 +212,7 @@ namespace upper_limit_crawler
// trailing // trailing
else if (iCurPrice <= OwnItem.m_iMaxPrice - OwnItem.m_iUnitBEP * m_DataMgr.m_Setting.m_fTrailing) else if (iCurPrice <= OwnItem.m_iMaxPrice - OwnItem.m_iUnitBEP * m_DataMgr.m_Setting.m_fTrailing)
{ {
UlUtil.Trace(string.Format("[{0}] 트레일링 매도 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice/OwnItem.m_iUnitBEP-1.0f).ToString("0.00%"))); UlUtil.Trace(string.Format("[{0}] 트레일링 매도 {1}원 ({2})", OwnItem.m_strCodeName, iCurPrice, (iCurPrice/(float)OwnItem.m_iUnitBEP-1.0f).ToString("0.00%")));
m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance); m_DataMgr.GetTrader().SellCurPrice(OwnItem.m_strCode, OwnItem.m_iPayBalance);
m_OwnList.Remove(OwnItem); m_OwnList.Remove(OwnItem);
m_DataMgr.RemoveWatch(strCode); m_DataMgr.RemoveWatch(strCode);

View File

@@ -20,45 +20,24 @@ namespace upper_limit_crawler
public float m_fLossCut; public float m_fLossCut;
} }
public class WATCH_ITEM
{
public string m_strCode;
public string m_strCodeName;
public DSCBO1Lib.StockCur m_StockCur = null;
public void Received()
{
m_iCurPrice = m_StockCur.GetHeaderValue(13);
m_iPrevClosing = m_iCurPrice - m_StockCur.GetHeaderValue(2);
m_iStartPrice = m_StockCur.GetHeaderValue(4);
m_iHighestPrice = m_StockCur.GetHeaderValue(5);
m_iVolume = m_StockCur.GetHeaderValue(9);
m_iBidPrice = m_StockCur.GetHeaderValue(8);
m_iBidCnt = 0;
}
public int m_iCurPrice;
public int m_iPrevClosing;
public int m_iStartPrice;
public int m_iHighestPrice;
public int m_iVolume;
public int m_iBidPrice;
public int m_iBidCnt;
}
public class ULDataMgr public class ULDataMgr
{ {
public SETTING m_Setting = new SETTING(); public SETTING m_Setting = new SETTING();
ULTrader m_Trader = new ULTrader(); ULTrader m_Trader = new ULTrader();
Dictionary<string, WATCH_ITEM> m_WatchList = new Dictionary<string, WATCH_ITEM>(); Dictionary<string, ULWatchItem> m_WatchList = new Dictionary<string, ULWatchItem>();
List<string> m_BlackList = new List<string>(); List<string> m_BlackList = new List<string>();
public ULDataMgr() public ULDataMgr()
{ {
} }
public void Init()
{
m_Trader.Init();
}
public string GetAccount() public string GetAccount()
{ {
return m_Trader.GetAccount(); return m_Trader.GetAccount();
@@ -74,7 +53,7 @@ namespace upper_limit_crawler
if (m_WatchList.ContainsKey(strCode)) if (m_WatchList.ContainsKey(strCode))
return; return;
WATCH_ITEM item = new WATCH_ITEM(); ULWatchItem item = new ULWatchItem();
item.m_strCode = strCode; item.m_strCode = strCode;
item.m_strCodeName = strCodeName; item.m_strCodeName = strCodeName;
item.m_iCurPrice = iCurPrice; item.m_iCurPrice = iCurPrice;
@@ -97,6 +76,25 @@ namespace upper_limit_crawler
m_WatchList.Remove(strCode); m_WatchList.Remove(strCode);
} }
public void StartAll()
{
foreach (KeyValuePair<string, ULWatchItem> item in m_WatchList)
{
item.Value.m_StockCur = new DSCBO1Lib.StockCur();
item.Value.m_StockCur.SetInputValue(0, item.Value.m_strCode);
item.Value.m_StockCur.Received += item.Value.Received;
item.Value.m_StockCur.SubscribeLatest();
}
}
public void StopAll()
{
foreach (KeyValuePair<string, ULWatchItem> item in m_WatchList)
{
item.Value.m_StockCur.Unsubscribe();
}
}
public void AddBlackList(string strCode) public void AddBlackList(string strCode)
{ {
m_BlackList.Add(strCode); m_BlackList.Add(strCode);
@@ -107,7 +105,7 @@ namespace upper_limit_crawler
return m_BlackList.Contains(strCode); return m_BlackList.Contains(strCode);
} }
public Dictionary<string, WATCH_ITEM> GetWatchList() public Dictionary<string, ULWatchItem> GetWatchList()
{ {
return m_WatchList; return m_WatchList;
} }

View File

@@ -16,14 +16,12 @@ namespace upper_limit_crawler
const int MONITOR_DELAY = 15000; const int MONITOR_DELAY = 15000;
ULDataMgr m_DataMgr; ULDataMgr m_DataMgr;
CPSYSDIBLib.CpSvrNew7043 m_7043 = new CPSYSDIBLib.CpSvrNew7043(); CPSYSDIBLib.CpSvrNew7043 m_7043 = null;
Timer m_Timer = new Timer(); Timer m_Timer = new Timer();
int m_iMonitorDelay = 0; int m_iMonitorDelay = 0;
int m_iLastTime = 0; int m_iLastTime = 0;
bool m_bRequesting = false; bool m_bRequesting = false;
DSCBO1Lib.StockCur m_StockCur = new DSCBO1Lib.StockCur();
public ULMonitorDlg(ULDataMgr DataMgr) public ULMonitorDlg(ULDataMgr DataMgr)
{ {
InitializeComponent(); InitializeComponent();
@@ -33,30 +31,36 @@ namespace upper_limit_crawler
this.TopLevel = false; this.TopLevel = false;
m_DataMgr = DataMgr; m_DataMgr = DataMgr;
m_7043.SetInputValue(0, '0');
m_7043.SetInputValue(1, '2');
m_7043.SetInputValue(2, '1');
m_7043.SetInputValue(3, 21);
m_7043.SetInputValue(4, '1');
m_7043.SetInputValue(5, '0');
m_7043.SetInputValue(6, '0');
m_7043.SetInputValue(7, (short)(m_DataMgr.m_Setting.m_fSearchMin*100));
m_7043.SetInputValue(8, (short)((m_DataMgr.m_Setting.m_fSearchMax+0.009)*100));
m_StockCur.Received += StockCur_Received;
m_Timer.Interval = 100; m_Timer.Interval = 100;
m_Timer.Tick += Refresh; m_Timer.Tick += Refresh;
m_Timer.Start();
} }
private void StockCur_Received() public void Start()
{ {
m_7043 = new CPSYSDIBLib.CpSvrNew7043();
} m_7043.SetInputValue(0, '0');
m_7043.SetInputValue(1, '2');
m_7043.SetInputValue(2, '1');
m_7043.SetInputValue(3, 21);
m_7043.SetInputValue(4, '1');
m_7043.SetInputValue(5, '0');
m_7043.SetInputValue(6, '0');
m_7043.SetInputValue(7, (short)(m_DataMgr.m_Setting.m_fSearchMin * 100));
m_7043.SetInputValue(8, (short)((m_DataMgr.m_Setting.m_fSearchMax + 0.009) * 100));
bool Check()
RefreshMonitorItem();
m_Timer.Start();
}
public void Stop()
{
m_Timer.Stop();
}
bool RefreshMonitorItem()
{ {
if (m_bRequesting == true || UlUtil.GetLimitRemainCountRQ() < 30) if (m_bRequesting == true || UlUtil.GetLimitRemainCountRQ() < 30)
return false; return false;
@@ -129,13 +133,13 @@ namespace upper_limit_crawler
void RefreshData() void RefreshData()
{ {
Dictionary<string, WATCH_ITEM> WatchList = m_DataMgr.GetWatchList(); Dictionary<string, ULWatchItem> WatchList = m_DataMgr.GetWatchList();
foreach (ListViewItem lvItem in lvWatch.Items) foreach (ListViewItem lvItem in lvWatch.Items)
{ {
string strCode = lvItem.SubItems[chCode.Index].Text; string strCode = lvItem.SubItems[chCode.Index].Text;
if (WatchList.ContainsKey(strCode) == true) if (WatchList.ContainsKey(strCode) == true)
{ {
WATCH_ITEM item = WatchList[strCode]; ULWatchItem item = WatchList[strCode];
int iDisplayCurPrice = 0; int iDisplayCurPrice = 0;
if (lvItem.SubItems[chCurPrice.Index].Text.Length > 0) if (lvItem.SubItems[chCurPrice.Index].Text.Length > 0)
@@ -154,10 +158,11 @@ namespace upper_limit_crawler
if (fCompRate >= m_DataMgr.m_Setting.m_fBidMin && if (fCompRate >= m_DataMgr.m_Setting.m_fBidMin &&
fCompRate <= m_DataMgr.m_Setting.m_fBidMax && fCompRate <= m_DataMgr.m_Setting.m_fBidMax &&
m_DataMgr.IsInBlackList(strCode) == false) item.IsUpSlope() == true &&
m_DataMgr.IsInBlackList(strCode) == false)
{ {
// bid and add to black list // bid and add to black list
UlUtil.Trace(string.Format("[{0}] 조건 매수 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate)); UlUtil.Trace(string.Format("[{0}] 조건 매수 {1}원 ({2})", item.m_strCodeName, item.m_iCurPrice, fCompRate.ToString("0.00%")));
m_DataMgr.GetTrader().Buy(strCode, item.m_iCurPrice, (int)m_DataMgr.m_Setting.m_fBidAmount); m_DataMgr.GetTrader().Buy(strCode, item.m_iCurPrice, (int)m_DataMgr.m_Setting.m_fBidAmount);
m_DataMgr.AddBlackList(strCode); m_DataMgr.AddBlackList(strCode);
@@ -180,7 +185,7 @@ namespace upper_limit_crawler
m_iMonitorDelay -= iDeltaT; m_iMonitorDelay -= iDeltaT;
if (m_iMonitorDelay <= 0) if (m_iMonitorDelay <= 0)
{ {
bool bRequest = Check(); bool bRequest = RefreshMonitorItem();
m_iMonitorDelay = (bRequest == true) ? MONITOR_DELAY : 1000; m_iMonitorDelay = (bRequest == true) ? MONITOR_DELAY : 1000;
} }

View File

@@ -8,10 +8,8 @@ namespace upper_limit_crawler
{ {
public class ULTrader public class ULTrader
{ {
CPFORETRADELib.CpForeTdUtil m_Util = new CPFORETRADELib.CpForeTdUtil(); CPFORETRADELib.CpForeTdUtil m_Util = null;
DSCBO1Lib.CpConclusion m_Conclusion = new DSCBO1Lib.CpConclusion(); DSCBO1Lib.CpConclusion m_Conclusion = null;
//CPTRADELib.CpTd0311 m_Td0311Bid = new CPTRADELib.CpTd0311();
//CPTRADELib.CpTd0311 m_Td0311Ask = new CPTRADELib.CpTd0311();
string[] m_astrAccounts = null; string[] m_astrAccounts = null;
@@ -20,9 +18,16 @@ namespace upper_limit_crawler
public ULTrader() public ULTrader()
{ {
m_Util.TradeInit(); }
public void Init()
{
m_Util = new CPFORETRADELib.CpForeTdUtil();
m_Conclusion = new DSCBO1Lib.CpConclusion();
m_Util.TradeInit();
m_astrAccounts = m_Util.AccountNumber; m_astrAccounts = m_Util.AccountNumber;
StartConclusion(); StartConclusion();
} }

252
ULWatchItem.cs Normal file
View File

@@ -0,0 +1,252 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace upper_limit_crawler
{
public class ULWatchItem
{
public class PriceNode
{
public PriceNode(int iTime, int iPrice)
{
m_iTime = iTime;
m_iPrice = iPrice;
}
public int m_iTime;
public int m_iPrice;
}
public class CandleTick
{
public CandleTick(int iTime, int iPrice)
{
m_iTime = iTime;
m_iStart = iPrice;
m_iEnd = iPrice;
m_iLowest = iPrice;
m_iHighest = iPrice;
}
public int m_iTime;
public int m_iStart;
public int m_iEnd;
public int m_iLowest;
public int m_iHighest;
}
public class MATick
{
public MATick(int iTime, float fMA)
{
m_iTime = iTime;
m_fMA = fMA;
}
public int m_iTime;
public float m_fMA;
}
public string m_strCode;
public string m_strCodeName;
public DSCBO1Lib.StockCur m_StockCur = null;
public int m_iCurPrice;
public int m_iPrevClosing;
public int m_iStartPrice;
public int m_iHighestPrice;
public int m_iVolume;
public int m_iBidPrice;
public int m_iBidCnt;
List<PriceNode> m_PriceList = new List<PriceNode>();
// key : time(hh:mm:ss)
SortedList<int, CandleTick> m_1MinChart = new SortedList<int, CandleTick>();
SortedList<int, MATick> m_5MAChart = new SortedList<int, MATick>();
public void InsertPriceNode(int iTime, int iPrice)
{
PriceNode node = new PriceNode(iTime, iPrice);
m_PriceList.Add(node);
Insert1MinChart(iTime, iPrice);
Insert5MinChart(iTime);
}
public void Received()
{
int iTime = (int)m_StockCur.GetHeaderValue(18);
int iTime2 = m_StockCur.GetHeaderValue(3);
m_iCurPrice = m_StockCur.GetHeaderValue(13);
m_iPrevClosing = m_iCurPrice - m_StockCur.GetHeaderValue(2);
m_iStartPrice = m_StockCur.GetHeaderValue(4);
m_iHighestPrice = m_StockCur.GetHeaderValue(5);
m_iVolume = m_StockCur.GetHeaderValue(9);
m_iBidPrice = m_StockCur.GetHeaderValue(8);
m_iBidCnt = 0;
InsertPriceNode(iTime, m_iCurPrice);
}
public int GetHour(int iTime)
{
return iTime / 10000;
}
public int GetMinute(int iTime)
{
return (iTime / 100) % 100;
}
public int GetSecond(int iTime)
{
return iTime % 100;
}
public int GetTimeKey1Min(int iHour, int iMin, int iSecond)
{
return iHour*10000 + iMin*100 + iSecond;
}
void Insert1MinChart(int iTime, int iPrice)
{
int iHour = GetHour(iTime);
int iMin = GetMinute(iTime);
int iSec = GetSecond(iTime);
int iKey = GetTimeKey1Min(iHour, iMin, iSec);
if (m_1MinChart.ContainsKey(iKey) == false)
{
CandleTick tick1 = new CandleTick(iTime, iPrice);
m_1MinChart.Add(iKey, tick1);
}
else
{
CandleTick tick1 = m_1MinChart[iKey];
tick1.m_iTime = iTime;
tick1.m_iEnd = iPrice;
tick1.m_iLowest = Math.Min(tick1.m_iLowest, iPrice);
tick1.m_iHighest = Math.Max(tick1.m_iHighest, iPrice);
}
}
public void MakeChart()
{
foreach (PriceNode node in m_PriceList)
{
int iTime = node.m_iTime;
int iPrice = node.m_iPrice;
int iHour = GetHour(iTime);
int iMin = GetMinute(iTime);
int iSec = GetSecond(iTime);
int iKey = GetTimeKey1Min(iHour, iMin, iSec);
if (m_1MinChart.ContainsKey(iKey) == false)
{
CandleTick tick1 = new CandleTick(iTime, node.m_iPrice);
m_1MinChart.Add(iKey, tick1);
}
else
{
CandleTick tick1 = m_1MinChart[iKey];
tick1.m_iTime = iTime;
tick1.m_iEnd = iPrice;
tick1.m_iLowest = Math.Min(tick1.m_iLowest, iPrice);
tick1.m_iHighest = Math.Max(tick1.m_iHighest, iPrice);
}
}
}
bool IsIn5Min(int iBaseKey, int iKeyCheck)
{
int iBaseIdx = m_1MinChart.IndexOfKey(iBaseKey);
int iIdxCheck = m_1MinChart.IndexOfKey(iKeyCheck);
return (iIdxCheck > iBaseIdx - 5 && iIdxCheck <= iBaseIdx);
}
void Insert5MinChart(int iTime)
{
int iHour = GetHour(iTime);
int iMin = GetMinute(iTime);
int iSec = GetSecond(iTime);
int iKey = GetTimeKey1Min(iHour, iMin, iSec);
MATick tick = null;
if (m_5MAChart.ContainsKey(iKey) == false)
tick = new MATick(iTime, 0);
else
tick = m_5MAChart[iKey];
int iIdx = m_1MinChart.IndexOfKey(iKey);
IEnumerable<KeyValuePair<int, CandleTick>> Search = m_1MinChart.Where(r => IsIn5Min(iKey, r.Key));
float fMA = Search.Count() == 5 ? (float)Search.Average(r => r.Value.m_iEnd) : 0;
tick.m_fMA = fMA;
if(m_5MAChart.ContainsKey(iKey) == true)
m_5MAChart[iKey] = tick;
else
m_5MAChart.Add(iKey, tick);
}
public void MakeMAChart()
{
foreach (KeyValuePair<int, CandleTick> node in m_1MinChart)
{
int iTime = node.Key;
int iHour = GetHour(iTime);
int iMin = GetMinute(iTime);
int iSec = GetSecond(iTime);
int iKey = GetTimeKey1Min(iHour, iMin, iSec);
MATick tick = null;
if (m_5MAChart.ContainsKey(iKey) == false)
tick = new MATick(iTime, 0);
else
tick = m_5MAChart[iKey];
int iIdx = m_1MinChart.IndexOfKey(iKey);
IEnumerable<KeyValuePair<int, CandleTick>> Search = m_1MinChart.Where(r => IsIn5Min(iKey, r.Key));
float fMA = Search.Count() == 5 ? (float)Search.Average(r => r.Value.m_iEnd) : 0;
tick.m_fMA = fMA;
m_5MAChart.Add(iKey, tick);
}
}
public void PrintChart()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("======= 1 MINUTE CHART =======");
for(int i=0; i< m_1MinChart.Keys.Count; i++)
{
int iKey = m_1MinChart.Keys[i];
CandleTick node1Min = m_1MinChart.Values[i];
MATick node5MA = m_5MAChart.ContainsKey(iKey) ? m_5MAChart[iKey] : null;
sb.AppendFormat("{0:######} : {1:###,###,###} ({2:###,###.###})\n", iKey, node1Min.m_iEnd, node5MA != null ? node5MA.m_fMA : 0);
}
sb.AppendLine("======= END =======");
Console.WriteLine(sb.ToString());
}
public bool IsUpSlope()
{
return true;
}
}
}

View File

@@ -14,7 +14,7 @@ namespace upper_limit_crawler
{ {
//static string m_strLogServer = "http://mjjo53.us.to:8000"; //static string m_strLogServer = "http://mjjo53.us.to:8000";
static CPUTILLib.CpCybos m_Util = new CPUTILLib.CpCybos(); static CPUTILLib.CpCybos m_CPUtil = new CPUTILLib.CpCybos();
static TextBox m_tbLog = null; static TextBox m_tbLog = null;
static string m_strLogFileName; static string m_strLogFileName;
static TimeSpan m_TimeDiff = TimeSpan.Zero; static TimeSpan m_TimeDiff = TimeSpan.Zero;
@@ -23,9 +23,6 @@ namespace upper_limit_crawler
{ {
m_tbLog = tbLog; m_tbLog = tbLog;
DateTime time = GetFastestNISTDate();
m_TimeDiff = time - DateTime.Now;
if (Debugger.IsAttached == true) if (Debugger.IsAttached == true)
m_strLogFileName = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName+"\\"; m_strLogFileName = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName+"\\";
m_strLogFileName += "log\\"; m_strLogFileName += "log\\";
@@ -34,6 +31,12 @@ namespace upper_limit_crawler
m_strLogFileName += "log-" + GetCurTime().ToString("yyyy-MM-dd") + ".txt"; m_strLogFileName += "log-" + GetCurTime().ToString("yyyy-MM-dd") + ".txt";
} }
public static void SyncServerTime()
{
DateTime time = GetFastestNISTDate();
m_TimeDiff = time - DateTime.Now;
}
public static DateTime GetCurTime() public static DateTime GetCurTime()
{ {
return DateTime.Now + m_TimeDiff; return DateTime.Now + m_TimeDiff;
@@ -198,17 +201,31 @@ namespace upper_limit_crawler
public static int GetLimitRemainCountTrace() public static int GetLimitRemainCountTrace()
{ {
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_TRADE_REQUEST); return m_CPUtil.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_TRADE_REQUEST);
} }
public static int GetLimitRemainCountRQ() public static int GetLimitRemainCountRQ()
{ {
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_NONTRADE_REQUEST); return m_CPUtil.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_NONTRADE_REQUEST);
} }
public static int GetLimitRemainCountSB() public static int GetLimitRemainCountSB()
{ {
return m_Util.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_SUBSCRIBE); return m_CPUtil.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_SUBSCRIBE);
} }
public static bool IsConnected()
{
return (m_CPUtil.IsConnect==1);
}
public static void Reset()
{
m_CPUtil = null;
System.GC.Collect(0, GCCollectionMode.Forced);
System.GC.WaitForFullGCComplete();
m_CPUtil = new CPUTILLib.CpCybos();
}
} }
} }

View File

@@ -57,6 +57,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ULWatchItem.cs" />
<Compile Include="ULBalanceDlg.cs"> <Compile Include="ULBalanceDlg.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>