diff --git a/Million Hunter/HunterSubForm/IndicatorSetupForm/BolingerBandSetupForm.cs b/Million Hunter/HunterSubForm/IndicatorSetupForm/BolingerBandSetupForm.cs index efe8c38..c445c6c 100644 --- a/Million Hunter/HunterSubForm/IndicatorSetupForm/BolingerBandSetupForm.cs +++ b/Million Hunter/HunterSubForm/IndicatorSetupForm/BolingerBandSetupForm.cs @@ -206,7 +206,8 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm _bolingerBandSetup.Description += item.ToString() + ','; } else if (value.GetType() == typeof(string) || - value.GetType() == typeof(CommonProperty.BuySellType)) continue; + value.GetType() == typeof(CommonProperty.BuySellType) || + value.GetType() == typeof(CommonProperty.IndicatorType)) continue; else _bolingerBandSetup.Description += value.ToString() + ','; diff --git a/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.Designer.cs b/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.Designer.cs index 6e2410f..d92fa74 100644 --- a/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.Designer.cs +++ b/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.Designer.cs @@ -51,6 +51,9 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm this.checkedListBoxControl_IndicatorOver = new DevExpress.XtraEditors.CheckedListBoxControl(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.checkedListBoxControl_PriceType = new DevExpress.XtraEditors.CheckedListBoxControl(); + this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl(); + this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage(); + this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_CustomCondition.Properties)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -67,14 +70,18 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm ((System.ComponentModel.ISupportInitialize)(this.checkedListBoxControl_IndicatorOver)).BeginInit(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.checkedListBoxControl_PriceType)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit(); + this.xtraTabControl1.SuspendLayout(); + this.xtraTabPage1.SuspendLayout(); + this.xtraTabPage2.SuspendLayout(); this.SuspendLayout(); // // groupBox3 // this.groupBox3.Controls.Add(this.comboBoxEdit_CustomCondition); - this.groupBox3.Location = new System.Drawing.Point(657, 23); + this.groupBox3.Location = new System.Drawing.Point(160, 162); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(109, 55); + this.groupBox3.Size = new System.Drawing.Size(143, 55); this.groupBox3.TabIndex = 10; this.groupBox3.TabStop = false; this.groupBox3.Text = "추가 조건"; @@ -87,15 +94,15 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm this.comboBoxEdit_CustomCondition.Name = "comboBoxEdit_CustomCondition"; this.comboBoxEdit_CustomCondition.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); - this.comboBoxEdit_CustomCondition.Size = new System.Drawing.Size(97, 20); + this.comboBoxEdit_CustomCondition.Size = new System.Drawing.Size(131, 20); this.comboBoxEdit_CustomCondition.TabIndex = 5; // // groupBox2 // this.groupBox2.Controls.Add(this.checkedListBoxControl_OverStatus); - this.groupBox2.Location = new System.Drawing.Point(427, 23); + this.groupBox2.Location = new System.Drawing.Point(12, 3); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(109, 191); + this.groupBox2.Size = new System.Drawing.Size(112, 159); this.groupBox2.TabIndex = 12; this.groupBox2.TabStop = false; this.groupBox2.Text = "OverStatus"; @@ -105,15 +112,15 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm this.checkedListBoxControl_OverStatus.Dock = System.Windows.Forms.DockStyle.Fill; this.checkedListBoxControl_OverStatus.Location = new System.Drawing.Point(3, 18); this.checkedListBoxControl_OverStatus.Name = "checkedListBoxControl_OverStatus"; - this.checkedListBoxControl_OverStatus.Size = new System.Drawing.Size(103, 170); + this.checkedListBoxControl_OverStatus.Size = new System.Drawing.Size(106, 138); this.checkedListBoxControl_OverStatus.TabIndex = 4; // // groupBox1 // this.groupBox1.Controls.Add(this.comboBoxEdit_CandleDateTime); - this.groupBox1.Location = new System.Drawing.Point(312, 23); + this.groupBox1.Location = new System.Drawing.Point(3, 162); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(109, 55); + this.groupBox1.Size = new System.Drawing.Size(151, 55); this.groupBox1.TabIndex = 13; this.groupBox1.TabStop = false; this.groupBox1.Text = "봉 시간 단위"; @@ -124,7 +131,7 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm this.comboBoxEdit_CandleDateTime.Name = "comboBoxEdit_CandleDateTime"; this.comboBoxEdit_CandleDateTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); - this.comboBoxEdit_CandleDateTime.Size = new System.Drawing.Size(97, 20); + this.comboBoxEdit_CandleDateTime.Size = new System.Drawing.Size(139, 20); this.comboBoxEdit_CandleDateTime.TabIndex = 5; // // groupBox_Spec @@ -241,9 +248,9 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm // groupBox5 // this.groupBox5.Controls.Add(this.checkedListBoxControl_IndicatorOver); - this.groupBox5.Location = new System.Drawing.Point(542, 23); + this.groupBox5.Location = new System.Drawing.Point(133, 1); this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(109, 188); + this.groupBox5.Size = new System.Drawing.Size(109, 136); this.groupBox5.TabIndex = 14; this.groupBox5.TabStop = false; this.groupBox5.Text = "Indicator Over"; @@ -254,13 +261,13 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm this.checkedListBoxControl_IndicatorOver.Dock = System.Windows.Forms.DockStyle.Fill; this.checkedListBoxControl_IndicatorOver.Location = new System.Drawing.Point(3, 18); this.checkedListBoxControl_IndicatorOver.Name = "checkedListBoxControl_IndicatorOver"; - this.checkedListBoxControl_IndicatorOver.Size = new System.Drawing.Size(103, 167); + this.checkedListBoxControl_IndicatorOver.Size = new System.Drawing.Size(103, 115); this.checkedListBoxControl_IndicatorOver.TabIndex = 5; // // groupBox4 // this.groupBox4.Controls.Add(this.checkedListBoxControl_PriceType); - this.groupBox4.Location = new System.Drawing.Point(312, 78); + this.groupBox4.Location = new System.Drawing.Point(18, 1); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(109, 136); this.groupBox4.TabIndex = 14; @@ -276,19 +283,43 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm this.checkedListBoxControl_PriceType.Size = new System.Drawing.Size(103, 115); this.checkedListBoxControl_PriceType.TabIndex = 5; // + // xtraTabControl1 + // + this.xtraTabControl1.Location = new System.Drawing.Point(318, 23); + this.xtraTabControl1.Name = "xtraTabControl1"; + this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1; + this.xtraTabControl1.Size = new System.Drawing.Size(300, 194); + this.xtraTabControl1.TabIndex = 15; + this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { + this.xtraTabPage1, + this.xtraTabPage2}); + // + // xtraTabPage1 + // + this.xtraTabPage1.Controls.Add(this.groupBox4); + this.xtraTabPage1.Controls.Add(this.groupBox5); + this.xtraTabPage1.Name = "xtraTabPage1"; + this.xtraTabPage1.Size = new System.Drawing.Size(294, 165); + this.xtraTabPage1.Text = "단순 비교"; + // + // xtraTabPage2 + // + this.xtraTabPage2.Controls.Add(this.groupBox2); + this.xtraTabPage2.Name = "xtraTabPage2"; + this.xtraTabPage2.Size = new System.Drawing.Size(294, 165); + this.xtraTabPage2.Text = "돌파 비교"; + // // IchimokuCloudSetupForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.groupBox4); - this.Controls.Add(this.groupBox5); + this.Controls.Add(this.xtraTabControl1); this.Controls.Add(this.groupBox3); - this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox_Spec); this.Controls.Add(this.labelControl_IndicatorName); this.Name = "IchimokuCloudSetupForm"; - this.Size = new System.Drawing.Size(784, 240); + this.Size = new System.Drawing.Size(1283, 235); this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_CustomCondition.Properties)).EndInit(); this.groupBox2.ResumeLayout(false); @@ -306,6 +337,10 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm ((System.ComponentModel.ISupportInitialize)(this.checkedListBoxControl_IndicatorOver)).EndInit(); this.groupBox4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.checkedListBoxControl_PriceType)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).EndInit(); + this.xtraTabControl1.ResumeLayout(false); + this.xtraTabPage1.ResumeLayout(false); + this.xtraTabPage2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -335,5 +370,8 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm private DevExpress.XtraEditors.CheckedListBoxControl checkedListBoxControl_IndicatorOver; private System.Windows.Forms.GroupBox groupBox4; private DevExpress.XtraEditors.CheckedListBoxControl checkedListBoxControl_PriceType; + private DevExpress.XtraTab.XtraTabControl xtraTabControl1; + private DevExpress.XtraTab.XtraTabPage xtraTabPage1; + private DevExpress.XtraTab.XtraTabPage xtraTabPage2; } } diff --git a/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.cs b/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.cs index 9d36d4f..f973c89 100644 --- a/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.cs +++ b/Million Hunter/HunterSubForm/IndicatorSetupForm/IchimokuCloudSetupForm.cs @@ -207,7 +207,8 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm _ichimokuConditionSetup.Description += item.ToString() + ','; } else if (value.GetType() == typeof(string) || - value.GetType() == typeof(CommonProperty.BuySellType)) continue; + value.GetType() == typeof(CommonProperty.BuySellType) || + value.GetType() == typeof(CommonProperty.IndicatorType)) continue; else _ichimokuConditionSetup.Description += value.ToString() + ','; diff --git a/Million Hunter/MainForm.cs b/Million Hunter/MainForm.cs index 728c978..5fb571f 100644 --- a/Million Hunter/MainForm.cs +++ b/Million Hunter/MainForm.cs @@ -10,10 +10,6 @@ using System.Windows.Forms; using Million.Data; using Million.FileDBManagement; using Million.SaveData; -using Million.Indicators; -using Million.DbManagement; -using System.Linq; -using Million.Manager; namespace Million_Hunter { @@ -67,10 +63,6 @@ namespace Million_Hunter simpleButton_SetupDelete.Visible = false; simpleButton_TobuyList.Visible = true; simpleButton_ToSellList.Visible = true; - - - //Db에 있는 Market List 가져옴 - DbServiceFunctions.GetMarketTable_FromDB("Upbit"); } // 지표 콤보박스 클릭 시 이벤트 @@ -290,43 +282,9 @@ namespace Million_Hunter // 조건 검색을 반영하여 데이터 계산 private void simpleButton_CalcurateData_Click(object sender, EventArgs e) { - // 예외 처리 - var buyIndicatorList = IndicatorSetupManager.InitDataSetup(_saveResultData.BuySetupList); - var sellIndicatorList = IndicatorSetupManager.InitDataSetup(_saveResultData.SellSetupList); - - var totalIndicator = new List(); - totalIndicator.AddRange(buyIndicatorList); - totalIndicator.AddRange(sellIndicatorList); - - var candleTypeList = totalIndicator.Select(t => t.MCandleTimeType).ToList(); - candleTypeList = candleTypeList.Distinct().ToList(); - - var tableList = CommonProperty.selectedMarketOfPlaceList; - - //임시로 하나만 - var selectTable = tableList.FirstOrDefault(t => t.CodeFullName == "KRW-BTC"); - //data setting - var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator); - - var dic = new Dictionary(); - - foreach(var item in candleTypeList) - { - dic[item] = DbServiceFunctions.GetCandleData(selectTable, _saveResultData.StartDateTime, _saveResultData.EndDateTime, item); - - var indicatorSetUpList = distinctIndicator.Where(t => t.MCandleTimeType == item).ToList(); - foreach(var setup in indicatorSetUpList) - { - setup.excute(dic[item].CandleDataLists_Im); - } - } // 1. 계산하기 - - - - // CalcurateData(_saveResultData); // 2. 계산 결과 데이터 관련 클래스에 값 채우기 @@ -337,7 +295,7 @@ namespace Million_Hunter _saveResultData.RegularExpression = textEdit_RegularExpression.Text; // 3. 자동으로 저장하기 - FileManager.SaveToBinaryFile(_saveResultData); + FileManager.SaveResultDataToFile(_saveResultData); } diff --git a/Million/FileManagement/FileContoler.cs b/Million/FileManagement/FileContoler.cs index f578937..804ed25 100644 --- a/Million/FileManagement/FileContoler.cs +++ b/Million/FileManagement/FileContoler.cs @@ -5,6 +5,10 @@ using System.Linq; using System.Runtime.Serialization.Formatters.Binary; using System.Text; using System.Threading.Tasks; +using DevExpress.Xpo; +using DocumentFormat.OpenXml.Drawing; +using Million.Data; +using Million.SaveData; namespace Million.FileDBManagement { @@ -63,8 +67,36 @@ namespace Million.FileDBManagement return true; } + // Save Info 파일 확장자 + private static string _infoExtend = ".info"; + // Save 결과 리스트 파일 확장자 + private static string _dataExtend = ".data"; + + // 결과데이터 저장하기 + public static bool SaveResultDataToFile(SavedResultData savedResultData) + { + // Info 파일 생성하기 + var guid = Guid.NewGuid(); + return SaveToBinaryFile(savedResultData, guid.ToString() + _infoExtend) && + SaveToBinaryFile(savedResultData.SearchResultList, guid.ToString() + _dataExtend); + } + + // 결과 데이터 정보 불러오기 + public static SavedResultData LoadResultDataInfoFromFile(string fileFullPath) + { + var savedResultData = (SavedResultData) LoadFormBinaryFile(fileFullPath); + return savedResultData; + } + + public static List LoadResultDataFromFile(string fileFullPath) + { + var savedResultData = (List)LoadFormBinaryFile(fileFullPath); + return savedResultData; + + } + // 클래스 Binary 파일로 저장 - public static bool SaveToBinaryFile(object saveData) + public static bool SaveToBinaryFile(object saveData, string fileName) { var baBinaryFormatter = new BinaryFormatter(); @@ -72,13 +104,12 @@ namespace Million.FileDBManagement { var directoryInfo = new DirectoryInfo(CommonProperty.SaveProgramDirecotryPath); + var fileFullPath = string.Format(@"{0}\{1}",directoryInfo.FullName, fileName); + // 폴더 없으면 파일 생성 if (!directoryInfo.Exists) directoryInfo.Create(); - var fileFullPath = - string.Format(@"{0}\{1}.savedata", directoryInfo.FullName, DateTime.Now.ToString("yyyyMMdd_HH_mm_ss")); - Stream stream = File.Create(fileFullPath); baBinaryFormatter.Serialize(stream, saveData); @@ -90,7 +121,6 @@ namespace Million.FileDBManagement } // Biarny 파일을 Class로 로드 - public static object LoadFormBinaryFile(string fileFullPath) { var baBinaryFormatter = new BinaryFormatter(); diff --git a/Million/SaveData/SavedResultData.cs b/Million/SaveData/SavedResultData.cs index 50164bc..7a1e75c 100644 --- a/Million/SaveData/SavedResultData.cs +++ b/Million/SaveData/SavedResultData.cs @@ -26,6 +26,7 @@ namespace Million.SaveData // 정규식 public string RegularExpression { get; set; } + [field: NonSerialized] // 결과 데이터 public List SearchResultList { get; set; } @@ -37,4 +38,5 @@ namespace Million.SaveData // 조건식 요약 public string IndicatorSetup { get; set; } } + }