Ticker 저장 기능 및 Check List Setting 2가지 추가
This commit is contained in:
168
Million Buyer/MainForm.Designer.cs
generated
168
Million Buyer/MainForm.Designer.cs
generated
@@ -37,6 +37,8 @@
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = 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();
|
||||
@@ -50,14 +52,11 @@
|
||||
this.rd_Realtime = new System.Windows.Forms.RadioButton();
|
||||
this.rd_buyer = new System.Windows.Forms.RadioButton();
|
||||
this.tl_BuyList = new DevExpress.XtraTreeList.TreeList();
|
||||
this.tl_Result = new DevExpress.XtraTreeList.TreeList();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.BuyMarket = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.BuyValue = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.BuyCount = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.BuyDateTime = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.tl_Result = new DevExpress.XtraTreeList.TreeList();
|
||||
this.Market = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.BuyValueData = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.BuyCountData = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
@@ -67,9 +66,12 @@
|
||||
this.SellDateTimeData = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.RateData = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.MoneyData = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.lb_log = new System.Windows.Forms.ListBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.lb_StartDate = new System.Windows.Forms.Label();
|
||||
this.cb_IncludeClearIndicator = new System.Windows.Forms.CheckBox();
|
||||
this.cb_UpperMainIndi = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tl_BuyList)).BeginInit();
|
||||
@@ -78,6 +80,8 @@
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.cb_UpperMainIndi);
|
||||
this.groupBox1.Controls.Add(this.cb_IncludeClearIndicator);
|
||||
this.groupBox1.Controls.Add(this.lb_IndiName);
|
||||
this.groupBox1.Controls.Add(this.bt_Modify);
|
||||
this.groupBox1.Controls.Add(this.label6);
|
||||
@@ -87,7 +91,7 @@
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 52);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(362, 111);
|
||||
this.groupBox1.Size = new System.Drawing.Size(362, 159);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "데이터 Setting";
|
||||
@@ -165,13 +169,30 @@
|
||||
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, 169);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 217);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(362, 191);
|
||||
this.groupBox2.TabIndex = 6;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "데이터 현황";
|
||||
//
|
||||
// lb_StartDate
|
||||
//
|
||||
this.lb_StartDate.AutoSize = true;
|
||||
this.lb_StartDate.Location = new System.Drawing.Point(102, 161);
|
||||
this.lb_StartDate.Name = "lb_StartDate";
|
||||
this.lb_StartDate.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_StartDate.TabIndex = 9;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(39, 161);
|
||||
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;
|
||||
@@ -291,56 +312,12 @@
|
||||
this.BuyValue,
|
||||
this.BuyCount,
|
||||
this.BuyDateTime});
|
||||
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.TabIndex = 11;
|
||||
//
|
||||
// tl_Result
|
||||
//
|
||||
this.tl_Result.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
|
||||
this.Market,
|
||||
this.BuyValueData,
|
||||
this.BuyCountData,
|
||||
this.BuyDateTimeData,
|
||||
this.SellValueData,
|
||||
this.SellCountData,
|
||||
this.SellDateTimeData,
|
||||
this.RateData,
|
||||
this.MoneyData});
|
||||
this.tl_Result.Location = new System.Drawing.Point(801, 31);
|
||||
this.tl_Result.Name = "tl_Result";
|
||||
this.tl_Result.Size = new System.Drawing.Size(796, 699);
|
||||
this.tl_Result.TabIndex = 12;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(17, 737);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(91, 23);
|
||||
this.button1.TabIndex = 13;
|
||||
this.button1.Text = "데이터 저장";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(378, 9);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(57, 12);
|
||||
this.label8.TabIndex = 14;
|
||||
this.label8.Text = "구매 목록";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(799, 9);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(129, 12);
|
||||
this.label9.TabIndex = 15;
|
||||
this.label9.Text = "구매 및 판매 완료 목록";
|
||||
//
|
||||
// BuyMarket
|
||||
//
|
||||
this.BuyMarket.Caption = "구매 항목";
|
||||
@@ -373,6 +350,24 @@
|
||||
this.BuyDateTime.Visible = true;
|
||||
this.BuyDateTime.VisibleIndex = 3;
|
||||
//
|
||||
// tl_Result
|
||||
//
|
||||
this.tl_Result.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
|
||||
this.Market,
|
||||
this.BuyValueData,
|
||||
this.BuyCountData,
|
||||
this.BuyDateTimeData,
|
||||
this.SellValueData,
|
||||
this.SellCountData,
|
||||
this.SellDateTimeData,
|
||||
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.Name = "tl_Result";
|
||||
this.tl_Result.Size = new System.Drawing.Size(796, 699);
|
||||
this.tl_Result.TabIndex = 12;
|
||||
//
|
||||
// Market
|
||||
//
|
||||
this.Market.Caption = "항목";
|
||||
@@ -445,31 +440,66 @@
|
||||
this.MoneyData.Visible = true;
|
||||
this.MoneyData.VisibleIndex = 8;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(17, 737);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(91, 23);
|
||||
this.button1.TabIndex = 13;
|
||||
this.button1.Text = "데이터 저장";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(378, 9);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(57, 12);
|
||||
this.label8.TabIndex = 14;
|
||||
this.label8.Text = "구매 목록";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(799, 9);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(129, 12);
|
||||
this.label9.TabIndex = 15;
|
||||
this.label9.Text = "구매 및 판매 완료 목록";
|
||||
//
|
||||
// lb_log
|
||||
//
|
||||
this.lb_log.FormattingEnabled = true;
|
||||
this.lb_log.ItemHeight = 12;
|
||||
this.lb_log.Location = new System.Drawing.Point(12, 366);
|
||||
this.lb_log.Location = new System.Drawing.Point(12, 414);
|
||||
this.lb_log.Name = "lb_log";
|
||||
this.lb_log.Size = new System.Drawing.Size(362, 364);
|
||||
this.lb_log.Size = new System.Drawing.Size(362, 316);
|
||||
this.lb_log.TabIndex = 16;
|
||||
//
|
||||
// label10
|
||||
// cb_IncludeClearIndicator
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(39, 161);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(57, 12);
|
||||
this.label10.TabIndex = 8;
|
||||
this.label10.Text = "시작 시간";
|
||||
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.Name = "cb_IncludeClearIndicator";
|
||||
this.cb_IncludeClearIndicator.Size = new System.Drawing.Size(170, 16);
|
||||
this.cb_IncludeClearIndicator.TabIndex = 8;
|
||||
this.cb_IncludeClearIndicator.Text = "판매 완료 조건으로 Setting";
|
||||
this.cb_IncludeClearIndicator.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lb_StartDate
|
||||
// cb_UpperMainIndi
|
||||
//
|
||||
this.lb_StartDate.AutoSize = true;
|
||||
this.lb_StartDate.Location = new System.Drawing.Point(102, 161);
|
||||
this.lb_StartDate.Name = "lb_StartDate";
|
||||
this.lb_StartDate.Size = new System.Drawing.Size(0, 12);
|
||||
this.lb_StartDate.TabIndex = 9;
|
||||
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.Name = "cb_UpperMainIndi";
|
||||
this.cb_UpperMainIndi.Size = new System.Drawing.Size(212, 16);
|
||||
this.cb_UpperMainIndi.TabIndex = 9;
|
||||
this.cb_UpperMainIndi.Text = "메인조건이 사전조건보다 높아야함";
|
||||
this.cb_UpperMainIndi.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -545,6 +575,8 @@
|
||||
private System.Windows.Forms.ListBox lb_log;
|
||||
private System.Windows.Forms.Label lb_StartDate;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.CheckBox cb_UpperMainIndi;
|
||||
private System.Windows.Forms.CheckBox cb_IncludeClearIndicator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ namespace Million_Buyer
|
||||
Million.DbManagement.DBConnection.QueryUpdateExcuter
|
||||
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateRealTimeIndicatorTableQuery());
|
||||
|
||||
// 데이터 검증을 위한 DB Table 생성
|
||||
Million.DbManagement.DBConnection.QueryUpdateExcuter
|
||||
(CommonProperty.DbConnectionResultData, DbServiceFunctions.CreateVerifyTickerDataTableQuery());
|
||||
|
||||
_saveResultData = new SavedResultData
|
||||
{
|
||||
BuySetupList = new List<object>(),
|
||||
@@ -214,7 +218,10 @@ namespace Million_Buyer
|
||||
dataList = realTimeMsg.GetRealTimeCandleData(candleTypeList, 200);
|
||||
foreach (var item in realTimeMsg.codeFullNameList)
|
||||
{
|
||||
overlapBuyManagementList[item] = true;
|
||||
if(cb_IncludeClearIndicator.Checked)
|
||||
overlapBuyManagementList[item] = false;
|
||||
else
|
||||
overlapBuyManagementList[item] = true;
|
||||
}
|
||||
firstFlag = 1;
|
||||
InsertLog("Deafult Data Setting 완료..");
|
||||
@@ -260,7 +267,7 @@ namespace Million_Buyer
|
||||
var minDateTime = dic[MCandleTimeType.M1].Select(t => t.DateTime).Min();
|
||||
var maxDateTime = dic[MCandleTimeType.M1].Select(t => t.DateTime).Max().AddHours(1);
|
||||
|
||||
dic = IndicatorSetupManager.CalculateIndicator(dic, totalIndicatorList, minDateTime, maxDateTime, true);
|
||||
dic = IndicatorSetupManager.CalculateIndicator(dic, totalIndicatorList, minDateTime, maxDateTime, cb_UpperMainIndi.Checked, true);
|
||||
#endregion
|
||||
|
||||
#region 사고 파는 로직
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
16
Million Hunter/HunterMainForm.Designer.cs
generated
16
Million Hunter/HunterMainForm.Designer.cs
generated
@@ -68,6 +68,7 @@ namespace Million
|
||||
this.splitContainer_RegularExpression = new System.Windows.Forms.SplitContainer();
|
||||
this.groupBox8 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox9 = new System.Windows.Forms.GroupBox();
|
||||
this.cb_UpperMainIndi = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_IndicatorSelection.Properties)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -555,11 +556,24 @@ namespace Million
|
||||
this.groupBox9.TabStop = false;
|
||||
this.groupBox9.Text = "판매 조건 조합";
|
||||
//
|
||||
// cb_UpperMainIndi
|
||||
//
|
||||
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(481, 46);
|
||||
this.cb_UpperMainIndi.Name = "cb_UpperMainIndi";
|
||||
this.cb_UpperMainIndi.Size = new System.Drawing.Size(212, 16);
|
||||
this.cb_UpperMainIndi.TabIndex = 10;
|
||||
this.cb_UpperMainIndi.Text = "메인조건이 사전조건보다 높아야함";
|
||||
this.cb_UpperMainIndi.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(937, 832);
|
||||
this.Controls.Add(this.cb_UpperMainIndi);
|
||||
this.Controls.Add(this.splitContainer_RegularExpression);
|
||||
this.Controls.Add(this.splitContainer_SetupPanel);
|
||||
this.Controls.Add(this.groupBox6);
|
||||
@@ -598,6 +612,7 @@ namespace Million
|
||||
this.groupBox8.ResumeLayout(false);
|
||||
this.groupBox9.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -642,6 +657,7 @@ namespace Million
|
||||
private DevExpress.XtraEditors.SimpleButton bt_InsertBuyerIndicator;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox tb_BuyerIndicatorName;
|
||||
private System.Windows.Forms.CheckBox cb_UpperMainIndi;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -288,6 +288,9 @@ namespace Million
|
||||
var startDate = _saveResultData.StartDateTime;
|
||||
var endDate = _saveResultData.EndDateTime;
|
||||
|
||||
//TODO 이전 조건보다 현재 조건이 더 높아야 한다는 조건 걸기
|
||||
var upperMainIndicatorFlag = cb_UpperMainIndi.Checked;
|
||||
|
||||
Parallel.For(0, tableList.Count, i =>
|
||||
{
|
||||
//임시로 하나만
|
||||
@@ -315,7 +318,7 @@ namespace Million
|
||||
|
||||
// 선처리
|
||||
CalculateManager.GetCalculateIndicator(totalIndicator, subIndStringiList, lossIndicator, startDate,
|
||||
endDate, resultCandleDataList, subIndicator, dic);
|
||||
endDate, resultCandleDataList, subIndicator, dic, upperMainIndicatorFlag);
|
||||
|
||||
|
||||
var totalIndi = totalIndicator.Select(t => t.IndexString).ToList();
|
||||
@@ -326,7 +329,7 @@ namespace Million
|
||||
|
||||
// 후처리
|
||||
CalculateManager.GetCalculateIndicator(totalIndicator, totalIndi, lossIndicator, startDate,
|
||||
endDate, resultCandleDataList, subIndicator, dic);
|
||||
endDate, resultCandleDataList, subIndicator, dic, upperMainIndicatorFlag);
|
||||
|
||||
// 계산 로직
|
||||
var resultLsit = ResultLogicManager.GetSearchResultList(resultCandleDataList, lossIndicator,
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
<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>
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace Million_Prototype
|
||||
var maxDateTime = dic[MCandleTimeType.M1].Select(t => t.DateTime).Max().AddHours(1);
|
||||
|
||||
//2차 data calculate 처리
|
||||
dic = IndicatorSetupManager.CalculateIndicator(dic, totalIndicatorList, minDateTime, maxDateTime, true);
|
||||
dic = IndicatorSetupManager.CalculateIndicator(dic, totalIndicatorList, minDateTime, maxDateTime, true, true);
|
||||
|
||||
#region 사고 파는 로직
|
||||
//최신 데이터 가져오기
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Million.Data.Upbit
|
||||
/// <summary>
|
||||
/// 현재가 정보
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Ticker
|
||||
{
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Windows.Forms;
|
||||
using DevExpress.Charts.Native;
|
||||
using DevExpress.DataAccess.Native.Sql;
|
||||
using Million.Data;
|
||||
using Million.Data.Upbit;
|
||||
using Million.SaveData;
|
||||
|
||||
namespace Million.DbManagement
|
||||
@@ -274,6 +275,49 @@ namespace Million.DbManagement
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
/// </summary>
|
||||
|
||||
@@ -82,6 +82,19 @@ 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>
|
||||
|
||||
@@ -312,12 +312,12 @@ namespace Million.Manager
|
||||
/// <param name="parentCandleDataList"></param>
|
||||
/// <param name="childrenCandleDataList"></param>
|
||||
/// <returns></returns>
|
||||
public static void SwitchFun(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList,
|
||||
List<CandleData> childrenCandleDataList, List<IndicatorCoditionSetup> subIndicator)
|
||||
public static void SwitchFun(List<IndicatorCoditionSetup> totalIndicator, IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList,
|
||||
List<CandleData> childrenCandleDataList, List<IndicatorCoditionSetup> subIndicator, bool upperMainIndicatorFlag)
|
||||
{
|
||||
parentCandleDataList = parentCandleDataList.OrderBy(t => t.DateTime).ToList();
|
||||
childrenCandleDataList = childrenCandleDataList.OrderBy(t => t.DateTime).ToList();
|
||||
|
||||
|
||||
foreach (var item in childrenCandleDataList)
|
||||
item.CalculateFlag[setUp.IndexString] = false;
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace Million.Manager
|
||||
//최초돌파
|
||||
else if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.최초돌파)
|
||||
{
|
||||
FirstTranspierce(setUp, parentCandleDataList, childrenCandleDataList);
|
||||
FirstTranspierce(setUp, parentCandleDataList, childrenCandleDataList, totalIndicator, upperMainIndicatorFlag);
|
||||
}
|
||||
//크로스
|
||||
else if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.크로스)
|
||||
@@ -558,7 +558,8 @@ namespace Million.Manager
|
||||
/// <param name="parentCandleDataList"></param>
|
||||
/// <param name="childrenCandleDataList"></param>
|
||||
/// <returns></returns>
|
||||
public static void FirstTranspierce(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList)
|
||||
public static void FirstTranspierce(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList,
|
||||
List<IndicatorCoditionSetup> totalIndicators, bool upperMainIndicatorFlag)
|
||||
{
|
||||
// 정규 식 없을 경우 단순 돌파와 같음
|
||||
if (string.IsNullOrWhiteSpace(setUp.FirstOverSubRegExpression))
|
||||
@@ -587,7 +588,7 @@ namespace Million.Manager
|
||||
foreach (var parent in parentCandleDataList)
|
||||
{
|
||||
var dic = parent.CalculateFlag;
|
||||
|
||||
|
||||
//Sub 조건 만족 여부
|
||||
if (subScript.DicExcuteScript(dic))
|
||||
{
|
||||
@@ -598,17 +599,25 @@ namespace Million.Manager
|
||||
subFlag = false;
|
||||
firstFlag = false;
|
||||
}
|
||||
|
||||
//sub 조건이 만족할 경우
|
||||
if (subFlag)
|
||||
{
|
||||
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 (overlapData < subVal) continue;
|
||||
}
|
||||
|
||||
//최초 시점이 아닐 경우
|
||||
if (!firstFlag)
|
||||
{
|
||||
if (!parent.IndicatorDic.ContainsKey(key)) continue;
|
||||
var overlapData = GetOverlapValueData(setUp, parent, key);
|
||||
|
||||
if (overlapData == 0) continue;
|
||||
|
||||
|
||||
var enumList = setUp.OverStatusEnumList;
|
||||
if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.최초돌파) enumList = setUp.OverStatusEnumListFirstOver;
|
||||
@@ -1152,7 +1161,7 @@ namespace Million.Manager
|
||||
/// <param name="subIndicator"></param>
|
||||
public static void GetCalculateIndicator(List<IndicatorCoditionSetup> totalIndicator, List<string> indiList, List<IndicatorCoditionSetup> lossIndicator,
|
||||
DateTime startDate, DateTime endDate, List<CandleData> resultCandleDataList, List<IndicatorCoditionSetup> subIndicator,
|
||||
Dictionary<MCandleTimeType, List<CandleData>> parentList, bool recentlyDataFlag = false)
|
||||
Dictionary<MCandleTimeType, List<CandleData>> parentList, bool upperMainIndicatorFlag, bool recentlyDataFlag = false)
|
||||
{
|
||||
//최신 child 계산
|
||||
if (recentlyDataFlag)
|
||||
@@ -1185,7 +1194,7 @@ namespace Million.Manager
|
||||
list = list.Where(t => t.RecentlyDataFlag).ToList();
|
||||
}
|
||||
|
||||
SwitchFun(indicator, list, resultCandleDataList, subIndicator);
|
||||
SwitchFun(totalIndicator, indicator, list, resultCandleDataList, subIndicator, upperMainIndicatorFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Million.Manager
|
||||
// 총 데이터
|
||||
var dic = DataManager.GetStandardData(totalIndicators, startDate, endDate, market, distinctIndicator, true);
|
||||
|
||||
return CalculateIndicator(dic, totalIndicators, startDate, endDate);
|
||||
return CalculateIndicator(dic, totalIndicators, startDate, endDate, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -89,7 +89,7 @@ namespace Million.Manager
|
||||
/// <param name="endDate"></param>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<MCandleTimeType, List<CandleData>> CalculateIndicator(Dictionary<MCandleTimeType, List<CandleData>> dic,
|
||||
List<IndicatorCoditionSetup> totalIndicators, DateTime startDate, DateTime endDate, bool recentlyDataFlag = false)
|
||||
List<IndicatorCoditionSetup> totalIndicators, DateTime startDate, DateTime endDate, bool upperMainIndicatorFlag, bool recentlyDataFlag = false)
|
||||
{
|
||||
dic[MCandleTimeType.M1] = dic[MCandleTimeType.M1].Where(t => startDate <= t.DateTime && t.DateTime < endDate).ToList();
|
||||
// Sub Indicator string list 반환
|
||||
@@ -100,7 +100,7 @@ namespace Million.Manager
|
||||
|
||||
// 선처리
|
||||
CalculateManager.GetCalculateIndicator(totalIndicators, subIndStringiList, null, startDate,
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag);
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag, upperMainIndicatorFlag);
|
||||
|
||||
var totalIndi = totalIndicators.Select(t => t.IndexString).ToList();
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Million.Manager
|
||||
|
||||
// 후처리
|
||||
CalculateManager.GetCalculateIndicator(totalIndicators, totalIndi, null, startDate,
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag);
|
||||
endDate, dic[MCandleTimeType.M1], subIndicator, dic, recentlyDataFlag, upperMainIndicatorFlag);
|
||||
|
||||
|
||||
// Parent Recently Data는 indicator에 따라 달라질수 있으므로 전부다 처리한 후 초기화
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using Million.Data;
|
||||
using Million.Data.Upbit;
|
||||
using Million.DbManagement;
|
||||
using Million.WebMangement.Upbit;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static Million.CommonProperty;
|
||||
|
||||
namespace Million.Manager
|
||||
@@ -16,7 +13,7 @@ namespace Million.Manager
|
||||
/// <summary>
|
||||
/// Data Setting하는 Manager Class
|
||||
/// </summary>
|
||||
public class RealtimeDataSettingManager : Form
|
||||
public class RealtimeDataSettingManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Ticker에 들어갈 데이터
|
||||
@@ -355,8 +352,16 @@ namespace Million.Manager
|
||||
lock (obj)
|
||||
{
|
||||
var temp = GetRecentlyCandleData();
|
||||
if(temp != null)
|
||||
tickerList.AddRange(temp);
|
||||
|
||||
if(temp != null) {
|
||||
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"));
|
||||
|
||||
Million.DbManagement.DBConnection.QueryInsertExcuter_VerifyTickerData
|
||||
(str, temp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user