충돌 수정
This commit is contained in:
444
Million Buyer/MainForm.Designer.cs
generated
444
Million Buyer/MainForm.Designer.cs
generated
@@ -34,21 +34,17 @@
|
||||
this.lb_IndiName = new System.Windows.Forms.Label();
|
||||
this.bt_Modify = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.lb_TotalMoney = new System.Windows.Forms.Label();
|
||||
this.tb_CycleMoneyValue = new System.Windows.Forms.TextBox();
|
||||
this.tb_CycleCount = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.lb_StartDate = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.lb_TotalMoneyValue = new System.Windows.Forms.Label();
|
||||
this.lb_TotalRate = new System.Windows.Forms.Label();
|
||||
this.lb_BuyMarketCount = new System.Windows.Forms.Label();
|
||||
this.lb_TotalMoney = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.bt_Start = new System.Windows.Forms.Button();
|
||||
this.bt_Stop = new System.Windows.Forms.Button();
|
||||
this.rd_Realtime = new System.Windows.Forms.RadioButton();
|
||||
@@ -73,20 +69,30 @@
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.lb_log = new System.Windows.Forms.ListBox();
|
||||
this.bt_alive = new System.Windows.Forms.Button();
|
||||
this.tb_CoinFullName = new System.Windows.Forms.TextBox();
|
||||
this.tb_Price = new System.Windows.Forms.TextBox();
|
||||
this.lb_CoinFullName = new System.Windows.Forms.Label();
|
||||
this.lb_Price = new System.Windows.Forms.Label();
|
||||
this.bt_Buy = new System.Windows.Forms.Button();
|
||||
this.bt_Sell = new System.Windows.Forms.Button();
|
||||
this.lb_Volume = new System.Windows.Forms.Label();
|
||||
this.tb_Volume = new System.Windows.Forms.TextBox();
|
||||
this.bt_Search = new System.Windows.Forms.Button();
|
||||
this.bt_Cancel = new System.Windows.Forms.Button();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.cb_AccountList = new System.Windows.Forms.ComboBox();
|
||||
this.cb_UserList = new System.Windows.Forms.ComboBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.tl_RealtimeOrder = new DevExpress.XtraTreeList.TreeList();
|
||||
this.Uuid = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.CoinFullName = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.Side = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.OrderPrice = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.State = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.Volume = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.ExecutedVolume = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.CreateOrderTime = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.bt_BuyStop = new System.Windows.Forms.Button();
|
||||
this.bt_BuyStart = new System.Windows.Forms.Button();
|
||||
this.lb_BuyFlag = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_BuyList)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_Result)).BeginInit();
|
||||
this.groupBox3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_RealtimeOrder)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
@@ -96,13 +102,15 @@
|
||||
this.groupBox1.Controls.Add(this.lb_IndiName);
|
||||
this.groupBox1.Controls.Add(this.bt_Modify);
|
||||
this.groupBox1.Controls.Add(this.label6);
|
||||
this.groupBox1.Controls.Add(this.lb_TotalMoney);
|
||||
this.groupBox1.Controls.Add(this.tb_CycleMoneyValue);
|
||||
this.groupBox1.Controls.Add(this.tb_CycleCount);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 52);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 123);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(362, 159);
|
||||
this.groupBox1.Size = new System.Drawing.Size(362, 185);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "데이터 Setting";
|
||||
@@ -112,7 +120,7 @@
|
||||
this.cb_UpperMainIndi.AutoSize = true;
|
||||
this.cb_UpperMainIndi.Checked = true;
|
||||
this.cb_UpperMainIndi.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cb_UpperMainIndi.Location = new System.Drawing.Point(10, 131);
|
||||
this.cb_UpperMainIndi.Location = new System.Drawing.Point(10, 155);
|
||||
this.cb_UpperMainIndi.Name = "cb_UpperMainIndi";
|
||||
this.cb_UpperMainIndi.Size = new System.Drawing.Size(212, 16);
|
||||
this.cb_UpperMainIndi.TabIndex = 9;
|
||||
@@ -124,7 +132,7 @@
|
||||
this.cb_IncludeClearIndicator.AutoSize = true;
|
||||
this.cb_IncludeClearIndicator.Checked = true;
|
||||
this.cb_IncludeClearIndicator.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cb_IncludeClearIndicator.Location = new System.Drawing.Point(10, 109);
|
||||
this.cb_IncludeClearIndicator.Location = new System.Drawing.Point(10, 133);
|
||||
this.cb_IncludeClearIndicator.Name = "cb_IncludeClearIndicator";
|
||||
this.cb_IncludeClearIndicator.Size = new System.Drawing.Size(170, 16);
|
||||
this.cb_IncludeClearIndicator.TabIndex = 8;
|
||||
@@ -134,14 +142,14 @@
|
||||
// lb_IndiName
|
||||
//
|
||||
this.lb_IndiName.AutoSize = true;
|
||||
this.lb_IndiName.Location = new System.Drawing.Point(142, 82);
|
||||
this.lb_IndiName.Location = new System.Drawing.Point(142, 106);
|
||||
this.lb_IndiName.Name = "lb_IndiName";
|
||||
this.lb_IndiName.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_IndiName.TabIndex = 7;
|
||||
//
|
||||
// bt_Modify
|
||||
//
|
||||
this.bt_Modify.Location = new System.Drawing.Point(288, 77);
|
||||
this.bt_Modify.Location = new System.Drawing.Point(288, 101);
|
||||
this.bt_Modify.Name = "bt_Modify";
|
||||
this.bt_Modify.Size = new System.Drawing.Size(68, 23);
|
||||
this.bt_Modify.TabIndex = 6;
|
||||
@@ -152,15 +160,23 @@
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(95, 82);
|
||||
this.label6.Location = new System.Drawing.Point(95, 106);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(41, 12);
|
||||
this.label6.TabIndex = 4;
|
||||
this.label6.Text = "조건식";
|
||||
//
|
||||
// lb_TotalMoney
|
||||
//
|
||||
this.lb_TotalMoney.AutoSize = true;
|
||||
this.lb_TotalMoney.Location = new System.Drawing.Point(146, 21);
|
||||
this.lb_TotalMoney.Name = "lb_TotalMoney";
|
||||
this.lb_TotalMoney.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_TotalMoney.TabIndex = 4;
|
||||
//
|
||||
// tb_CycleMoneyValue
|
||||
//
|
||||
this.tb_CycleMoneyValue.Location = new System.Drawing.Point(142, 50);
|
||||
this.tb_CycleMoneyValue.Location = new System.Drawing.Point(142, 74);
|
||||
this.tb_CycleMoneyValue.Name = "tb_CycleMoneyValue";
|
||||
this.tb_CycleMoneyValue.ReadOnly = true;
|
||||
this.tb_CycleMoneyValue.Size = new System.Drawing.Size(214, 21);
|
||||
@@ -168,7 +184,7 @@
|
||||
//
|
||||
// tb_CycleCount
|
||||
//
|
||||
this.tb_CycleCount.Location = new System.Drawing.Point(142, 20);
|
||||
this.tb_CycleCount.Location = new System.Drawing.Point(142, 44);
|
||||
this.tb_CycleCount.Name = "tb_CycleCount";
|
||||
this.tb_CycleCount.ReadOnly = true;
|
||||
this.tb_CycleCount.Size = new System.Drawing.Size(214, 21);
|
||||
@@ -177,7 +193,7 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(35, 53);
|
||||
this.label2.Location = new System.Drawing.Point(35, 77);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(101, 12);
|
||||
this.label2.TabIndex = 1;
|
||||
@@ -186,27 +202,30 @@
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(7, 26);
|
||||
this.label1.Location = new System.Drawing.Point(7, 50);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(129, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "한번에 구입 할 종목 수";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(47, 21);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(89, 12);
|
||||
this.label4.TabIndex = 0;
|
||||
this.label4.Text = "계정 내 총 금액";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.lb_StartDate);
|
||||
this.groupBox2.Controls.Add(this.label10);
|
||||
this.groupBox2.Controls.Add(this.lb_TotalMoneyValue);
|
||||
this.groupBox2.Controls.Add(this.lb_TotalRate);
|
||||
this.groupBox2.Controls.Add(this.lb_BuyMarketCount);
|
||||
this.groupBox2.Controls.Add(this.lb_TotalMoney);
|
||||
this.groupBox2.Controls.Add(this.label7);
|
||||
this.groupBox2.Controls.Add(this.label5);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 217);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 312);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(362, 191);
|
||||
this.groupBox2.Size = new System.Drawing.Size(362, 72);
|
||||
this.groupBox2.TabIndex = 6;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "데이터 현황";
|
||||
@@ -214,7 +233,7 @@
|
||||
// lb_StartDate
|
||||
//
|
||||
this.lb_StartDate.AutoSize = true;
|
||||
this.lb_StartDate.Location = new System.Drawing.Point(102, 161);
|
||||
this.lb_StartDate.Location = new System.Drawing.Point(102, 49);
|
||||
this.lb_StartDate.Name = "lb_StartDate";
|
||||
this.lb_StartDate.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_StartDate.TabIndex = 9;
|
||||
@@ -222,80 +241,29 @@
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(39, 161);
|
||||
this.label10.Location = new System.Drawing.Point(39, 49);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(57, 12);
|
||||
this.label10.TabIndex = 8;
|
||||
this.label10.Text = "시작 시간";
|
||||
//
|
||||
// lb_TotalMoneyValue
|
||||
//
|
||||
this.lb_TotalMoneyValue.AutoSize = true;
|
||||
this.lb_TotalMoneyValue.Location = new System.Drawing.Point(102, 126);
|
||||
this.lb_TotalMoneyValue.Name = "lb_TotalMoneyValue";
|
||||
this.lb_TotalMoneyValue.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_TotalMoneyValue.TabIndex = 7;
|
||||
//
|
||||
// lb_TotalRate
|
||||
//
|
||||
this.lb_TotalRate.AutoSize = true;
|
||||
this.lb_TotalRate.Location = new System.Drawing.Point(102, 91);
|
||||
this.lb_TotalRate.Name = "lb_TotalRate";
|
||||
this.lb_TotalRate.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_TotalRate.TabIndex = 6;
|
||||
//
|
||||
// lb_BuyMarketCount
|
||||
//
|
||||
this.lb_BuyMarketCount.AutoSize = true;
|
||||
this.lb_BuyMarketCount.Location = new System.Drawing.Point(102, 59);
|
||||
this.lb_BuyMarketCount.Location = new System.Drawing.Point(102, 25);
|
||||
this.lb_BuyMarketCount.Name = "lb_BuyMarketCount";
|
||||
this.lb_BuyMarketCount.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_BuyMarketCount.TabIndex = 5;
|
||||
//
|
||||
// lb_TotalMoney
|
||||
//
|
||||
this.lb_TotalMoney.AutoSize = true;
|
||||
this.lb_TotalMoney.Location = new System.Drawing.Point(102, 26);
|
||||
this.lb_TotalMoney.Name = "lb_TotalMoney";
|
||||
this.lb_TotalMoney.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_TotalMoney.TabIndex = 4;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(27, 126);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(69, 12);
|
||||
this.label7.TabIndex = 3;
|
||||
this.label7.Text = "전체 수익금";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(27, 91);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(69, 12);
|
||||
this.label5.TabIndex = 2;
|
||||
this.label5.Text = "전체 수익율";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(23, 59);
|
||||
this.label3.Location = new System.Drawing.Point(23, 25);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(73, 12);
|
||||
this.label3.TabIndex = 1;
|
||||
this.label3.Text = "구입 종목 수";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(7, 26);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(89, 12);
|
||||
this.label4.TabIndex = 0;
|
||||
this.label4.Text = "계정 내 총 금액";
|
||||
//
|
||||
// bt_Start
|
||||
//
|
||||
this.bt_Start.Location = new System.Drawing.Point(1441, 737);
|
||||
@@ -320,23 +288,23 @@
|
||||
//
|
||||
this.rd_Realtime.AutoSize = true;
|
||||
this.rd_Realtime.Checked = true;
|
||||
this.rd_Realtime.Location = new System.Drawing.Point(17, 19);
|
||||
this.rd_Realtime.Location = new System.Drawing.Point(8, 79);
|
||||
this.rd_Realtime.Name = "rd_Realtime";
|
||||
this.rd_Realtime.Size = new System.Drawing.Size(123, 16);
|
||||
this.rd_Realtime.Size = new System.Drawing.Size(115, 16);
|
||||
this.rd_Realtime.TabIndex = 9;
|
||||
this.rd_Realtime.TabStop = true;
|
||||
this.rd_Realtime.Text = "실시간 검증 Mode";
|
||||
this.rd_Realtime.Text = "실시간 검증 모드";
|
||||
this.rd_Realtime.UseVisualStyleBackColor = true;
|
||||
this.rd_Realtime.CheckedChanged += new System.EventHandler(this.rd_Realtime_CheckedChanged);
|
||||
//
|
||||
// rd_buyer
|
||||
//
|
||||
this.rd_buyer.AutoSize = true;
|
||||
this.rd_buyer.Location = new System.Drawing.Point(202, 20);
|
||||
this.rd_buyer.Location = new System.Drawing.Point(178, 79);
|
||||
this.rd_buyer.Name = "rd_buyer";
|
||||
this.rd_buyer.Size = new System.Drawing.Size(92, 16);
|
||||
this.rd_buyer.Size = new System.Drawing.Size(84, 16);
|
||||
this.rd_buyer.TabIndex = 10;
|
||||
this.rd_buyer.Text = "Buyer Mode";
|
||||
this.rd_buyer.Text = "Buyer 모드";
|
||||
this.rd_buyer.UseVisualStyleBackColor = true;
|
||||
this.rd_buyer.CheckedChanged += new System.EventHandler(this.rd_buyer_CheckedChanged);
|
||||
//
|
||||
@@ -350,7 +318,7 @@
|
||||
this.tl_BuyList.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.tl_BuyList.Location = new System.Drawing.Point(380, 31);
|
||||
this.tl_BuyList.Name = "tl_BuyList";
|
||||
this.tl_BuyList.Size = new System.Drawing.Size(415, 699);
|
||||
this.tl_BuyList.Size = new System.Drawing.Size(437, 278);
|
||||
this.tl_BuyList.TabIndex = 11;
|
||||
//
|
||||
// BuyMarket
|
||||
@@ -398,9 +366,9 @@
|
||||
this.RateData,
|
||||
this.MoneyData});
|
||||
this.tl_Result.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.tl_Result.Location = new System.Drawing.Point(801, 31);
|
||||
this.tl_Result.Location = new System.Drawing.Point(380, 330);
|
||||
this.tl_Result.Name = "tl_Result";
|
||||
this.tl_Result.Size = new System.Drawing.Size(796, 699);
|
||||
this.tl_Result.Size = new System.Drawing.Size(1217, 400);
|
||||
this.tl_Result.TabIndex = 12;
|
||||
//
|
||||
// Market
|
||||
@@ -497,7 +465,7 @@
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(799, 9);
|
||||
this.label9.Location = new System.Drawing.Point(380, 312);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(129, 12);
|
||||
this.label9.TabIndex = 15;
|
||||
@@ -508,10 +476,10 @@
|
||||
this.lb_log.FormattingEnabled = true;
|
||||
this.lb_log.HorizontalScrollbar = true;
|
||||
this.lb_log.ItemHeight = 12;
|
||||
this.lb_log.Location = new System.Drawing.Point(12, 414);
|
||||
this.lb_log.Location = new System.Drawing.Point(12, 390);
|
||||
this.lb_log.Name = "lb_log";
|
||||
this.lb_log.ScrollAlwaysVisible = true;
|
||||
this.lb_log.Size = new System.Drawing.Size(362, 316);
|
||||
this.lb_log.Size = new System.Drawing.Size(362, 340);
|
||||
this.lb_log.TabIndex = 16;
|
||||
//
|
||||
// bt_alive
|
||||
@@ -524,109 +492,186 @@
|
||||
this.bt_alive.UseVisualStyleBackColor = true;
|
||||
this.bt_alive.Click += new System.EventHandler(this.bt_alive_Click);
|
||||
//
|
||||
// tb_CoinFullName
|
||||
// groupBox3
|
||||
//
|
||||
this.tb_CoinFullName.Location = new System.Drawing.Point(556, 735);
|
||||
this.tb_CoinFullName.Name = "tb_CoinFullName";
|
||||
this.tb_CoinFullName.Size = new System.Drawing.Size(100, 21);
|
||||
this.tb_CoinFullName.TabIndex = 17;
|
||||
this.groupBox3.Controls.Add(this.cb_AccountList);
|
||||
this.groupBox3.Controls.Add(this.cb_UserList);
|
||||
this.groupBox3.Controls.Add(this.label12);
|
||||
this.groupBox3.Controls.Add(this.label11);
|
||||
this.groupBox3.Controls.Add(this.rd_buyer);
|
||||
this.groupBox3.Controls.Add(this.rd_Realtime);
|
||||
this.groupBox3.Location = new System.Drawing.Point(12, 9);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(362, 108);
|
||||
this.groupBox3.TabIndex = 10;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "계정 및 모드 선택";
|
||||
//
|
||||
// tb_Price
|
||||
// cb_AccountList
|
||||
//
|
||||
this.tb_Price.Location = new System.Drawing.Point(862, 735);
|
||||
this.tb_Price.Name = "tb_Price";
|
||||
this.tb_Price.Size = new System.Drawing.Size(100, 21);
|
||||
this.tb_Price.TabIndex = 18;
|
||||
this.cb_AccountList.FormattingEnabled = true;
|
||||
this.cb_AccountList.Location = new System.Drawing.Point(64, 49);
|
||||
this.cb_AccountList.Name = "cb_AccountList";
|
||||
this.cb_AccountList.Size = new System.Drawing.Size(292, 20);
|
||||
this.cb_AccountList.TabIndex = 14;
|
||||
this.cb_AccountList.SelectedIndexChanged += new System.EventHandler(this.cb_AccountList_SelectedIndexChanged);
|
||||
//
|
||||
// lb_CoinFullName
|
||||
// cb_UserList
|
||||
//
|
||||
this.lb_CoinFullName.AutoSize = true;
|
||||
this.lb_CoinFullName.Location = new System.Drawing.Point(457, 742);
|
||||
this.lb_CoinFullName.Name = "lb_CoinFullName";
|
||||
this.lb_CoinFullName.Size = new System.Drawing.Size(93, 12);
|
||||
this.lb_CoinFullName.TabIndex = 19;
|
||||
this.lb_CoinFullName.Text = "Coin Full Name";
|
||||
this.cb_UserList.FormattingEnabled = true;
|
||||
this.cb_UserList.Location = new System.Drawing.Point(64, 21);
|
||||
this.cb_UserList.Name = "cb_UserList";
|
||||
this.cb_UserList.Size = new System.Drawing.Size(292, 20);
|
||||
this.cb_UserList.TabIndex = 13;
|
||||
this.cb_UserList.SelectedIndexChanged += new System.EventHandler(this.cb_UserList_SelectedIndexChanged);
|
||||
//
|
||||
// lb_Price
|
||||
// label12
|
||||
//
|
||||
this.lb_Price.AutoSize = true;
|
||||
this.lb_Price.Location = new System.Drawing.Point(822, 741);
|
||||
this.lb_Price.Name = "lb_Price";
|
||||
this.lb_Price.Size = new System.Drawing.Size(34, 12);
|
||||
this.lb_Price.TabIndex = 20;
|
||||
this.lb_Price.Text = "Price";
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(6, 52);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(51, 12);
|
||||
this.label12.TabIndex = 12;
|
||||
this.label12.Text = "Account";
|
||||
//
|
||||
// bt_Buy
|
||||
// label11
|
||||
//
|
||||
this.bt_Buy.Location = new System.Drawing.Point(1125, 736);
|
||||
this.bt_Buy.Name = "bt_Buy";
|
||||
this.bt_Buy.Size = new System.Drawing.Size(75, 23);
|
||||
this.bt_Buy.TabIndex = 21;
|
||||
this.bt_Buy.Text = "구매";
|
||||
this.bt_Buy.UseVisualStyleBackColor = true;
|
||||
this.bt_Buy.Click += new System.EventHandler(this.bt_Buy_Click);
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(6, 24);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(41, 12);
|
||||
this.label11.TabIndex = 11;
|
||||
this.label11.Text = "사용자";
|
||||
//
|
||||
// bt_Sell
|
||||
// label13
|
||||
//
|
||||
this.bt_Sell.Location = new System.Drawing.Point(1206, 736);
|
||||
this.bt_Sell.Name = "bt_Sell";
|
||||
this.bt_Sell.Size = new System.Drawing.Size(75, 23);
|
||||
this.bt_Sell.TabIndex = 22;
|
||||
this.bt_Sell.Text = "판매";
|
||||
this.bt_Sell.UseVisualStyleBackColor = true;
|
||||
this.bt_Sell.Click += new System.EventHandler(this.bt_Sell_Click);
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(821, 9);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(97, 12);
|
||||
this.label13.TabIndex = 18;
|
||||
this.label13.Text = "실시간 주문 현황";
|
||||
//
|
||||
// lb_Volume
|
||||
// tl_RealtimeOrder
|
||||
//
|
||||
this.lb_Volume.AutoSize = true;
|
||||
this.lb_Volume.Location = new System.Drawing.Point(662, 741);
|
||||
this.lb_Volume.Name = "lb_Volume";
|
||||
this.lb_Volume.Size = new System.Drawing.Size(48, 12);
|
||||
this.lb_Volume.TabIndex = 24;
|
||||
this.lb_Volume.Text = "Volume";
|
||||
this.tl_RealtimeOrder.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
|
||||
this.Uuid,
|
||||
this.CoinFullName,
|
||||
this.Side,
|
||||
this.OrderPrice,
|
||||
this.State,
|
||||
this.Volume,
|
||||
this.ExecutedVolume,
|
||||
this.CreateOrderTime});
|
||||
this.tl_RealtimeOrder.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.tl_RealtimeOrder.Location = new System.Drawing.Point(823, 30);
|
||||
this.tl_RealtimeOrder.Name = "tl_RealtimeOrder";
|
||||
this.tl_RealtimeOrder.Size = new System.Drawing.Size(774, 278);
|
||||
this.tl_RealtimeOrder.TabIndex = 17;
|
||||
//
|
||||
// tb_Volume
|
||||
// Uuid
|
||||
//
|
||||
this.tb_Volume.Location = new System.Drawing.Point(716, 735);
|
||||
this.tb_Volume.Name = "tb_Volume";
|
||||
this.tb_Volume.Size = new System.Drawing.Size(100, 21);
|
||||
this.tb_Volume.TabIndex = 23;
|
||||
this.Uuid.Caption = "UUID";
|
||||
this.Uuid.FieldName = "Uuid";
|
||||
this.Uuid.Name = "Uuid";
|
||||
this.Uuid.Visible = true;
|
||||
this.Uuid.VisibleIndex = 0;
|
||||
//
|
||||
// bt_Search
|
||||
// CoinFullName
|
||||
//
|
||||
this.bt_Search.Location = new System.Drawing.Point(997, 735);
|
||||
this.bt_Search.Name = "bt_Search";
|
||||
this.bt_Search.Size = new System.Drawing.Size(122, 23);
|
||||
this.bt_Search.TabIndex = 25;
|
||||
this.bt_Search.Text = "구매한 데이터 조회";
|
||||
this.bt_Search.UseVisualStyleBackColor = true;
|
||||
this.bt_Search.Click += new System.EventHandler(this.bt_Search_Click);
|
||||
this.CoinFullName.Caption = "Coin Name";
|
||||
this.CoinFullName.FieldName = "CoinFullName";
|
||||
this.CoinFullName.Name = "CoinFullName";
|
||||
this.CoinFullName.Visible = true;
|
||||
this.CoinFullName.VisibleIndex = 1;
|
||||
//
|
||||
// bt_Cancel
|
||||
// Side
|
||||
//
|
||||
this.bt_Cancel.Location = new System.Drawing.Point(1288, 737);
|
||||
this.bt_Cancel.Name = "bt_Cancel";
|
||||
this.bt_Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.bt_Cancel.TabIndex = 26;
|
||||
this.bt_Cancel.Text = "주문취소";
|
||||
this.bt_Cancel.UseVisualStyleBackColor = true;
|
||||
this.bt_Cancel.Click += new System.EventHandler(this.bt_Cancel_Click);
|
||||
this.Side.Caption = "주문종류";
|
||||
this.Side.FieldName = "Side";
|
||||
this.Side.Name = "Side";
|
||||
this.Side.Visible = true;
|
||||
this.Side.VisibleIndex = 2;
|
||||
//
|
||||
// OrderPrice
|
||||
//
|
||||
this.OrderPrice.Caption = "주문가격";
|
||||
this.OrderPrice.FieldName = "OrderPrice";
|
||||
this.OrderPrice.Name = "OrderPrice";
|
||||
this.OrderPrice.Visible = true;
|
||||
this.OrderPrice.VisibleIndex = 3;
|
||||
//
|
||||
// State
|
||||
//
|
||||
this.State.Caption = "주문상태";
|
||||
this.State.FieldName = "State";
|
||||
this.State.Name = "State";
|
||||
this.State.Visible = true;
|
||||
this.State.VisibleIndex = 4;
|
||||
//
|
||||
// Volume
|
||||
//
|
||||
this.Volume.Caption = "총 주문양";
|
||||
this.Volume.FieldName = "Volume";
|
||||
this.Volume.Name = "Volume";
|
||||
this.Volume.Visible = true;
|
||||
this.Volume.VisibleIndex = 5;
|
||||
//
|
||||
// ExecutedVolume
|
||||
//
|
||||
this.ExecutedVolume.Caption = "체결된 주문양";
|
||||
this.ExecutedVolume.FieldName = "ExecutedVolume";
|
||||
this.ExecutedVolume.Name = "ExecutedVolume";
|
||||
this.ExecutedVolume.Visible = true;
|
||||
this.ExecutedVolume.VisibleIndex = 6;
|
||||
//
|
||||
// CreateOrderTime
|
||||
//
|
||||
this.CreateOrderTime.Caption = "주문 생성 시간";
|
||||
this.CreateOrderTime.FieldName = "CreateOrderTime";
|
||||
this.CreateOrderTime.Name = "CreateOrderTime";
|
||||
this.CreateOrderTime.Visible = true;
|
||||
this.CreateOrderTime.VisibleIndex = 7;
|
||||
//
|
||||
// bt_BuyStop
|
||||
//
|
||||
this.bt_BuyStop.Location = new System.Drawing.Point(211, 737);
|
||||
this.bt_BuyStop.Name = "bt_BuyStop";
|
||||
this.bt_BuyStop.Size = new System.Drawing.Size(76, 23);
|
||||
this.bt_BuyStop.TabIndex = 19;
|
||||
this.bt_BuyStop.Text = "매수 Stop";
|
||||
this.bt_BuyStop.UseVisualStyleBackColor = true;
|
||||
this.bt_BuyStop.Click += new System.EventHandler(this.bt_BuyStop_Click);
|
||||
//
|
||||
// bt_BuyStart
|
||||
//
|
||||
this.bt_BuyStart.Location = new System.Drawing.Point(293, 737);
|
||||
this.bt_BuyStart.Name = "bt_BuyStart";
|
||||
this.bt_BuyStart.Size = new System.Drawing.Size(81, 23);
|
||||
this.bt_BuyStart.TabIndex = 20;
|
||||
this.bt_BuyStart.Text = "매수 Start";
|
||||
this.bt_BuyStart.UseVisualStyleBackColor = true;
|
||||
this.bt_BuyStart.Click += new System.EventHandler(this.bt_BuyStart_Click);
|
||||
//
|
||||
// lb_BuyFlag
|
||||
//
|
||||
this.lb_BuyFlag.AutoSize = true;
|
||||
this.lb_BuyFlag.Location = new System.Drawing.Point(380, 742);
|
||||
this.lb_BuyFlag.Name = "lb_BuyFlag";
|
||||
this.lb_BuyFlag.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_BuyFlag.TabIndex = 21;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1609, 771);
|
||||
this.Controls.Add(this.bt_Cancel);
|
||||
this.Controls.Add(this.bt_Search);
|
||||
this.Controls.Add(this.lb_Volume);
|
||||
this.Controls.Add(this.tb_Volume);
|
||||
this.Controls.Add(this.bt_Sell);
|
||||
this.Controls.Add(this.bt_Buy);
|
||||
this.Controls.Add(this.lb_Price);
|
||||
this.Controls.Add(this.lb_CoinFullName);
|
||||
this.Controls.Add(this.tb_Price);
|
||||
this.Controls.Add(this.tb_CoinFullName);
|
||||
this.ClientSize = new System.Drawing.Size(1609, 776);
|
||||
this.Controls.Add(this.lb_BuyFlag);
|
||||
this.Controls.Add(this.bt_BuyStart);
|
||||
this.Controls.Add(this.bt_BuyStop);
|
||||
this.Controls.Add(this.label13);
|
||||
this.Controls.Add(this.tl_RealtimeOrder);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.bt_alive);
|
||||
this.Controls.Add(this.lb_log);
|
||||
this.Controls.Add(this.label9);
|
||||
@@ -634,8 +679,6 @@
|
||||
this.Controls.Add(this.bt_Save);
|
||||
this.Controls.Add(this.tl_Result);
|
||||
this.Controls.Add(this.tl_BuyList);
|
||||
this.Controls.Add(this.rd_buyer);
|
||||
this.Controls.Add(this.rd_Realtime);
|
||||
this.Controls.Add(this.bt_Stop);
|
||||
this.Controls.Add(this.bt_Start);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
@@ -648,6 +691,9 @@
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_BuyList)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_Result)).EndInit();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_RealtimeOrder)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -662,15 +708,11 @@
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button bt_Modify;
|
||||
private System.Windows.Forms.Label lb_BuyMarketCount;
|
||||
private System.Windows.Forms.Label lb_TotalMoney;
|
||||
private System.Windows.Forms.Label lb_TotalMoneyValue;
|
||||
private System.Windows.Forms.Label lb_TotalRate;
|
||||
private System.Windows.Forms.Button bt_Start;
|
||||
private System.Windows.Forms.Button bt_Stop;
|
||||
private System.Windows.Forms.Label lb_IndiName;
|
||||
@@ -700,16 +742,24 @@
|
||||
private System.Windows.Forms.CheckBox cb_UpperMainIndi;
|
||||
private System.Windows.Forms.CheckBox cb_IncludeClearIndicator;
|
||||
private System.Windows.Forms.Button bt_alive;
|
||||
private System.Windows.Forms.TextBox tb_CoinFullName;
|
||||
private System.Windows.Forms.TextBox tb_Price;
|
||||
private System.Windows.Forms.Label lb_CoinFullName;
|
||||
private System.Windows.Forms.Label lb_Price;
|
||||
private System.Windows.Forms.Button bt_Buy;
|
||||
private System.Windows.Forms.Button bt_Sell;
|
||||
private System.Windows.Forms.Label lb_Volume;
|
||||
private System.Windows.Forms.TextBox tb_Volume;
|
||||
private System.Windows.Forms.Button bt_Search;
|
||||
private System.Windows.Forms.Button bt_Cancel;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.ComboBox cb_AccountList;
|
||||
private System.Windows.Forms.ComboBox cb_UserList;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private DevExpress.XtraTreeList.TreeList tl_RealtimeOrder;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn Uuid;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn CoinFullName;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn Side;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn OrderPrice;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn State;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn Volume;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn ExecutedVolume;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn CreateOrderTime;
|
||||
private System.Windows.Forms.Button bt_BuyStop;
|
||||
private System.Windows.Forms.Button bt_BuyStart;
|
||||
private System.Windows.Forms.Label lb_BuyFlag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.CodeAnalysis.CSharp.Scripting;
|
||||
using Million;
|
||||
using Million.Data;
|
||||
using Million.Data.Upbit;
|
||||
using Million.Data.Upbit.Order;
|
||||
using Million.DbManagement;
|
||||
using Million.IndicatorConditionSetup;
|
||||
@@ -27,20 +28,27 @@ namespace Million_Buyer
|
||||
{
|
||||
bool RealTimeMode = true;
|
||||
|
||||
public SavedResultData _saveResultData;
|
||||
private SavedResultData _saveResultData;
|
||||
//결과 데이터
|
||||
public List<SearchResult> resultDataList;
|
||||
private List<SearchResult> resultDataList;
|
||||
//구매 데이터
|
||||
public List<CandleDataList> buyList;
|
||||
private List<CandleDataList> buyList;
|
||||
|
||||
bool SetIndicator = false;
|
||||
bool ThreadFlag = false;
|
||||
bool AliveCheckor = false;
|
||||
|
||||
bool AliveCheck = false;
|
||||
private Thread thread = null;
|
||||
private Thread orderThread = null;
|
||||
private List<Account> accounts = null;
|
||||
private PaymentType payment = PaymentType.KRW;
|
||||
|
||||
Thread thread = null;
|
||||
private int cycleCount = 0;
|
||||
private double cycleBuyMoney = 0;
|
||||
|
||||
List<Order> orderList = new List<Order>();
|
||||
private int buyCycleCount = 0;
|
||||
|
||||
private bool buyFlag = true;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@@ -59,11 +67,7 @@ namespace Million_Buyer
|
||||
Million.DbManagement.DBConnection.QueryUpdateExcuter
|
||||
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateSavedResultDataTableQuery());
|
||||
Million.DbManagement.DBConnection.QueryUpdateExcuter
|
||||
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateRealTimeIndicatorTableQuery());
|
||||
|
||||
// 데이터 검증을 위한 DB Table 생성
|
||||
Million.DbManagement.DBConnection.QueryUpdateExcuter
|
||||
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateVerifyTickerDataTableQuery());
|
||||
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateRealTimeIndicatorTableQuery());
|
||||
|
||||
_saveResultData = new SavedResultData
|
||||
{
|
||||
@@ -71,7 +75,14 @@ namespace Million_Buyer
|
||||
SellSetupList = new List<object>()
|
||||
};
|
||||
resultDataList = new List<SearchResult>();
|
||||
buyList = new List<CandleDataList>();
|
||||
buyList = new List<CandleDataList>();
|
||||
|
||||
// 현재 연결되어 있는 KEY를 이용하여 확인
|
||||
cb_UserList.Items.Add("이장화");
|
||||
cb_UserList.Items.Add("김영호");
|
||||
cb_UserList.Items.Add("이찬균");
|
||||
|
||||
//cb_UserList.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -81,6 +92,7 @@ namespace Million_Buyer
|
||||
/// <param name="e"></param>
|
||||
private void rd_Realtime_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RealTimeMode = true;
|
||||
SetReadOnly(true);
|
||||
}
|
||||
|
||||
@@ -91,6 +103,7 @@ namespace Million_Buyer
|
||||
/// <param name="e"></param>
|
||||
private void rd_buyer_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RealTimeMode = false;
|
||||
SetReadOnly(false);
|
||||
}
|
||||
|
||||
@@ -100,7 +113,7 @@ namespace Million_Buyer
|
||||
/// <param name="flag"></param>
|
||||
private void SetReadOnly(bool flag)
|
||||
{
|
||||
RealTimeMode = flag;
|
||||
|
||||
tb_CycleCount.ReadOnly = flag;
|
||||
tb_CycleMoneyValue.ReadOnly = flag;
|
||||
}
|
||||
@@ -136,14 +149,37 @@ namespace Million_Buyer
|
||||
}
|
||||
else
|
||||
{
|
||||
int.TryParse(tb_CycleCount.Text, out cycleCount);
|
||||
double.TryParse(tb_CycleMoneyValue.Text, out cycleBuyMoney);
|
||||
|
||||
bt_BuyStart_Click(null, null);
|
||||
|
||||
if (!RealTimeMode)
|
||||
{
|
||||
if (cycleCount == 0 || cycleBuyMoney == 0)
|
||||
{
|
||||
MessageBox.Show("한번에 구입 할 종목 수, 종목 별 구입 금액 입력 바람(Double, Int)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ThreadFlag)
|
||||
{
|
||||
SetReadOnly(true);
|
||||
bt_Start.Enabled = false;
|
||||
thread = new Thread(ThreadFunction);
|
||||
thread.Start();
|
||||
|
||||
//실시간 검증에는 동작하지 않음
|
||||
if (!RealTimeMode)
|
||||
{
|
||||
orderThread = new Thread(OrderThreadFunction);
|
||||
orderThread.Start();
|
||||
}
|
||||
|
||||
ThreadFlag = true;
|
||||
bt_Start.Enabled = false;
|
||||
rd_buyer.Enabled = false;
|
||||
rd_Realtime.Enabled = false;
|
||||
cb_UserList.Enabled = false;
|
||||
cb_AccountList.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,10 +192,19 @@ namespace Million_Buyer
|
||||
private void bt_Stop_Click(object sender, EventArgs e)
|
||||
{
|
||||
ThreadFlag = false;
|
||||
if (!RealTimeMode && thread != null) thread.Abort();
|
||||
//if (!RealTimeMode && thread != null) thread.Abort();
|
||||
//if (!RealTimeMode && orderThread != null) orderThread.Abort();
|
||||
|
||||
bt_Start.Enabled = true;
|
||||
rd_buyer.Enabled = true;
|
||||
rd_Realtime.Enabled = true;
|
||||
|
||||
if (rd_buyer.Checked)
|
||||
SetReadOnly(false);
|
||||
|
||||
cb_UserList.Enabled = true;
|
||||
cb_AccountList.Enabled = true;
|
||||
|
||||
/*
|
||||
* 종료 된 후 데이터 처리 소스는 여기서 처리
|
||||
* 1. Grid에 Stop 후 데이터 처리
|
||||
@@ -168,11 +213,61 @@ namespace Million_Buyer
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 실시간 Order 현황 Check(1초에 한번씩 호출할까 2초에 한번할까 고민중
|
||||
/// </summary>
|
||||
private void OrderThreadFunction()
|
||||
{
|
||||
InsertLog("Order Thread Start");
|
||||
while (ThreadFlag)
|
||||
{
|
||||
//Oder List는 Wait, Watch로 구분되어 있는 List 최신 100개, Done, Cancel로 구분되어 있는 List 최신 100개를 표기함
|
||||
var orderList = CommonProperty.UpbitApi.GetOrderListInformation(UpbitOrderListTypes.waitwatch);
|
||||
orderList.AddRange(CommonProperty.UpbitApi.GetOrderListInformation(UpbitOrderListTypes.donecancel));
|
||||
orderList = orderList.Distinct().ToList();
|
||||
this.BeginInvoke(new Action(delegate ()
|
||||
{
|
||||
try
|
||||
{
|
||||
tl_RealtimeOrder.Nodes.Clear();
|
||||
foreach (var item in orderList)
|
||||
{
|
||||
tl_RealtimeOrder.AppendNode(new object[]
|
||||
{
|
||||
item.Uuid,
|
||||
item.CoinFullName,
|
||||
item.Side,
|
||||
item.OrderPrice,
|
||||
item.State,
|
||||
item.Volume,
|
||||
item.ExecutedVolume,
|
||||
item.CreateOrderTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
}, null);
|
||||
}
|
||||
|
||||
var tempData = orderList.Select(t => t.Uuid).ToList();
|
||||
tempData.AddRange(buyList.Select(t => t.Uuid).ToList());
|
||||
buyCycleCount = tempData.Distinct().ToList().Count;
|
||||
lb_BuyMarketCount.Text = tempData.Distinct().ToList().Count.ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
InsertLog("Order Thread Error : " + e.Message);
|
||||
}
|
||||
}));
|
||||
|
||||
//1초에 한번씩 부르게 처리
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
InsertLog("Order Thread End");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 실제 동작 Thread
|
||||
/// </summary>
|
||||
private void ThreadFunction()
|
||||
{
|
||||
#region Default Setting
|
||||
//시간 체크
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
|
||||
@@ -193,17 +288,17 @@ namespace Million_Buyer
|
||||
var buyRex = _saveResultData.BuyRegularExpression;
|
||||
var sellRex = _saveResultData.SellRegularExpression;
|
||||
|
||||
var buyScript = new InteratorScripter();
|
||||
var buyScript = new InteratorScripter("Buy Script");
|
||||
buyScript.regularExpressionString = buyRex;
|
||||
var sellScript = new InteratorScripter();
|
||||
var sellScript = new InteratorScripter("Sell Script");
|
||||
sellScript.regularExpressionString = sellRex;
|
||||
|
||||
var scriptDic = new Dictionary<string, bool>();
|
||||
|
||||
//TODO 모든 조건 데이터 미리 계산 필요
|
||||
|
||||
//save 데이터
|
||||
_saveResultData.StartDateTime = DateTime.Now;
|
||||
|
||||
//구매 데이터
|
||||
|
||||
var saveFlag = true;
|
||||
_saveResultData.StartDateTime = DateTime.Now;
|
||||
|
||||
//구매 후 데이터 여러개 계속 겹치는 경우 제외하기 위한 List
|
||||
var overlapBuyManagementList = new Dictionary<string, bool>();
|
||||
@@ -220,23 +315,32 @@ namespace Million_Buyer
|
||||
lb_StartDate.Text = standardTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}));
|
||||
|
||||
if (RealTimeFlag)
|
||||
if (RealTimeMode)
|
||||
InsertLog("실시간 검증 구동 중..");
|
||||
else
|
||||
InsertLog("Buyer 구동 중..");
|
||||
|
||||
var cnt = 0;
|
||||
var boolFlag = false;
|
||||
sw.Start();
|
||||
|
||||
#endregion
|
||||
while (ThreadFlag)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (AliveCheckor)
|
||||
{
|
||||
AliveCheckor = false;
|
||||
InsertLog("Alive");
|
||||
}
|
||||
|
||||
|
||||
#region 기본 데이터 Setting
|
||||
if (firstFlag == 0)
|
||||
{
|
||||
realTimeMsg = new RealtimeDataSettingManager(null, PaymentType.KRW);
|
||||
realTimeMsg = new RealtimeDataSettingManager(null, this.payment);
|
||||
dataList = realTimeMsg.GetRealTimeCandleData(candleTypeList, 200);
|
||||
|
||||
foreach (var item in realTimeMsg.coinFullNameList)
|
||||
{
|
||||
if (cb_IncludeClearIndicator.Checked)
|
||||
@@ -256,12 +360,23 @@ namespace Million_Buyer
|
||||
dic[codeFullname] = true;
|
||||
}
|
||||
CommonProperty.subIndicatorStateManagement[item.IndexString] = dic;
|
||||
}
|
||||
#region TODO 이미 구매되어 있는 종목에 대한 기본 데이터 Setting 필요
|
||||
if (RealTimeMode)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
firstFlag = 1;
|
||||
InsertLog("Deafult Data Setting 완료..");
|
||||
sw.Stop();
|
||||
InsertLog("Default 계산 시간 : " + sw.Elapsed.ToString());
|
||||
LogManager.WriteLog("Default 계산 시간 : " + sw.Elapsed.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -274,16 +389,7 @@ namespace Million_Buyer
|
||||
InsertLog("Ticker 계산 시간 : " + sw.Elapsed.ToString());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//Ticker 초기화
|
||||
if (DateTime.Now.Minute == 0 && saveFlag)
|
||||
{
|
||||
realTimeMsg.ClearTicker();
|
||||
InsertLog("Ticker Data Clear..");
|
||||
saveFlag = false;
|
||||
}
|
||||
else if (DateTime.Now.Minute > 1) saveFlag = true;
|
||||
#endregion
|
||||
|
||||
foreach (var item in realTimeMsg.coinFullNameList)
|
||||
{
|
||||
@@ -306,7 +412,7 @@ namespace Million_Buyer
|
||||
sw.Stop();
|
||||
if (sw.Elapsed.TotalSeconds > 1)
|
||||
InsertLog("Execute 계산 시간 : " + sw.Elapsed.ToString());
|
||||
|
||||
|
||||
var minDateTime = dic[MCandleTimeType.M1].Select(t => t.DateTime).Min();
|
||||
var maxDateTime = dic[MCandleTimeType.M1].Select(t => t.DateTime).Max().AddHours(1);
|
||||
|
||||
@@ -316,12 +422,27 @@ namespace Million_Buyer
|
||||
if (sw.Elapsed.TotalSeconds > 1)
|
||||
InsertLog("Indicator Calculate 계산 시간 : " + sw.Elapsed.ToString());
|
||||
#endregion
|
||||
|
||||
|
||||
#region 사고 파는 로직
|
||||
//최신 데이터 가져오기
|
||||
var recentlyData = dic[MCandleTimeType.M1][dic[MCandleTimeType.M1].Count - 1];
|
||||
var recentlyDataList = dic[MCandleTimeType.M1].Where(t=>t.RecentlyDataFlag).ToList();
|
||||
if (recentlyDataList.Count == 0)
|
||||
continue;
|
||||
var maxTime = recentlyDataList.Select(t => t.DateTime).Max();
|
||||
var recentlyData = recentlyDataList.FirstOrDefault(t => t.DateTime == maxTime);
|
||||
|
||||
if (recentlyData == null)
|
||||
continue;
|
||||
|
||||
// Parent Recently Data는 indicator에 따라 달라질수 있으므로 전부다 처리한 후 초기화
|
||||
foreach (var data in dic)
|
||||
{
|
||||
var recentlyList = data.Value.Where(t => t.RecentlyDataFlag).ToList();
|
||||
|
||||
foreach (var recentlyItem in recentlyList)
|
||||
recentlyItem.RecentlyDataFlag = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* 로직 설명
|
||||
* 1. Buy List에 있는지 확인
|
||||
@@ -333,11 +454,20 @@ namespace Million_Buyer
|
||||
//없을 시 -> BUY
|
||||
if (!buyList.Any(t => t.ConGoodsData.CoinFullName == item))
|
||||
{
|
||||
if (!buyFlag) continue;
|
||||
|
||||
var flag = buyScript.DicExcuteScript(recentlyData.CalculateFlag);
|
||||
if (flag)
|
||||
{
|
||||
if (overlapBuyManagementList[item])
|
||||
{
|
||||
InsertLog("Insert Buy Logic");
|
||||
if (!RealTimeMode)
|
||||
{
|
||||
if (buyCycleCount >= cycleCount)
|
||||
continue;
|
||||
}
|
||||
|
||||
sw.Restart();
|
||||
//if (resultDataList.Select(t => t.MarketData).ToList().Any(t => t.CoinFullName == item)) continue;
|
||||
var time = DateTime.Now;
|
||||
@@ -347,21 +477,47 @@ namespace Million_Buyer
|
||||
|
||||
recentlyData.BuyValue = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(buyRex, valDic, recentlyData.CalculateFlag));
|
||||
recentlyData.BuyTime = time;
|
||||
buyData.ConGoodsData = dataList[MCandleTimeType.M1].FirstOrDefault(t => t.ConGoodsData.CoinFullName == item).ConGoodsData;
|
||||
|
||||
// 임시 -> 실시간은 1개만 삿다고 처리
|
||||
recentlyData.BuyCount = 1;
|
||||
|
||||
buyData.ConGoodsData = dataList[MCandleTimeType.M1].FirstOrDefault(t => t.ConGoodsData.CoinFullName == item).ConGoodsData;
|
||||
if (RealTimeMode)
|
||||
{
|
||||
recentlyData.BuyCount = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
recentlyData.BuyCount = Math.Round(cycleBuyMoney / recentlyData.BuyValue, 8);
|
||||
buyData.Uuid = OrderBuy(buyData.ConGoodsData.CoinFullName, recentlyData.BuyCount, recentlyData.BuyValue);
|
||||
if (buyData.Uuid == "")
|
||||
{
|
||||
InsertLog("Return Data 가 에러라서 구매 불가. Log 확인 바람");
|
||||
continue;
|
||||
}
|
||||
buyCycleCount++;
|
||||
}
|
||||
|
||||
buyList.Add(buyData);
|
||||
|
||||
string str = "Buy : " + item + ",\r\n Buy Candle Data : " + JsonConvert.SerializeObject(recentlyData) + "\r\n";
|
||||
LogManager.WriteLog(str, item);
|
||||
|
||||
overlapBuyManagementList[item] = false;
|
||||
InsertLog(buyData.ConGoodsData.CoinFullName + " Market Data 구입 DateTime : " + time.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
//grid 처리 구매항목, 구매 가격, 구매 개수, 구매시점
|
||||
this.BeginInvoke(new Action(delegate ()
|
||||
{
|
||||
tl_BuyList.AppendNode(new object[]
|
||||
{buyData.ConGoodsData.CoinFullName, recentlyData.BuyValue, recentlyData.BuyCount, time.ToString("yyyy-MM-dd HH:mm:ss") }, null);
|
||||
try {
|
||||
tl_BuyList.AppendNode(new object[]
|
||||
{
|
||||
buyData.ConGoodsData.CoinFullName, recentlyData.BuyValue, recentlyData.BuyCount, time.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
}, null);
|
||||
|
||||
lb_BuyMarketCount.Text = buyList.Count.ToString();
|
||||
lb_BuyMarketCount.Text = buyList.Count.ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
InsertLog("Buy 후 Grid Insert Error : " + e.Message);
|
||||
}
|
||||
}));
|
||||
sw.Stop();
|
||||
if (sw.Elapsed.TotalSeconds > 1)
|
||||
@@ -384,7 +540,7 @@ namespace Million_Buyer
|
||||
var time = DateTime.Now;
|
||||
var sellItem = recentlyData;
|
||||
var valDic = ResultLogicManager.GetIndicateValue(sellItem.CalculateFlag, totalIndicatorList, sellItem);
|
||||
sellItem.SellValue = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(sellRex, valDic, sellItem.CalculateFlag));
|
||||
sellItem.SellValue = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(sellRex, valDic, sellItem.CalculateFlag), false);
|
||||
sellItem.SellTime = time;
|
||||
|
||||
var buyCandleData = buyItem.CandleDataLists_Im[0];
|
||||
@@ -408,33 +564,46 @@ namespace Million_Buyer
|
||||
result.WinCount = rate > 0 ? 1 : 0;
|
||||
result.LoseCount = rate < 0 ? 1 : 0;
|
||||
result.FirstWinFlag = rate > 0 ? true : false;
|
||||
|
||||
//실시간 검증은 1개로 처리
|
||||
|
||||
result.BuyCount = buyItem.CandleDataLists_Im[0].BuyCount;
|
||||
result.SellCount = buyItem.CandleDataLists_Im[0].BuyCount;
|
||||
result.SellCount = sellItem.BuyCount;
|
||||
|
||||
// buycount 에서 sell count를 제외한 양이 미체결 량
|
||||
if (!RealTimeMode)
|
||||
{
|
||||
recentlyData.BuyCount = Math.Round(cycleBuyMoney / recentlyData.BuyValue, 8);
|
||||
result.SellCount = OrderSell(buyItem.ConGoodsData.CoinFullName, buyItem.Uuid, sellVal);
|
||||
buyCycleCount--;
|
||||
}
|
||||
|
||||
resultDataList.Add(result);
|
||||
|
||||
string str = "Sell : " + item + ",\r\n Sell Candle Data : " + JsonConvert.SerializeObject(recentlyData) + "\r\n";
|
||||
LogManager.WriteLog(str, item);
|
||||
|
||||
//처리한 buyList는 삭제
|
||||
buyList.Remove(buyItem);
|
||||
InsertLog(buyItem.ConGoodsData.CoinFullName + " Market Data 판매 DateTime : " + time.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
this.BeginInvoke(new Action(delegate ()
|
||||
{
|
||||
//Grid 처리
|
||||
TreeListNode buyNode = null;
|
||||
|
||||
foreach (TreeListNode node in tl_BuyList.Nodes)
|
||||
try
|
||||
{
|
||||
if (node.GetValue("BuyMarket").ToString() == buyItem.ConGoodsData.CoinFullName)
|
||||
//Grid 처리
|
||||
TreeListNode buyNode = null;
|
||||
|
||||
foreach (TreeListNode node in tl_BuyList.Nodes)
|
||||
{
|
||||
buyNode = node;
|
||||
break;
|
||||
if (node.GetValue("BuyMarket").ToString() == buyItem.ConGoodsData.CoinFullName)
|
||||
{
|
||||
buyNode = node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var moneyVal = (sellVal * (1 - 0.0005) - buyCandleData.BuyValue * (1 - 0.0005)) * result.BuyCount;
|
||||
var moneyVal = (sellVal * (1 - 0.0015) - buyCandleData.BuyValue * (1 - 0.0015)) * result.SellCount;
|
||||
|
||||
tl_Result.AppendNode(new object[] {
|
||||
buyNode.GetValue("BuyMarket"),
|
||||
tl_Result.AppendNode(new object[] {
|
||||
buyNode.GetValue("BuyMarket"),
|
||||
buyNode.GetValue("BuyValue"),
|
||||
buyNode.GetValue("BuyCount"),
|
||||
buyNode.GetValue("BuyDateTime"),
|
||||
@@ -445,25 +614,14 @@ namespace Million_Buyer
|
||||
moneyVal
|
||||
}, null);
|
||||
|
||||
tl_BuyList.Nodes.Remove(buyNode);
|
||||
tl_BuyList.Nodes.Remove(buyNode);
|
||||
|
||||
lb_BuyMarketCount.Text = buyList.Count.ToString();
|
||||
double totalRate = 0;
|
||||
double totalMoneyValue = 0;
|
||||
foreach (var resultData in resultDataList)
|
||||
{
|
||||
totalRate += resultData.FirstEarningRate;
|
||||
if (!RealTimeFlag)
|
||||
{
|
||||
// 총 돈량 측정
|
||||
totalMoneyValue += (resultData.SellValue * (1 - 0.0005) - resultData.BuyValueList[0] * (1 - 0.0005)) * resultData.BuyCount;
|
||||
}
|
||||
lb_BuyMarketCount.Text = buyList.Count.ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
InsertLog("Sell Logic Grid Error" + e.Message);
|
||||
}
|
||||
|
||||
lb_TotalRate.Text = totalRate + "%";
|
||||
|
||||
if (!RealTimeFlag)
|
||||
lb_TotalMoneyValue.Text = totalMoneyValue + "원";
|
||||
}));
|
||||
if (sw.Elapsed.TotalSeconds > 1)
|
||||
InsertLog("Sell 계산 로직 : " + sw.Elapsed.ToString());
|
||||
@@ -472,7 +630,7 @@ namespace Million_Buyer
|
||||
#endregion
|
||||
}
|
||||
cnt++;
|
||||
if (cnt % 60 == 0)
|
||||
if (cnt % 100000 == 0)
|
||||
{
|
||||
InsertLog("Scanning......" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
cnt = 0;
|
||||
@@ -484,7 +642,8 @@ namespace Million_Buyer
|
||||
}
|
||||
}
|
||||
|
||||
if (RealTimeFlag)
|
||||
#region Thread 종료 후 후 처리 할 로직
|
||||
if (RealTimeMode)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -492,7 +651,7 @@ namespace Million_Buyer
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
SaveData();
|
||||
InsertLog("Thread Out");
|
||||
@@ -593,9 +752,8 @@ namespace Million_Buyer
|
||||
/// Text Area 에 Log 입력
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
private void InsertLog(string log)
|
||||
private bool InsertLog(string log)
|
||||
{
|
||||
|
||||
this.BeginInvoke(new Action(delegate ()
|
||||
{
|
||||
if (lb_log.Items.Count > 500)
|
||||
@@ -604,6 +762,7 @@ namespace Million_Buyer
|
||||
}
|
||||
lb_log.Items.Insert(0, log);
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Thread 가 살아 있는지 확인
|
||||
@@ -613,84 +772,166 @@ namespace Million_Buyer
|
||||
private void bt_alive_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (thread != null && thread.IsAlive)
|
||||
InsertLog("Thread Alive.");
|
||||
InsertLog("Realtime Thread Alive.");
|
||||
else
|
||||
InsertLog("Thread Death.");
|
||||
InsertLog("Realtime Thread Death.");
|
||||
|
||||
if (orderThread != null && orderThread.IsAlive)
|
||||
InsertLog("Order List Thread Alive.");
|
||||
else
|
||||
InsertLog("Order List Thread Death.");
|
||||
|
||||
AliveCheckor = true;
|
||||
}
|
||||
|
||||
#region 임시 함수들(구매 내역 조회 및 구매 판매 함수)
|
||||
private void bt_Search_Click(object sender, EventArgs e)
|
||||
{
|
||||
var orderList = CommonProperty.UpbitApi.GetOrderListInformation(UpbitOrderListTypes.waitwatch);
|
||||
orderList.AddRange(CommonProperty.UpbitApi.GetOrderListInformation(UpbitOrderListTypes.donecancel));
|
||||
InsertLog("------------------------------------");
|
||||
InsertLog("Order List");
|
||||
this.orderList = orderList;
|
||||
foreach (var item in orderList)
|
||||
{
|
||||
InsertLog("@@@@@@@@@@@@@@@");
|
||||
InsertLog(JsonConvert.SerializeObject(item));
|
||||
}
|
||||
InsertLog("------------------------------------");
|
||||
}
|
||||
|
||||
private void bt_Buy_Click(object sender, EventArgs e)
|
||||
{
|
||||
var coinFullName = tb_CoinFullName.Text;
|
||||
|
||||
//만약 Price가 null or 빈값일 경우 현재가 구매
|
||||
var price = tb_Price.Text;
|
||||
|
||||
double.TryParse(tb_Volume.Text, out var volume);
|
||||
double.TryParse(price, out var priceData);
|
||||
|
||||
/// <summary>
|
||||
/// 구매 함수
|
||||
/// Price가 0일경우 현재가 구매
|
||||
/// return data는 uuid임
|
||||
/// </summary>
|
||||
/// <param name="coinFullName"></param>
|
||||
/// <param name="volume"></param>
|
||||
/// <param name="price"></param>
|
||||
private string OrderBuy(string coinFullName, double volume, double price)
|
||||
{
|
||||
var side = UpbitOrderSide.bid;
|
||||
var ordType = UpbitOrderType.limit;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(price))
|
||||
if (price == 0)
|
||||
ordType = UpbitOrderType.price;
|
||||
var returnData = CommonProperty.UpbitApi.TryOrder(coinFullName, side, volume, priceData, ordType);
|
||||
var returnData = CommonProperty.UpbitApi.TryOrder(coinFullName, side, volume, price, InsertLog, ordType);
|
||||
InsertLog("------------------------------------");
|
||||
InsertLog("Buy Return Data : " + JsonConvert.SerializeObject(returnData));
|
||||
InsertLog("------------------------------------");
|
||||
if (returnData == null) return "";
|
||||
return returnData.Uuid;
|
||||
}
|
||||
|
||||
private void bt_Sell_Click(object sender, EventArgs e)
|
||||
{
|
||||
var coinFullName = tb_CoinFullName.Text;
|
||||
|
||||
//만약 Price가 null or 빈값일 경우 현재가 구매
|
||||
var price = tb_Price.Text;
|
||||
|
||||
double.TryParse(tb_Volume.Text, out var volume);
|
||||
double.TryParse(price, out var priceData);
|
||||
|
||||
/// <summary>
|
||||
/// 판매하는 함수
|
||||
/// price가 0일 경우 지정가 판매
|
||||
/// return data는 총 판매 체결량임
|
||||
/// </summary>
|
||||
/// <param name="coinFullName"></param>
|
||||
/// <param name="volume"></param>
|
||||
/// <param name="price"></param>
|
||||
private double OrderSell(string coinFullName, string uuid, double price)
|
||||
{
|
||||
var side = UpbitOrderSide.ask;
|
||||
var ordType = UpbitOrderType.limit;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(price))
|
||||
if (price == 0)
|
||||
ordType = UpbitOrderType.market;
|
||||
|
||||
var returnData = CommonProperty.UpbitApi.TryOrder(coinFullName, side, volume, priceData, ordType);
|
||||
InsertLog("------------------------------------");
|
||||
InsertLog("Sell Return Data : " + JsonConvert.SerializeObject(returnData));
|
||||
InsertLog("------------------------------------");
|
||||
}
|
||||
#endregion
|
||||
// 판매시 Order Cancel 진행
|
||||
OrderCancel(coinFullName, uuid);
|
||||
|
||||
private void bt_Cancel_Click(object sender, EventArgs e)
|
||||
var orderData = CommonProperty.UpbitApi.GetOrderInformation(uuid);
|
||||
|
||||
// 못삿을 경우
|
||||
if (orderData.ExecutedVolume != 0)
|
||||
{
|
||||
var returnData = CommonProperty.UpbitApi.TryOrder(coinFullName, side, orderData.ExecutedVolume, price, InsertLog, ordType);
|
||||
|
||||
InsertLog("------------------------------------");
|
||||
InsertLog("Sell Return Data : " + JsonConvert.SerializeObject(returnData));
|
||||
InsertLog("------------------------------------");
|
||||
}
|
||||
return orderData.ExecutedVolume;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Order 취소 함수
|
||||
/// </summary>
|
||||
/// <param name="coinFullName"></param>
|
||||
/// <param name="uuid"></param>
|
||||
private void OrderCancel(string coinFullName, string uuid ="")
|
||||
{
|
||||
InsertLog("------------------------------------");
|
||||
InsertLog("Order Cancel");
|
||||
|
||||
foreach (var item in this.orderList)
|
||||
|
||||
var orderList = CommonProperty.UpbitApi.GetOrderListInformation(UpbitOrderListTypes.waitwatch, uuid);
|
||||
|
||||
foreach (var item in orderList)
|
||||
{
|
||||
if(item.State == "wait" || item.State == "watch")
|
||||
if (item.State == "wait" || item.State == "watch")
|
||||
{
|
||||
var returnData = CommonProperty.UpbitApi.CancelOrder(item.Uuid);
|
||||
InsertLog("Order Cancel Data : " + JsonConvert.SerializeObject(returnData));
|
||||
if(item.CoinFullName == coinFullName)
|
||||
{
|
||||
var returnData = CommonProperty.UpbitApi.CancelOrder(item.Uuid);
|
||||
InsertLog("Order Cancel Data : " + JsonConvert.SerializeObject(returnData));
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertLog("------------------------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// User 변경
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void cb_UserList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
//CommonProperty.ChangeUpbitApiKey.
|
||||
var flag = CommonProperty.ChangeUpbitApiKey(cb_UserList.Text);
|
||||
if (flag)
|
||||
{
|
||||
this.accounts = CommonProperty.UpbitApi.GetAccounts();
|
||||
|
||||
var list = this.accounts.Select(t => t.Currency).ToList();
|
||||
foreach (var item in list)
|
||||
cb_AccountList.Items.Add(item);
|
||||
}
|
||||
else
|
||||
MessageBox.Show("해당 사용자는 Key List에 존재하지 않습니다.");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Payment 변경
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void cb_AccountList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var account = this.accounts.FirstOrDefault(t => t.Currency == cb_AccountList.Text);
|
||||
if (account == null)
|
||||
{
|
||||
MessageBox.Show("해당 사용자의 Account가 정상적이지 않습니다.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var subStr = "원";
|
||||
if (cb_AccountList.Text == "KRW")
|
||||
{
|
||||
this.payment = PaymentType.KRW;
|
||||
}
|
||||
else if (cb_AccountList.Text == "BTC")
|
||||
{
|
||||
this.payment = PaymentType.BTC;
|
||||
subStr = "Bit Coin";
|
||||
}
|
||||
else if (cb_AccountList.Text == "USDT")
|
||||
{
|
||||
this.payment = PaymentType.USDT;
|
||||
subStr = "USDT";
|
||||
}
|
||||
lb_TotalMoney.Text = account.Balance.ToString() + subStr;
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_BuyStop_Click(object sender, EventArgs e)
|
||||
{
|
||||
buyFlag = false;
|
||||
lb_BuyFlag.Text = "매수 정지";
|
||||
}
|
||||
|
||||
private void bt_BuyStart_Click(object sender, EventArgs e)
|
||||
{
|
||||
buyFlag = true;
|
||||
lb_BuyFlag.Text = "매수 진행 중";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
<EmbeddedResource Include="HunterMainForm.resx">
|
||||
<DependentUpon>HunterMainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -158,9 +158,9 @@ namespace Million_Prototype
|
||||
//사고 파는 rex 데이터 가져오는 부분
|
||||
var buyRex = savedResultData.BuyRegularExpression;
|
||||
var sellRex = savedResultData.SellRegularExpression;
|
||||
var buyScript = new InteratorScripter();
|
||||
var buyScript = new InteratorScripter("");
|
||||
buyScript.regularExpressionString = buyRex;
|
||||
var sellScript = new InteratorScripter();
|
||||
var sellScript = new InteratorScripter("");
|
||||
sellScript.regularExpressionString = sellRex;
|
||||
|
||||
//save 데이터
|
||||
@@ -844,7 +844,7 @@ namespace Million_Prototype
|
||||
ss123 = aa1.Except(aa4);
|
||||
|
||||
|
||||
InteratorScripter ss = new InteratorScripter();
|
||||
InteratorScripter ss = new InteratorScripter("");
|
||||
ss.regularExpressionString = aa;
|
||||
|
||||
ss.DicExcuteScript(aa1);
|
||||
|
||||
@@ -22,16 +22,41 @@ namespace Million
|
||||
public static string accessKey = "FIkdR3xF4AxJpCI16xaM6qzQkVkFeQPBNONDDMtg";
|
||||
public static string secretKey = "Uk8iulXofcfw8EJvWY6WMoHsmWZ5GWHZ2d5uycli";
|
||||
|
||||
/*
|
||||
* Key List는 어떻게 관리할 지 얘기 후 처리
|
||||
public static string kyhAccessKey = "FIkdR3xF4AxJpCI16xaM6qzQkVkFeQPBNONDDMtg";
|
||||
public static string kyhSecretKey = "Uk8iulXofcfw8EJvWY6WMoHsmWZ5GWHZ2d5uycli";
|
||||
*/
|
||||
public static Dictionary<string, Dictionary<string, string>> keyList = new Dictionary<string, Dictionary<string, string>>
|
||||
{
|
||||
{ "이장화", new Dictionary<string, string>()
|
||||
{
|
||||
{ "accessKey", "qzhqT9zrwdziVNZMelLoPmCQHVky6PiXDPGtEYIA" },
|
||||
{"secretKey", "tK6yCtFxCbyAte20NNitbzL8z0LiSokxaldjkWSf" }
|
||||
}
|
||||
},
|
||||
{ "김영호", new Dictionary<string, string>()
|
||||
{
|
||||
{ "accessKey", "FIkdR3xF4AxJpCI16xaM6qzQkVkFeQPBNONDDMtg" },
|
||||
{"secretKey", "Uk8iulXofcfw8EJvWY6WMoHsmWZ5GWHZ2d5uycli" }
|
||||
}
|
||||
},
|
||||
{ "이찬균", new Dictionary<string, string>()
|
||||
{
|
||||
{ "accessKey", "nYnlB1pdmK72jUSTDG9BilrjZukxcIxR8wao43cW" },
|
||||
{"secretKey", "IOqoTIVp0N7DhTsdUQRv4lZFNQSba3IExx9zbyP0" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static UpbitAPI UpbitApi = new UpbitAPI(accessKey, secretKey);
|
||||
|
||||
public static void ChangeUpbitApiKey(string accessKey, string secretKey)
|
||||
public static bool ChangeUpbitApiKey(string key)
|
||||
{
|
||||
UpbitApi = new UpbitAPI(accessKey, secretKey);
|
||||
if (keyList.ContainsKey(key))
|
||||
{
|
||||
var data = keyList[key];
|
||||
if (string.IsNullOrWhiteSpace(data["accessKey"]) || string.IsNullOrWhiteSpace(data["secretKey"]))
|
||||
return false;
|
||||
UpbitApi = new UpbitAPI(data["accessKey"], data["secretKey"]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -289,9 +314,6 @@ namespace Million
|
||||
public static List<MarketData> selectedMarketOfPlaceList { get; set; } = null;
|
||||
public static List<MarketData> recentlyMarketOfPlaceList = null;
|
||||
|
||||
// RealTime Data Save Flag
|
||||
public static bool RealTimeFlag { get; set; } = true;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sell Logic Key List
|
||||
|
||||
@@ -10,5 +10,8 @@ namespace Million.Data
|
||||
public MarketData ConGoodsData { get; set; } = new MarketData();
|
||||
// 캔들 데이터 (1분)
|
||||
public List<CandleData> CandleDataLists_Im { get; set; } = new List<CandleData>();
|
||||
//uuid -> 추후 List로 변경 할 수 잇음
|
||||
public string Uuid { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -13,6 +15,9 @@ namespace Million.Data.Upbit
|
||||
public class Ticker
|
||||
{
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Market Id
|
||||
/// </summary>
|
||||
@@ -118,5 +123,51 @@ namespace Million.Data.Upbit
|
||||
/// </summary>
|
||||
public DateTime LowstPriceDateOf52Week { get; set; }
|
||||
|
||||
public object DeepClone(object obj)
|
||||
{
|
||||
object objResult = null;
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var bf = new BinaryFormatter();
|
||||
bf.Serialize(ms, obj);
|
||||
|
||||
ms.Position = 0;
|
||||
objResult = bf.Deserialize(ms);
|
||||
}
|
||||
|
||||
return objResult;
|
||||
}
|
||||
|
||||
public Ticker Clone()
|
||||
{
|
||||
var ticker = new Ticker();
|
||||
|
||||
ticker.DateTime = DateTime;
|
||||
ticker.CoinFullName = CoinFullName;
|
||||
ticker.TradeDateTime = TradeDateTime;
|
||||
ticker.OpeningPrice = OpeningPrice;
|
||||
ticker.HighPrice = HighPrice;
|
||||
ticker.LowPrice = LowPrice;
|
||||
ticker.TradePrice = TradePrice;
|
||||
ticker.BeforeDayClosePrice = BeforeDayClosePrice;
|
||||
ticker.TrendType = TrendType;
|
||||
ticker.AbsoluteChangePrice = AbsoluteChangePrice;
|
||||
ticker.AbsoluteChangeRate = AbsoluteChangeRate;
|
||||
ticker.SignedChangePrice = SignedChangePrice;
|
||||
ticker.SignedChangeRate = SignedChangeRate;
|
||||
ticker.TradeVolume = TradeVolume;
|
||||
ticker.AccumulateTradePrice = AccumulateTradePrice;
|
||||
ticker.AccumulateTradePrice24 = AccumulateTradePrice24;
|
||||
ticker.AccumulateTradeVolume = AccumulateTradeVolume;
|
||||
ticker.AccumulateTradeVolume24 = AccumulateTradeVolume24;
|
||||
ticker.HighstPriceOf52Week = HighstPriceOf52Week;
|
||||
ticker.HighstPriceDateOf52Week = HighstPriceDateOf52Week;
|
||||
ticker.LowstPriceOf52Week = LowstPriceOf52Week;
|
||||
ticker.LowstPriceDateOf52Week = LowstPriceDateOf52Week;
|
||||
|
||||
return ticker;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,50 +273,7 @@ namespace Million.DbManagement
|
||||
conn.Close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool QueryInsertExcuter_VerifyTickerData(string sqlQuery, List<Ticker> tickers)
|
||||
{
|
||||
var baBinaryFormatter = new BinaryFormatter();
|
||||
var strDBCon = CommonProperty.DbConnectionResultData;
|
||||
|
||||
SqlConnection conn = null;
|
||||
SqlDataReader rdr = null;
|
||||
|
||||
try
|
||||
{
|
||||
using (conn = new SqlConnection(strDBCon))
|
||||
{
|
||||
using (var cmd = new SqlCommand(sqlQuery, conn))
|
||||
{
|
||||
var tickersStream = new MemoryStream();
|
||||
baBinaryFormatter.Serialize(tickersStream, tickers);
|
||||
tickersStream.Position = 0;
|
||||
|
||||
|
||||
cmd.Parameters.Add("@tickers", SqlDbType.VarBinary, (int)tickersStream.Length).Value = tickersStream.ToArray();
|
||||
|
||||
conn.Open();
|
||||
using (rdr = cmd.ExecuteReader())
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
conn.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(" ============= exception ===============");
|
||||
Console.WriteLine(e.Message);
|
||||
if (rdr != null)
|
||||
rdr.Close();
|
||||
if (conn != null)
|
||||
conn.Close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// insert RealTimeIndicator
|
||||
@@ -523,7 +480,11 @@ namespace Million.DbManagement
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SavedAnaylysis Data List 가져오는 함수(SavedResult Data 분석본)
|
||||
/// </summary>
|
||||
/// <param name="resultIdList"></param>
|
||||
/// <returns></returns>
|
||||
public static List<SavedAnalysisData> QueryGetExcuter_SavedAnalysisData(List<int> resultIdList)
|
||||
{
|
||||
var returnData = new List<SavedAnalysisData>();
|
||||
@@ -600,6 +561,10 @@ namespace Million.DbManagement
|
||||
|
||||
return returnData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 실시간 Indicator 가져오는 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Dictionary<string, object>> QueryGetExcuter_RealTimeIndicator()
|
||||
{
|
||||
var returnData = new List<Dictionary<string, object>>();
|
||||
|
||||
@@ -82,19 +82,6 @@ namespace Million.DbManagement
|
||||
)";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 임시 Ticker 데이터 DB 검증용
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string CreateVerifyTickerDataTableQuery()
|
||||
{
|
||||
return @"if not exists (select * from sysobjects where name='VerifyTickerData' and xtype='U')
|
||||
create table " + "\"VerifyTickerData\"" + @"(
|
||||
SavedDateTime datetime NOT NULL,
|
||||
data varbinary(MAX) NULL
|
||||
)";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DB Market 테이블 생성
|
||||
/// </summary>
|
||||
@@ -320,36 +307,36 @@ namespace Million.DbManagement
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 1분단위
|
||||
/// </summary>
|
||||
public static void InserRealTimeDataOneMThread(object marketObj)
|
||||
{
|
||||
var marketList = (List<MarketData>)marketObj;
|
||||
var recentlyDbDataList = GetOldNewDataList_FromDB
|
||||
(marketList, "Upbit", (MCandleTimeType.M1));
|
||||
///// <summary>
|
||||
///// 1분단위
|
||||
///// </summary>
|
||||
//public static void InserRealTimeDataOneMThread(object marketObj)
|
||||
//{
|
||||
// var marketList = (List<MarketData>)marketObj;
|
||||
// var recentlyDbDataList = GetOldNewDataList_FromDB
|
||||
// (marketList, "Upbit", (MCandleTimeType.M1));
|
||||
|
||||
//기존의 누락된 데이터 쌓기
|
||||
while (CommonProperty.RealTimeFlag)
|
||||
{
|
||||
var flag = SetCandleData("Upbit", ExchangeWebReqType.UpbitCandleStick, recentlyDbDataList);
|
||||
// //기존의 누락된 데이터 쌓기
|
||||
// while (CommonProperty.RealTimeFlag)
|
||||
// {
|
||||
// var flag = SetCandleData("Upbit", ExchangeWebReqType.UpbitCandleStick, recentlyDbDataList);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
var date = DateTime.Now;
|
||||
if (date.Second < 60)
|
||||
{
|
||||
var temp = 60 - date.Second;
|
||||
Thread.Sleep(temp * 1000);
|
||||
recentlyDbDataList = GetOldNewDataList_FromDB(marketList, "Upbit", (MCandleTimeType.M1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
recentlyDbDataList = GetOldNewDataList_FromDB(marketList, "Upbit", (MCandleTimeType.M1));
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (flag)
|
||||
// {
|
||||
// var date = DateTime.Now;
|
||||
// if (date.Second < 60)
|
||||
// {
|
||||
// var temp = 60 - date.Second;
|
||||
// Thread.Sleep(temp * 1000);
|
||||
// recentlyDbDataList = GetOldNewDataList_FromDB(marketList, "Upbit", (MCandleTimeType.M1));
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// recentlyDbDataList = GetOldNewDataList_FromDB(marketList, "Upbit", (MCandleTimeType.M1));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 최신값, 가장오래된 값을 기준으로 Data 호출 및 처리
|
||||
|
||||
@@ -64,12 +64,12 @@ namespace Million.IndicatorConditionSetup
|
||||
//key 형태 변경(index + 기존키)
|
||||
var bolKeyName = GetKeyName();
|
||||
int i = 0;
|
||||
if(last)
|
||||
if (last)
|
||||
{
|
||||
if (data.Count() < Period)
|
||||
return;
|
||||
|
||||
if(data[data.Count()-2].IndicatorDic.ContainsKey(bolKeyName))
|
||||
if (data[data.Count() - 2].IndicatorDic.ContainsKey(bolKeyName))
|
||||
{
|
||||
단일볼렌저(data, data.Count() - 1);
|
||||
return;
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Million.IndicatorConditionSetup
|
||||
|
||||
for (; dataIndex < dataCount; dataIndex++)
|
||||
{
|
||||
var saveIndex = dataIndex + Displacement;
|
||||
var saveIndex = dataIndex + Displacement-1;
|
||||
if (saveIndex >= dataCount)
|
||||
continue;
|
||||
var tempIchi = new IchimokData();
|
||||
@@ -142,7 +142,7 @@ namespace Million.IndicatorConditionSetup
|
||||
if (index - period + 1 < 0)
|
||||
return 0;
|
||||
var minmaxDatas = data.GetRange(index - period + 1, period);
|
||||
return (minmaxDatas.Max(t => t.EndValue) + minmaxDatas.Min(t => t.EndValue)) / 2;
|
||||
return (minmaxDatas.Max(t => t.HighValue) + minmaxDatas.Min(t => t.LowValue)) / 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Million.Data;
|
||||
using Million.DbManagement;
|
||||
using Million.IndicatorConditionSetup;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,7 +16,7 @@ namespace Million.Manager
|
||||
/// </summary>
|
||||
public static class CalculateManager
|
||||
{
|
||||
public static InteratorScripter subScript = new InteratorScripter();
|
||||
public static InteratorScripter subScript = new InteratorScripter("최초 돌파 Sub Script");
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -126,6 +127,9 @@ namespace Million.Manager
|
||||
{
|
||||
if (!flag.Value)
|
||||
{
|
||||
if (flag.Key.CompareTo(conditionStr) == 0)
|
||||
return 0;
|
||||
|
||||
var flagIndex = conditionStr.IndexOf(flag.Key);
|
||||
|
||||
//존재함
|
||||
@@ -342,7 +346,7 @@ namespace Million.Manager
|
||||
//단순비교
|
||||
else if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.단순비교)
|
||||
{
|
||||
SimpleComparison(setUp, parentCandleDataList, childrenCandleDataList, recentlyDataFlag);
|
||||
SimpleComparison(setUp, parentCandleDataList, childrenCandleDataList, recentlyDataFlag, coinFullName);
|
||||
}
|
||||
//최초돌파
|
||||
else if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.최초돌파)
|
||||
@@ -570,6 +574,11 @@ namespace Million.Manager
|
||||
var key = GetKeyData(setUp);
|
||||
if (key == null) return;
|
||||
|
||||
var subIndi = totalIndicators.FirstOrDefault(t => t.IndexString == setUp.FirstOverSubRegExpression);
|
||||
if (subIndi == null) return;
|
||||
var subKey = GetKeyData(subIndi);
|
||||
|
||||
|
||||
/**
|
||||
* 최초 돌파 내용
|
||||
* 1. Sub 정규식에서 True되는 시점 찾기
|
||||
@@ -593,6 +602,8 @@ namespace Million.Manager
|
||||
foreach (var parent in parentCandleDataList)
|
||||
{
|
||||
var dic = parent.CalculateFlag;
|
||||
|
||||
var val = GetValueData(subIndi, parent, subKey);
|
||||
|
||||
//Sub 조건 만족 여부
|
||||
if (subScript.DicExcuteScript(dic))
|
||||
@@ -602,48 +613,102 @@ namespace Million.Manager
|
||||
else
|
||||
{
|
||||
subFlag = false;
|
||||
firstFlag = false;
|
||||
if (recentlyDataFlag)
|
||||
subManagement[coinFullName] = true;
|
||||
var str = "";
|
||||
|
||||
if(val < parent.EndValue)
|
||||
{
|
||||
str = coinFullName + " Sub 조건 Error 발생\r\n";
|
||||
str += "parent : " + JsonConvert.SerializeObject(parent) + "\r\n";
|
||||
LogManager.WriteLog(str, coinFullName);
|
||||
LogManager.WriteLog(coinFullName + " ERROR 발생 함");
|
||||
}
|
||||
|
||||
if (recentlyDataFlag)
|
||||
{
|
||||
if (!subManagement[coinFullName])
|
||||
{
|
||||
str = "Buyer(Realtime) Mode\r\n";
|
||||
str += coinFullName + " 최초 돌파 Sub조건 초기화 됨\r\n";
|
||||
str += JsonConvert.SerializeObject(parent) + "\r\n";
|
||||
LogManager.WriteLog(str, coinFullName);
|
||||
}
|
||||
subManagement[coinFullName] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
var overlapData = GetOverlapValueData(setUp, parent, key);
|
||||
if (overlapData == 0) continue;
|
||||
|
||||
var valDic = ResultLogicManager.GetIndicateValue(dic, totalIndicators, parent);
|
||||
var subVal = GetConditionValue(subScript.regularExpressionString, valDic, dic);
|
||||
if (subVal == 0) continue;
|
||||
|
||||
|
||||
//sub 조건이 만족할 경우
|
||||
if (subFlag)
|
||||
{
|
||||
if(recentlyDataFlag)
|
||||
if (recentlyDataFlag)
|
||||
if (!subManagement[coinFullName]) continue;
|
||||
|
||||
var overlapData = GetOverlapValueData(setUp, parent, key);
|
||||
|
||||
if (overlapData == 0) continue;
|
||||
|
||||
if (upperMainIndicatorFlag)
|
||||
{
|
||||
var valDic = ResultLogicManager.GetIndicateValue(dic, totalIndicators, parent);
|
||||
var subVal = GetConditionValue(subScript.regularExpressionString, valDic, dic);
|
||||
if (subVal == 0) continue;
|
||||
if (overlapData < subVal) continue;
|
||||
}
|
||||
|
||||
//최초 시점이 아닐 경우
|
||||
if (!firstFlag)
|
||||
//TODO Tick 차이 관련 조건 식 추가 예정
|
||||
//최초로 매수, 매도 진행 시 사전 조건과의 Tick거리를 예외할 수 있어야 함
|
||||
//OverlapValue는 사야할 데이터, beforeIndiValue는 사전 데이터
|
||||
if (!GetTickDifferenceCount(overlapData, subVal, 3, coinFullName)) continue;
|
||||
|
||||
//최초 시점이 아닐 경우
|
||||
if ((subManagement != null && subManagement[coinFullName]) || !firstFlag)
|
||||
{
|
||||
if (!parent.IndicatorDic.ContainsKey(key)) continue;
|
||||
|
||||
|
||||
var enumList = setUp.OverStatusEnumList;
|
||||
if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.최초돌파) enumList = setUp.OverStatusEnumListFirstOver;
|
||||
|
||||
|
||||
if (enumList.Any(t => t == parent.IndicatorDic[key].overStatus))
|
||||
{
|
||||
GetTranspierceData(parent, childrenCandleDataList, setUp, overlapData, key, true);
|
||||
firstFlag = true;
|
||||
if (recentlyDataFlag)
|
||||
|
||||
if (recentlyDataFlag)
|
||||
subManagement[coinFullName] = false;
|
||||
else
|
||||
firstFlag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// value 두개 비교하며 Ticker 처리
|
||||
/// </summary>
|
||||
/// <param name="standardValue"></param>
|
||||
/// <param name="compareValue"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GetTickDifferenceCount(double standardValue, double compareValue, int tickCount, string coinFullName)
|
||||
{
|
||||
var bigData = standardValue> compareValue ? standardValue : compareValue;
|
||||
var smallData = standardValue < compareValue ? standardValue : compareValue;
|
||||
|
||||
var calBigData = OrderbookManager.GetAskPrice(bigData, false);
|
||||
var calSamllData = OrderbookManager.GetAskPrice(smallData, false);
|
||||
|
||||
var count = 0;
|
||||
while (true)
|
||||
{
|
||||
if (calBigData <= calSamllData)
|
||||
break;
|
||||
calSamllData += 0.0001;
|
||||
calSamllData = OrderbookManager.GetAskPrice(calSamllData);
|
||||
count++;
|
||||
}
|
||||
var returnData = tickCount <= count;
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -780,7 +845,7 @@ namespace Million.Manager
|
||||
/// <param name="setUp"></param>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
public static void SimpleComparison(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList, bool recentlyDataFlag)
|
||||
public static void SimpleComparison(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList, bool recentlyDataFlag, string coinFullName)
|
||||
{
|
||||
//비교할 데이터 Key 설정
|
||||
var key = GetKeyData(setUp);
|
||||
@@ -795,9 +860,31 @@ namespace Million.Manager
|
||||
|
||||
if (value == 0 || overlapData == 0) continue;
|
||||
|
||||
var compareFlag = false;
|
||||
|
||||
if (CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, value))
|
||||
//헌터 일경우
|
||||
|
||||
if (setUp.CandlePriceType == CandlePriceType.종가)
|
||||
{
|
||||
if (!recentlyDataFlag)
|
||||
{
|
||||
var highFlag = CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, item.HighValue);
|
||||
var lowFlag = CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, item.LowValue);
|
||||
if (highFlag || lowFlag) compareFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
compareFlag = CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
compareFlag = CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, value);
|
||||
}
|
||||
|
||||
if (compareFlag)
|
||||
{
|
||||
item.CalculateFlag[setUp.IndexString] = true;
|
||||
var childList = new List<CandleData>();
|
||||
if (item.CandleTimeType == (int)MCandleTimeType.M1)
|
||||
{
|
||||
@@ -824,6 +911,7 @@ namespace Million.Manager
|
||||
foreach (var child in childList)
|
||||
{
|
||||
child.CalculateFlag[setUp.IndexString] = true;
|
||||
|
||||
if (child.IndicatorDic.ContainsKey(key))
|
||||
child.IndicatorDic[key].overlapValue = value;
|
||||
else
|
||||
@@ -845,9 +933,18 @@ namespace Million.Manager
|
||||
var lowVal = child.LowValue;
|
||||
var highVal = child.HighValue;
|
||||
|
||||
if (lowVal == 0 || highVal == 0)
|
||||
continue;
|
||||
|
||||
var lowFlag = CompareSettingValueOfSimpleComparison(setUp.IndicatorOver, overlapData, lowVal);
|
||||
var highFlag = CompareSettingValueOfSimpleComparison(setUp.IndicatorOver, overlapData, highVal);
|
||||
|
||||
if (!child.IndicatorDic.ContainsKey(key))
|
||||
{
|
||||
child.IndicatorDic[key] = new IndicatorData();
|
||||
child.IndicatorDic[key] = item.IndicatorDic[key];
|
||||
}
|
||||
|
||||
if (lowFlag || highFlag)
|
||||
{
|
||||
child.CalculateFlag[setUp.IndexString] = true;
|
||||
@@ -862,32 +959,30 @@ namespace Million.Manager
|
||||
if (highVal < overlapData) childValue = highVal;
|
||||
}
|
||||
|
||||
if (child.IndicatorDic.ContainsKey(key))
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
else
|
||||
{
|
||||
child.IndicatorDic[key] = new IndicatorData();
|
||||
child.IndicatorDic[key] = item.IndicatorDic[key];
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
}
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var childValue = GetValue(item, setUp);
|
||||
if (childValue == 0)
|
||||
continue;
|
||||
|
||||
var flag = CompareSettingValueOfSimpleComparison(setUp.IndicatorOver, overlapData, childValue);
|
||||
|
||||
if (child.IndicatorDic.ContainsKey(key))
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
else
|
||||
{
|
||||
child.IndicatorDic[key] = new IndicatorData();
|
||||
child.IndicatorDic[key] = item.IndicatorDic[key];
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
child.CalculateFlag[setUp.IndexString] = true;
|
||||
|
||||
if (child.IndicatorDic.ContainsKey(key))
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
else
|
||||
{
|
||||
child.IndicatorDic[key] = new IndicatorData();
|
||||
child.IndicatorDic[key] = item.IndicatorDic[key];
|
||||
child.IndicatorDic[key].overlapValue = childValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -931,7 +1026,7 @@ namespace Million.Manager
|
||||
}
|
||||
}
|
||||
}
|
||||
item.CalculateFlag[setUp.IndexString] = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -946,14 +1041,14 @@ namespace Million.Manager
|
||||
{
|
||||
if (type == CommonProperty.Indicator_over.아래)
|
||||
{
|
||||
if (overlapData > value)
|
||||
if (overlapData >= value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (type == CommonProperty.Indicator_over.위)
|
||||
{
|
||||
if (overlapData < value)
|
||||
if (overlapData <= value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -974,14 +1069,14 @@ namespace Million.Manager
|
||||
{
|
||||
if (type == CommonProperty.Indicator_over.아래)
|
||||
{
|
||||
if (overlapData > value)
|
||||
if (overlapData >= value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (type == CommonProperty.Indicator_over.위)
|
||||
{
|
||||
if (overlapData < value)
|
||||
if (overlapData <= value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1071,6 +1166,7 @@ namespace Million.Manager
|
||||
private static double GetValue(CandleData data, IndicatorCoditionSetup setUp)
|
||||
{
|
||||
double value = 0;
|
||||
|
||||
if (setUp.CandlePriceType == CommonProperty.CandlePriceType.시가)
|
||||
{
|
||||
value = data.StartValue;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Million.Manager
|
||||
|
||||
// Sub Indicator Class
|
||||
var subIndicator = totalIndicators.Where(t => subIndStringList.Any(u => u == t.IndexString)).ToList();
|
||||
|
||||
|
||||
// 선처리
|
||||
CalculateManager.GetCalculateIndicator(totalIndicators, subIndStringList, null, startDate,
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag, upperMainIndicatorFlag, coinFullName);
|
||||
@@ -110,19 +110,7 @@ namespace Million.Manager
|
||||
|
||||
// 후처리
|
||||
CalculateManager.GetCalculateIndicator(totalIndicators, totalIndi, null, startDate,
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag, upperMainIndicatorFlag, coinFullName);
|
||||
|
||||
|
||||
// Parent Recently Data는 indicator에 따라 달라질수 있으므로 전부다 처리한 후 초기화
|
||||
if (recentlyDataFlag)
|
||||
foreach (var data in dic)
|
||||
{
|
||||
var recentlyList = data.Value.Where(t => t.RecentlyDataFlag).ToList();
|
||||
|
||||
foreach (var recentlyItem in recentlyList)
|
||||
recentlyItem.RecentlyDataFlag = false;
|
||||
}
|
||||
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag, upperMainIndicatorFlag, coinFullName);
|
||||
return dic;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.CodeAnalysis.CSharp.Scripting;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,33 +14,86 @@ namespace Million.Manager
|
||||
/// C# 코드기준으로 스크립팅 해줌
|
||||
/// </summary>
|
||||
public string regularExpressionString;
|
||||
public string Name;
|
||||
|
||||
/// <summary>
|
||||
/// 캐쉬 Dictionary
|
||||
/// </summary>
|
||||
private Dictionary<Dictionary<string, bool>,bool> rememberDic = new Dictionary<Dictionary<string, bool>, bool>();
|
||||
private Dictionary<Dictionary<string, bool>, bool> rememberDic = null;
|
||||
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public InteratorScripter(string Name)
|
||||
{
|
||||
rememberDic = new Dictionary<Dictionary<string, bool>, bool>();
|
||||
this.Name = Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="RegularExpression"></param>
|
||||
/// <returns></returns>
|
||||
public bool DicExcuteScript(Dictionary<string,bool> RegularExpression)
|
||||
public bool DicExcuteScript(Dictionary<string, bool> RegularExpression)
|
||||
{
|
||||
try {
|
||||
//중복 검사
|
||||
var data = rememberDic.Keys.FirstOrDefault(x => !x.Except(RegularExpression).Any());
|
||||
if (data != null)
|
||||
var cloneRex = RegularExpression.ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
try
|
||||
{
|
||||
return rememberDic[data];
|
||||
//중복 검사
|
||||
Dictionary<string, bool> data = null;
|
||||
|
||||
foreach(var key in rememberDic.Keys)
|
||||
{
|
||||
bool checker = true;
|
||||
if(key.Count == cloneRex.Count)
|
||||
{
|
||||
foreach(var keyStr in key.Keys)
|
||||
{
|
||||
if(cloneRex.ContainsKey(keyStr))
|
||||
{
|
||||
if (key[keyStr] != cloneRex[keyStr])
|
||||
checker = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
checker = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
checker = false;
|
||||
}
|
||||
|
||||
if(checker)
|
||||
{
|
||||
data = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (data != null)
|
||||
{
|
||||
return rememberDic[data];
|
||||
}
|
||||
else
|
||||
{
|
||||
var returnData = ScriptExcute(ChangeScript(regularExpressionString, cloneRex));
|
||||
rememberDic[cloneRex] = returnData;
|
||||
|
||||
var str = "Name : " + Name +",\r\nregularExpressionString : " + regularExpressionString + ",\r\n RegularExpression : "
|
||||
+ JsonConvert.SerializeObject(cloneRex) + ",\r\n Result : " + returnData.ToString()
|
||||
+ ",\r\n RememberDic : " + JsonConvert.SerializeObject(rememberDic) + "\r\n";
|
||||
|
||||
LogManager.WriteLog(str);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
return rememberDic[RegularExpression] = ScriptExcute(ChangeScript(regularExpressionString, RegularExpression));
|
||||
}
|
||||
}catch(Exception e)
|
||||
{
|
||||
return ScriptExcute(ChangeScript(regularExpressionString, RegularExpression));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,64 +131,63 @@ namespace Million.Manager
|
||||
catch(Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ScriptExcute111(string regString)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = CSharpScript.EvaluateAsync(regString);
|
||||
result.ToString();
|
||||
//public static void ScriptExcute111(string regString)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var result = CSharpScript.EvaluateAsync(regString);
|
||||
// result.ToString();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString();
|
||||
}
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// ex.ToString();
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 문자열값을 스크립트 돌림, 실패시 0 반환
|
||||
/// </summary>
|
||||
/// <param name="regString"></param>
|
||||
/// <returns></returns>
|
||||
public static double ScriptExcuteDouble(string regString)
|
||||
{
|
||||
try
|
||||
{
|
||||
return CSharpScript.EvaluateAsync<double>(regString).Result;
|
||||
///// <summary>
|
||||
///// 문자열값을 스크립트 돌림, 실패시 0 반환
|
||||
///// </summary>
|
||||
///// <param name="regString"></param>
|
||||
///// <returns></returns>
|
||||
//public static double ScriptExcuteDouble(string regString)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// return CSharpScript.EvaluateAsync<double>(regString).Result;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// ex.ToString();
|
||||
// }
|
||||
// return 0.0;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dataList"></param>
|
||||
public static void ScriptExcute(Dictionary<string,bool> dataList)
|
||||
{
|
||||
string exKey;
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="dataList"></param>
|
||||
//public static void ScriptExcute(Dictionary<string,bool> dataList)
|
||||
//{
|
||||
// string exKey;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var data in dataList)
|
||||
{
|
||||
exKey = data.Key;
|
||||
dataList[data.Key] = CSharpScript.EvaluateAsync<bool>(data.Key).Result;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
ex.ToString();
|
||||
}
|
||||
}
|
||||
// try
|
||||
// {
|
||||
// foreach (var data in dataList)
|
||||
// {
|
||||
// exKey = data.Key;
|
||||
// dataList[data.Key] = CSharpScript.EvaluateAsync<bool>(data.Key).Result;
|
||||
// }
|
||||
// }
|
||||
// catch(Exception ex)
|
||||
// {
|
||||
// ex.ToString();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
59
Million/Manager/LogManager.cs
Normal file
59
Million/Manager/LogManager.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Million.Manager
|
||||
{
|
||||
/// <summary>
|
||||
/// Log Manager
|
||||
/// </summary>
|
||||
public static class LogManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Lock 관련 Field
|
||||
/// </summary>
|
||||
private static readonly object padlock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Insert Log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="coinFullName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool WriteLog(string message, string coinFullName = "")
|
||||
{
|
||||
if (coinFullName == "") coinFullName = "common";
|
||||
var returnData = true;
|
||||
var defaultMesage = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "=>" + message +"\r\n";
|
||||
var dirPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\"));
|
||||
dirPath = dirPath + "\\Log";
|
||||
var filePath = dirPath + "\\" + DateTime.Now.ToString("yyyyMMdd") + "_" + coinFullName + ".txt";
|
||||
lock (padlock)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!System.IO.Directory.Exists(dirPath))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(dirPath);
|
||||
}
|
||||
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
System.IO.File.Create(filePath).Close();
|
||||
}
|
||||
|
||||
System.IO.File.AppendAllText(filePath, defaultMesage);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
returnData = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Million.Manager
|
||||
public static double GetAskPrice(double value, bool upDown = true)
|
||||
{
|
||||
double priceUnit = 0;
|
||||
|
||||
var originVal = value;
|
||||
switch(value)
|
||||
{
|
||||
case double n when(0<= n && n< 0.1):
|
||||
@@ -69,7 +69,8 @@ namespace Million.Manager
|
||||
|
||||
if (upDown)
|
||||
{
|
||||
value += priceUnit;
|
||||
if(originVal != value)
|
||||
value += priceUnit;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Million.Manager
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public RealtimeDataSettingManager(List<string> coinFullNameList, PaymentType buyType, string tableName = "Upbit")
|
||||
{
|
||||
{
|
||||
this.buyType = buyType;
|
||||
marketList = DbServiceFunctions.GetMarketDatas(tableName, Enum.GetName(typeof(PaymentType), buyType));
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Million.Manager
|
||||
|
||||
//TODO Market ignore 처리 필요 -> 임시로 비트토랜트만 삭제
|
||||
this.coinFullNameList.Remove("KRW-BTT");
|
||||
if(CommonProperty.selectedMarketOfPlaceList !=null)
|
||||
if (CommonProperty.selectedMarketOfPlaceList != null)
|
||||
CommonProperty.selectedMarketOfPlaceList.Remove(selectedMarketOfPlaceList.FirstOrDefault(t => t.CoinFullName == "KRW-BTT"));
|
||||
if (CommonProperty.recentlyMarketOfPlaceList != null)
|
||||
CommonProperty.recentlyMarketOfPlaceList.Remove(recentlyMarketOfPlaceList.FirstOrDefault(t => t.CoinFullName == "KRW-BTT"));
|
||||
@@ -87,7 +87,7 @@ namespace Million.Manager
|
||||
{
|
||||
var val = new CandleDataList();
|
||||
val.ConGoodsData = marketList.FirstOrDefault(t => t.CoinFullName == item);
|
||||
val.CandleDataLists_Im = CommonProperty.UpbitApi.GetCandleStics(item, timeType, basicDateTime, count).OrderBy(t => t.DateTime).ToList();
|
||||
val.CandleDataLists_Im = CommonProperty.UpbitApi.GetCandleStics(item, timeType, basicDateTime, count).OrderBy(t => t.DateTime).ToList();
|
||||
returnData.Add(val);
|
||||
Thread.Sleep(400);
|
||||
}
|
||||
@@ -103,21 +103,21 @@ namespace Million.Manager
|
||||
|
||||
this.timer.Dispose();
|
||||
this.timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.tc = new TimerCallback(TimerEvent); // 이벤트 발생 처리 루틴
|
||||
|
||||
//0.5초 마다 쌓는거 진행 -> DB데이터 가지고와서 부터 데이터 처리
|
||||
this.timer = new System.Threading.Timer(tc, null, 0, 1000);
|
||||
this.timer = new System.Threading.Timer(tc, null, 0, 500);
|
||||
flag = true;
|
||||
|
||||
}
|
||||
public void EndRealTimeTicker()
|
||||
{
|
||||
flag = false;
|
||||
if(timer != null)
|
||||
if (timer != null)
|
||||
{
|
||||
this.timer.Dispose();
|
||||
this.timer.Dispose();
|
||||
this.timer = null;
|
||||
|
||||
}
|
||||
@@ -156,182 +156,210 @@ namespace Million.Manager
|
||||
foreach (var type in types)
|
||||
{
|
||||
var candleList = candleDatas[type];
|
||||
Parallel.ForEach(candleList, item =>
|
||||
{
|
||||
//foreach (var item in candleList)
|
||||
//Parallel.ForEach(candleList, item =>
|
||||
//{
|
||||
if(item.CandleDataLists_Im.Count > 0)
|
||||
var tickList = new List<Ticker>();
|
||||
var cloneTickList = new List<Ticker>();
|
||||
lock (obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var item in tickerList)
|
||||
{
|
||||
cloneTickList.Add(item.Clone());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogManager.WriteLog(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in candleList)
|
||||
{
|
||||
if (item.CandleDataLists_Im.Count > 0)
|
||||
basicDateTime = item.CandleDataLists_Im.Select(t => t.DateTime).Max();
|
||||
|
||||
|
||||
var coinFullName = item.ConGoodsData.CoinFullName;
|
||||
List<Ticker> tickList = null;
|
||||
lock (obj)
|
||||
{
|
||||
tickList = tickerList.Where(t => t.CoinFullName == coinFullName && basicDateTime < t.DateTime).OrderBy(t => t.DateTime).ToList();
|
||||
}
|
||||
|
||||
tickList = cloneTickList.Where(t => t.CoinFullName == coinFullName).OrderBy(t=>t.DateTime).ToList();
|
||||
|
||||
// 호출 당시 시, 분, 초
|
||||
var callH = basicDateTime.Hour;
|
||||
var callM = basicDateTime.Minute;
|
||||
var callS = basicDateTime.Second;
|
||||
try {
|
||||
if (type == MCandleTimeType.M1)
|
||||
try
|
||||
{
|
||||
var equalMinuteList = tickList.Where(t => t.DateTime.Minute == callM).ToList();
|
||||
//해당 분 고가
|
||||
if (equalMinuteList.Count != 0)
|
||||
if (type == MCandleTimeType.M1)
|
||||
{
|
||||
var equalListM = equalMinuteList.Select(t => t.TradePrice).ToList();
|
||||
double equalListMax = 0;
|
||||
if (equalListM.Count != 0)
|
||||
var equalMinuteList = tickList.Where(t => t.DateTime.Minute == callM).ToList();
|
||||
|
||||
//해당 분 고가
|
||||
if (equalMinuteList.Count != 0)
|
||||
{
|
||||
equalListMax = equalListM.Max();
|
||||
}
|
||||
var equalListM = equalMinuteList.Select(t => t.TradePrice).ToList();
|
||||
double equalListMax = 0;
|
||||
if (equalListM.Count != 0)
|
||||
{
|
||||
equalListMax = equalListM.Max();
|
||||
}
|
||||
|
||||
//해당 분 저가
|
||||
var equalListL = equalMinuteList.Select(t => t.TradePrice).ToList();
|
||||
//해당 분 저가
|
||||
var equalListL = equalMinuteList.Select(t => t.TradePrice).ToList();
|
||||
|
||||
double equalListMin = 0;
|
||||
if (equalListL.Count != 0)
|
||||
double equalListMin = 0;
|
||||
if (equalListL.Count != 0)
|
||||
{
|
||||
equalListMin = equalListL.Min();
|
||||
}
|
||||
if (item.CandleDataLists_Im.Count != 0)
|
||||
{
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue < equalListMax && equalListMax != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue = equalListMax;
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue > equalListMin && equalListMin != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue = equalListMin;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].RecentlyDataFlag = true;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].EndValue = equalMinuteList[equalMinuteList.Count - 1].TradePrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.M1;
|
||||
candle.StartValue = equalMinuteList[0].TradePrice;
|
||||
candle.HighValue = equalListMax;
|
||||
candle.LowValue = equalListMin;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = equalMinuteList[equalMinuteList.Count - 1].TradePrice;
|
||||
var date = basicDateTime.AddMinutes(1);
|
||||
date = date.AddSeconds(-1 * callS);
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, item.CandleDataLists_Im.Count - 300);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
}
|
||||
}
|
||||
|
||||
var list = tickList.Where(t => t.DateTime > basicDateTime && t.DateTime.Minute != basicDateTime.Minute).ToList();
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
equalListMin = equalListL.Min();
|
||||
}
|
||||
if (item.CandleDataLists_Im.Count != 0)
|
||||
{
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue < equalListMax && equalListMax != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue = equalListMax;
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue > equalListMin && equalListMin != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue = equalListMin;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].RecentlyDataFlag = true;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].EndValue = equalMinuteList[equalMinuteList.Count - 1].TradePrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.M1;
|
||||
candle.StartValue = equalMinuteList[0].TradePrice;
|
||||
candle.HighValue = equalListMax;
|
||||
candle.LowValue = equalListMin;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = equalMinuteList[equalMinuteList.Count - 1].TradePrice;
|
||||
var date = basicDateTime.AddMinutes(1);
|
||||
date.AddSeconds(-1 * callS);
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, item.CandleDataLists_Im.Count - 300);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
// 데이터 가져올떄 1분 이상 걸릴 시 처리할 데이터
|
||||
var minList = list.Select(t => t.DateTime.Minute).Distinct().ToList();
|
||||
minList.Sort();
|
||||
|
||||
foreach (var min in minList)
|
||||
{
|
||||
var equalList = list.Where(t => t.DateTime.Minute == min).OrderBy(t => t.DateTime).ToList();
|
||||
|
||||
//해당 분 고가
|
||||
var max = equalList.Select(t => t.TradePrice).ToList().Max();
|
||||
//해당 분 저가
|
||||
var low = equalList.Select(t => t.TradePrice).ToList().Min();
|
||||
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.M1;
|
||||
candle.StartValue = equalList[0].TradePrice;
|
||||
candle.HighValue = max;
|
||||
candle.LowValue = low;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = equalList[equalList.Count - 1].TradePrice;
|
||||
|
||||
var intervalMin = min - callM;
|
||||
|
||||
var date = basicDateTime.AddMinutes(intervalMin);
|
||||
if(intervalMin < 0) date = date.AddHours(1);
|
||||
|
||||
date = date.AddSeconds(-1 * callS);
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, item.CandleDataLists_Im.Count - 300);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
var list = tickList.Where(t => t.DateTime.Minute != callM).ToList();
|
||||
if (list.Count > 0)
|
||||
else if (type == MCandleTimeType.H1)
|
||||
{
|
||||
// 데이터 가져올떄 1분 이상 걸릴 시 처리할 데이터
|
||||
var minList = list.Select(t => t.DateTime.Minute).Distinct().ToList();
|
||||
minList.Sort();
|
||||
|
||||
foreach (var min in minList)
|
||||
var equalHourList = tickList.Where(t => t.DateTime.Hour == callH).ToList();
|
||||
if (equalHourList.Count != 0)
|
||||
{
|
||||
var equalList = list.Where(t => t.DateTime.Minute == min).OrderBy(t=>t.DateTime).ToList();
|
||||
var equalListM = equalHourList.Select(t => t.TradePrice).ToList();
|
||||
double equalListMax = 0;
|
||||
if (equalListM.Count != 0)
|
||||
{
|
||||
equalListMax = equalListM.Max();
|
||||
}
|
||||
|
||||
//해당 분 고가
|
||||
var max = equalList.Select(t => t.TradePrice).ToList().Max();
|
||||
//해당 분 저가
|
||||
var low = equalList.Select(t => t.TradePrice).ToList().Min();
|
||||
var equalListL = equalHourList.Select(t => t.TradePrice).ToList();
|
||||
double equalListMin = 0;
|
||||
if (equalListL.Count != 0)
|
||||
{
|
||||
equalListMin = equalListL.Min();
|
||||
}
|
||||
if (item.CandleDataLists_Im.Count > 0)
|
||||
{
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue < equalListMax && equalListMax != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue = equalListMax;
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue > equalListMin && equalListMin != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue = equalListMin;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].RecentlyDataFlag = true;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].EndValue = equalHourList[equalHourList.Count - 1].TradePrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.H1;
|
||||
candle.StartValue = equalHourList[0].TradePrice;
|
||||
candle.HighValue = equalListMax;
|
||||
candle.LowValue = equalListMin;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = equalHourList[equalHourList.Count - 1].TradePrice;
|
||||
|
||||
var date = basicDateTime.AddHours(1);
|
||||
date = date.AddMinutes(-1 * callM);
|
||||
date = date.AddSeconds(-1 * callS);
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, 100);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
}
|
||||
}
|
||||
|
||||
var list = tickList.Where(t => t.DateTime > basicDateTime && t.DateTime.Hour != basicDateTime.Hour).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
//해당 분 고가
|
||||
var max = list.Select(t => t.TradePrice).ToList().Max();
|
||||
//해당 분 저가
|
||||
var low = list.Select(t => t.TradePrice).ToList().Min();
|
||||
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.M1;
|
||||
candle.StartValue = equalList[0].TradePrice;
|
||||
candle.CandleTimeType = (int)MCandleTimeType.H1;
|
||||
candle.StartValue = list[0].TradePrice;
|
||||
candle.HighValue = max;
|
||||
candle.LowValue = low;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = equalList[equalList.Count - 1].TradePrice;
|
||||
var date = basicDateTime.AddMinutes(1);
|
||||
candle.EndValue = list[list.Count - 1].TradePrice;
|
||||
|
||||
var date = basicDateTime.AddHours(1);
|
||||
date = date.AddMinutes(-1 * callM);
|
||||
date = date.AddSeconds(-1 * callS);
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, item.CandleDataLists_Im.Count - 300);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == MCandleTimeType.H1)
|
||||
{
|
||||
var equalHourList = tickList.Where(t => t.DateTime.Hour == callH).ToList();
|
||||
if (equalHourList.Count != 0)
|
||||
{
|
||||
var equalListM = equalHourList.Select(t => t.TradePrice).ToList();
|
||||
double equalListMax = 0;
|
||||
if (equalListM.Count != 0)
|
||||
{
|
||||
equalListMax = equalListM.Max();
|
||||
}
|
||||
|
||||
//해당 분 저가
|
||||
var equalListL = equalHourList.Select(t => t.TradePrice).ToList();
|
||||
double equalListMin = 0;
|
||||
if (equalListL.Count != 0)
|
||||
{
|
||||
equalListMin = equalListL.Min();
|
||||
}
|
||||
if (item.CandleDataLists_Im.Count > 0)
|
||||
{
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue < equalListMax && equalListMax != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].HighValue = equalListMax;
|
||||
if (item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue > equalListMin && equalListMin != 0)
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].LowValue = equalListMin;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].RecentlyDataFlag = true;
|
||||
item.CandleDataLists_Im[item.CandleDataLists_Im.Count - 1].EndValue = equalHourList[equalHourList.Count - 1].TradePrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.H1;
|
||||
candle.StartValue = equalHourList[0].TradePrice;
|
||||
candle.HighValue = equalListMax;
|
||||
candle.LowValue = equalListMin;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = equalHourList[equalHourList.Count - 1].TradePrice;
|
||||
var date = basicDateTime.AddMinutes(1);
|
||||
date.AddSeconds(-1 * callM);
|
||||
date.AddSeconds(-1 * callS);
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, 100);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
}
|
||||
}
|
||||
var list = tickList.Where(t => t.DateTime.Hour != callH).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
//해당 분 고가
|
||||
var max = list.Select(t => t.TradePrice).ToList().Max();
|
||||
//해당 분 저가
|
||||
var low = list.Select(t => t.TradePrice).ToList().Min();
|
||||
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.H1;
|
||||
candle.StartValue = list[0].TradePrice;
|
||||
candle.HighValue = max;
|
||||
candle.LowValue = low;
|
||||
candle.RecentlyDataFlag = true;
|
||||
candle.EndValue = list[list.Count - 1].TradePrice;
|
||||
var date = basicDateTime.AddHours(1);
|
||||
date.AddMinutes(-1 * callM);
|
||||
date.AddSeconds(-1 * callS);
|
||||
|
||||
candle.DateTime = date;
|
||||
if (item.CandleDataLists_Im.Count > 300)
|
||||
item.CandleDataLists_Im.RemoveRange(0, 100);
|
||||
item.CandleDataLists_Im.Add(candle);
|
||||
}
|
||||
}
|
||||
}catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
//}
|
||||
});
|
||||
}
|
||||
//});
|
||||
}
|
||||
return candleDatas;
|
||||
}
|
||||
@@ -340,8 +368,15 @@ namespace Million.Manager
|
||||
{
|
||||
lock (obj)
|
||||
{
|
||||
if (tickerList.Count > 3600)
|
||||
tickerList.RemoveRange(0, 1200);
|
||||
try {
|
||||
if (tickerList.Count > 2000)
|
||||
tickerList.RemoveRange(0, tickerList.Count - 1000);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogManager.WriteLog(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,19 +389,22 @@ namespace Million.Manager
|
||||
{
|
||||
lock (obj)
|
||||
{
|
||||
var temp = GetRecentlyCandleData();
|
||||
|
||||
if (temp != null)
|
||||
try
|
||||
{
|
||||
tickerList.AddRange(temp);
|
||||
//TODO 임시
|
||||
var str = string.Format(@"INSERT INTO [ResultData].[dbo].[VerifyTickerData] VALUES
|
||||
('{0}', @tickers);", temp[0].DateTime.ToString("yyyy-MM-dd HH:mm:ss:fff"));
|
||||
var temp = GetRecentlyCandleData();
|
||||
|
||||
Million.DbManagement.DBConnection.QueryInsertExcuter_VerifyTickerData(str, temp);
|
||||
if (temp != null)
|
||||
{
|
||||
tickerList.AddRange(temp);
|
||||
ClearTicker();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogManager.WriteLog(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,25 @@ namespace Million.Manager
|
||||
|
||||
var keyData = CalculateManager.GetKeyData(indicate);
|
||||
if (item.IndicatorDic.ContainsKey(keyData))
|
||||
valDic.Add(key.Key, item.IndicatorDic[keyData].overlapValue);
|
||||
{
|
||||
if(item.IndicatorDic[keyData].GetType() == typeof(IchimokData))
|
||||
{
|
||||
var indiData = ((IchimokData)item.IndicatorDic[keyData]);
|
||||
var val = indiData.GetOverValue();
|
||||
|
||||
var indi = ((IchimokuConditionSetup)indicate);
|
||||
if (indi.IndicatorIchmokuOverLine == Indicator_IchmokuOverLine.선행스팬1)
|
||||
val = indiData.value;
|
||||
else if (indi.IndicatorIchmokuOverLine == Indicator_IchmokuOverLine.선행스팬2)
|
||||
val = indiData.value2;
|
||||
|
||||
valDic.Add(key.Key, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
valDic.Add(key.Key, item.IndicatorDic[keyData].value);
|
||||
}
|
||||
}
|
||||
else
|
||||
valDic.Add(key.Key, 0);
|
||||
}
|
||||
@@ -50,9 +68,9 @@ namespace Million.Manager
|
||||
string buyRegularExpression, string sellRegularExpression, MarketData market, List<IndicatorCoditionSetup> totalIndicator, bool insertTermCandleData = false)
|
||||
{
|
||||
//buy, sell script 선언
|
||||
var buyScript = new InteratorScripter();
|
||||
var buyScript = new InteratorScripter("Buy Script");
|
||||
buyScript.regularExpressionString = buyRegularExpression;
|
||||
var sellScript = new InteratorScripter();
|
||||
var sellScript = new InteratorScripter("Sell Script");
|
||||
sellScript.regularExpressionString = sellRegularExpression;
|
||||
|
||||
|
||||
|
||||
@@ -192,13 +192,12 @@
|
||||
<Compile Include="Manager\BuyLogicManager.cs" />
|
||||
<Compile Include="Manager\CalculateManager.cs" />
|
||||
<Compile Include="Manager\DataManager.cs" />
|
||||
<Compile Include="Manager\RealtimeDataSettingManager.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Manager\IndicatorSetupManager.cs" />
|
||||
<Compile Include="Manager\InteratorScripter.cs" />
|
||||
<Compile Include="Manager\LogManager.cs" />
|
||||
<Compile Include="Manager\OrderbookManager.cs" />
|
||||
<Compile Include="Manager\ExportManager.cs" />
|
||||
<Compile Include="Manager\RealtimeDataSettingManager.cs" />
|
||||
<Compile Include="Manager\ResultLogicManager.cs" />
|
||||
<Compile Include="Manager\SellLogicManager.cs" />
|
||||
<Compile Include="Manager\ValidationCheckManager.cs" />
|
||||
|
||||
@@ -98,6 +98,5 @@ namespace Million.HunterSubForm.IndicatorSetupForm
|
||||
|
||||
bolingerBandSetup.Description = description + bolingerBandSetup.Description;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ using Million.Data.Upbit.OrderableInformation;
|
||||
using Million.Data.Upbit.Order;
|
||||
using Million.Data.Upbit;
|
||||
using Million.Data.Upbit.OrderBook;
|
||||
using System.Threading;
|
||||
using Million.Manager;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Million.WebMangement.Upbit
|
||||
{
|
||||
@@ -34,7 +37,7 @@ namespace Million.WebMangement.Upbit
|
||||
/// <param name="datetime"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <returns></returns>
|
||||
public List<CandleData> GetCandleStics(string coinFullName, MCandleTimeType candleType, DateTime datetime, int count = 200)
|
||||
public List<CandleData> GetCandleStics(string coinFullName, MCandleTimeType candleType, DateTime datetime, int count = 500)
|
||||
{
|
||||
var url = UpbitURL_MCandleStick + (int)candleType;
|
||||
|
||||
@@ -42,11 +45,28 @@ namespace Million.WebMangement.Upbit
|
||||
else if (candleType == MCandleTimeType.W1) url = UpbitURL_WCandleStick;
|
||||
else if (candleType == MCandleTimeType.MT1) url = UpbitURL_MTCandleStick;
|
||||
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get,
|
||||
new NameValueCollection { { "market", coinFullName }, { "to", (datetime == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
|
||||
return WebServiceFunctions.GetUpbitCandleDatas(resResult, candleType);
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get,
|
||||
new NameValueCollection { { "market", coinFullName }, { "to", (datetime == default(DateTime)) ?
|
||||
process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
|
||||
|
||||
List<CandleData> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetUpbitCandleDatas(resResult, candleType);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get,
|
||||
new NameValueCollection { { "market", coinFullName }, { "to", (datetime == default(DateTime)) ?
|
||||
process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Market List Data
|
||||
/// </summary>
|
||||
@@ -55,18 +75,47 @@ namespace Million.WebMangement.Upbit
|
||||
{
|
||||
var url = UpbitURL_MarketInfo;
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get);
|
||||
return WebServiceFunctions.GetUpbitMarketDatas(resResult);
|
||||
|
||||
List<MarketData> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetUpbitMarketDatas(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 내가 보유한 자산 리스트 가져오기
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Data.Upbit.Account> GetAccounts()
|
||||
public List<Account> GetAccounts()
|
||||
{
|
||||
var url = UpbitURL_Accounts;
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get);
|
||||
return WebServiceFunctions.GetAccounts(resResult);
|
||||
|
||||
List<Account> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetAccounts(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
process.CallAPI(url, HttpMethod.Get);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -77,9 +126,23 @@ namespace Million.WebMangement.Upbit
|
||||
public OrderableInformation GetOrderableInformation(string CoinFullName)
|
||||
{
|
||||
var url = UpbitURL_OrderChace;
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", CoinFullName } });
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", CoinFullName } });
|
||||
|
||||
return WebServiceFunctions.GetOrderableInformation(resResult);
|
||||
OrderableInformation returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetOrderableInformation(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", CoinFullName } });
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -90,15 +153,31 @@ namespace Million.WebMangement.Upbit
|
||||
public Order GetOrderInformation(string uuid)
|
||||
{
|
||||
var url = UpbitURL_Order;
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection {{ "uuid", uuid } });
|
||||
return WebServiceFunctions.GetOrderInformation(resResult);
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "uuid", uuid } });
|
||||
|
||||
Order returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetOrderInformation(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "uuid", uuid } });
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Order List가져오는 함수
|
||||
/// uuids는 A,B,C이런식으로 나와야함
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Order> GetOrderListInformation(UpbitOrderListTypes type, UpbitOrderListOrderByType orderType = UpbitOrderListOrderByType.desc)
|
||||
public List<Order> GetOrderListInformation(UpbitOrderListTypes type, string uuids = "", UpbitOrderListOrderByType orderType = UpbitOrderListOrderByType.desc)
|
||||
{
|
||||
var url = UpbitURL_Orders;
|
||||
|
||||
@@ -108,9 +187,27 @@ namespace Million.WebMangement.Upbit
|
||||
typeStr = "wait,watch";
|
||||
else if (type == UpbitOrderListTypes.donecancel)
|
||||
typeStr = "done,cancel";
|
||||
var data = new NameValueCollection { { "states", typeStr }, { "order_by", orderType.ToString() } };
|
||||
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "states", typeStr },{ "order_by", orderType.ToString() } });
|
||||
return WebServiceFunctions.GetOrderListInformation(resResult);
|
||||
if (uuids != "")
|
||||
data.Add("uuids", uuids);
|
||||
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, data);
|
||||
|
||||
List<Order> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetOrderListInformation(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get, data);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,21 +219,52 @@ namespace Million.WebMangement.Upbit
|
||||
/// <param name="price">가격</param>
|
||||
/// <param name="ord_type">Limit = 지정가 주문, price = 시장가 주문(매수), market = 시장가 주문(매도)</param>
|
||||
/// <returns></returns>
|
||||
public Order TryOrder(string coinFullName, UpbitOrderSide side, double volume, double price, UpbitOrderType ord_type = UpbitOrderType.limit)
|
||||
public Order TryOrder(string coinFullName, UpbitOrderSide side, double volume, double price, Func<string, bool> insertLog, UpbitOrderType ord_type = UpbitOrderType.limit)
|
||||
{
|
||||
string url = UpbitURL_Orders;
|
||||
var namevalCollection = new NameValueCollection {
|
||||
{ "market", coinFullName },
|
||||
{ "side", side.ToString() },
|
||||
{ "side", side.ToString() },
|
||||
{ "ord_type", ord_type.ToString() }
|
||||
};
|
||||
if (volume != 0)
|
||||
namevalCollection.Add("volume", volume.ToString());
|
||||
if(price != 0)
|
||||
if (price != 0)
|
||||
namevalCollection.Add("price", price.ToString());
|
||||
|
||||
var logStr = coinFullName + " 주문 금액 : " + price.ToString() + ", 주문량 : " + volume.ToString() + "\r\n";
|
||||
|
||||
LogManager.WriteLog(logStr, coinFullName);
|
||||
var resResult = process.CallAPI(url, HttpMethod.Post, namevalCollection);
|
||||
return WebServiceFunctions.TryOrder(resResult);
|
||||
|
||||
Order returnData;
|
||||
|
||||
var cnt = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.TryOrder(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
resResult = process.CallAPI(url, HttpMethod.Post, namevalCollection);
|
||||
}
|
||||
if (cnt == 10)
|
||||
{
|
||||
insertLog("Try Order Count 넘어감 -> CNT : " + cnt);
|
||||
logStr = coinFullName + " 주문 에러!! 주문 returnData : " + JsonConvert.SerializeObject(returnData) + "\r\n"
|
||||
+ "resResult : " + resResult;
|
||||
LogManager.WriteLog(logStr, coinFullName);
|
||||
break;
|
||||
}
|
||||
|
||||
cnt++;
|
||||
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -148,7 +276,22 @@ namespace Million.WebMangement.Upbit
|
||||
{
|
||||
var url = UpbitURL_Order;
|
||||
var resResult = process.CallAPI(url, HttpMethod.Delete, new NameValueCollection { { "uuid", uuid } });
|
||||
return WebServiceFunctions.GetOrderInformation(resResult);
|
||||
|
||||
Order returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetOrderInformation(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Delete, new NameValueCollection { { "uuid", uuid } });
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -162,10 +305,28 @@ namespace Million.WebMangement.Upbit
|
||||
{
|
||||
string url = UpbitURL_Ticks;
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", coinFullName },
|
||||
{ "to", (to == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(to) },
|
||||
{ "count", count.ToString() }
|
||||
{ "to", (to == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(to) },
|
||||
{ "count", count.ToString() }
|
||||
});
|
||||
return WebServiceFunctions.GetConclusionList(resResult);
|
||||
|
||||
List<Conclusion> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetConclusionList(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", coinFullName },
|
||||
{ "to", (to == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(to) },
|
||||
{ "count", count.ToString() }
|
||||
});
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -180,7 +341,22 @@ namespace Million.WebMangement.Upbit
|
||||
var list = string.Join(",", coinFullNameList);
|
||||
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "markets", list } });
|
||||
return WebServiceFunctions.GetTickerList(resResult);
|
||||
|
||||
List<Ticker> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetTickerList(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "markets", list } });
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -195,7 +371,22 @@ namespace Million.WebMangement.Upbit
|
||||
var list = string.Join(",", coinFullNameList);
|
||||
|
||||
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "markets", list } });
|
||||
return WebServiceFunctions.GetOrderBookList(resResult);
|
||||
|
||||
List<OrderBook> returnData;
|
||||
|
||||
while (true)
|
||||
{
|
||||
returnData = WebServiceFunctions.GetOrderBookList(resResult);
|
||||
if (returnData != null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "markets", list } });
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Million.Data.Upbit;
|
||||
using Million.Data.Upbit.Order;
|
||||
using Million.Data.Upbit.OrderableInformation;
|
||||
using Million.Data.Upbit.OrderBook;
|
||||
using Million.Manager;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,7 +18,8 @@ namespace Million.WebServices
|
||||
/// Web Service관련 비즈니스 로직
|
||||
/// </summary>
|
||||
public class WebServiceFunctions
|
||||
{
|
||||
{
|
||||
public static Dictionary<string, long> tempDic = new Dictionary<string, long>();
|
||||
/// <summary>
|
||||
/// 빗썸 캔들 가져오는 함수
|
||||
/// </summary>
|
||||
@@ -90,7 +92,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new List<MarketData>();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +139,7 @@ namespace Million.WebServices
|
||||
|
||||
if (data.ContainsKey("trades"))
|
||||
{
|
||||
var tradeList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(data["trades"]?.ToString()));
|
||||
var tradeList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(data["trades"]?.ToString());
|
||||
//(List<Dictionary<string, object>>)data["trades"];
|
||||
|
||||
foreach (var item in tradeList)
|
||||
@@ -163,7 +166,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Order();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +210,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new List<Conclusion>();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,13 +232,13 @@ namespace Million.WebServices
|
||||
var data = new OrderBook();
|
||||
string timestamp = item["timestamp"]?.ToString();
|
||||
var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime();
|
||||
var doubleData = Convert.ToDouble(timestamp);
|
||||
long.TryParse(timestamp, out var longData);
|
||||
|
||||
double.TryParse(item["total_ask_size"]?.ToString(), out var total_ask_size);
|
||||
double.TryParse(item["total_bid_size"]?.ToString(), out var total_bid_size);
|
||||
|
||||
data.CoinFullName = item["market"]?.ToString();
|
||||
data.CreateOrderBookDateTime = dateTime.AddMilliseconds(doubleData);
|
||||
data.CreateOrderBookDateTime = dateTime.AddMilliseconds(longData);
|
||||
data.TotalBuySize = total_bid_size;
|
||||
data.TotalSellSize = total_ask_size;
|
||||
|
||||
@@ -262,7 +267,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return returnData;
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -277,9 +283,10 @@ namespace Million.WebServices
|
||||
{
|
||||
try
|
||||
{
|
||||
var nowData = DateTime.Now;
|
||||
var returnData = new List<Ticker>();
|
||||
var datas = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(resResult.ToString());
|
||||
var dateTimeData = DateTime.Now;
|
||||
//var dateTime = DateTime.Now;
|
||||
foreach (var item in datas)
|
||||
{
|
||||
double.TryParse(item["opening_price"]?.ToString(), out var opening_price);
|
||||
@@ -298,11 +305,21 @@ namespace Million.WebServices
|
||||
double.TryParse(item["acc_trade_volume_24h"]?.ToString(), out var acc_trade_volume_24h);
|
||||
double.TryParse(item["highest_52_week_price"]?.ToString(), out var highest_52_week_price);
|
||||
double.TryParse(item["lowest_52_week_price"]?.ToString(), out var lowest_52_week_price);
|
||||
long.TryParse(item["timestamp"]?.ToString(), out var timeStamp);
|
||||
|
||||
var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
dateTime = dateTime.AddMilliseconds(timeStamp);
|
||||
dateTime = dateTime.AddHours(9);
|
||||
|
||||
var market = item["market"]?.ToString();
|
||||
|
||||
var dateStr = item["trade_date"]?.ToString() + item["trade_time"]?.ToString();
|
||||
|
||||
//if(!(dateTime.Day == DateTime.Now.Day && dateTime.Hour == DateTime.Now.Hour && dateTime.Minute == DateTime.Now.Minute))
|
||||
//{
|
||||
// continue;
|
||||
//}
|
||||
var data = new Ticker();
|
||||
data.CoinFullName = item["market"]?.ToString();
|
||||
data.CoinFullName = market;
|
||||
data.TradeDateTime = DateTime.ParseExact(dateStr, "yyyyMMddHHmmss", null);
|
||||
data.OpeningPrice = opening_price;
|
||||
data.HighPrice = high_price;
|
||||
@@ -323,7 +340,8 @@ namespace Million.WebServices
|
||||
data.HighstPriceDateOf52Week = Convert.ToDateTime(item["highest_52_week_date"]?.ToString()).ToUniversalTime();
|
||||
data.LowstPriceOf52Week = lowest_52_week_price;
|
||||
data.LowstPriceDateOf52Week = Convert.ToDateTime(item["lowest_52_week_date"]?.ToString()).ToUniversalTime();
|
||||
data.DateTime = dateTimeData;
|
||||
data.TimeStamp = dateTime;
|
||||
data.DateTime = nowData;
|
||||
returnData.Add(data);
|
||||
}
|
||||
|
||||
@@ -331,7 +349,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new List<Ticker>();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,7 +395,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Order();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +448,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new List<Order>();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,7 +530,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new OrderableInformation();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +567,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new List<Account>();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,8 +609,8 @@ namespace Million.WebServices
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Get Upbit Stick data Error : " + e.Message);
|
||||
return new List<CandleData>();
|
||||
LogManager.WriteLog(e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user