From d69e6310a3d44d05b2c5c37fec7631e61b163f0b Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Wed, 30 Nov 2022 11:28:12 +0900 Subject: [PATCH] =?UTF-8?q?hunter=20realtime=20=EB=AA=A8=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=99=84=201.=20Log=20manager=20=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=97=AC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=202.=20Json=20=EB=A9=94=EB=AA=A8?= =?UTF-8?q?=EB=A6=AC=EC=B0=B8=EC=A1=B0=EA=B4=80=EB=A0=A8=20Serialize?= =?UTF-8?q?=ED=95=A0=EB=95=8C=20=EC=97=90=EB=9F=AC=20=EC=95=88=EB=82=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20JsonIgnore=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million Hunter/HunterMainForm.cs | 40 +++++++++++++++++++++-------- Million/CommonProperty.cs | 2 ++ Million/Data/CandleData.cs | 4 ++- Million/Manager/CalculateManager.cs | 2 +- Million/Manager/DataManager.cs | 25 +++++++++++++++++- Million/Manager/LogManager.cs | 2 ++ 6 files changed, 61 insertions(+), 14 deletions(-) diff --git a/Million Hunter/HunterMainForm.cs b/Million Hunter/HunterMainForm.cs index 0b7e860..93a4458 100644 --- a/Million Hunter/HunterMainForm.cs +++ b/Million Hunter/HunterMainForm.cs @@ -289,6 +289,8 @@ namespace Million CommonProperty.DownBeforeValueFlag = cb_DownBeforeValueFlag.Checked; var hunterMode = rd_Hunter.Checked; + + var buyScript = new InteratorScripter("Buy Script"); buyScript.regularExpressionString = _saveResultData.BuyRegularExpression; @@ -297,10 +299,13 @@ namespace Million var sellExceptionScript = new InteratorScripter("Sell Exception Script"); sellExceptionScript.regularExpressionString = _saveResultData.SellExceptionRegularExpression; + CommonProperty.InsertLogFlag = false; + Parallel.For(0, tableList.Count, i => { - var market = tableList[i]; - var item = market.CoinFullName; + // for (var i = 0; i < tableList.Count; i++) + //{ + var market = tableList[i]; var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator); if (hunterMode) @@ -313,6 +318,7 @@ namespace Million totalResultList.AddRange(CalculateHunterRealtime(totalIndicator, startDate, endDate, market, distinctIndicator, overlapBuyManagementList, buyScript, sellScript, sellExceptionScript)); } + //} }); //수익 률 계산 로직 -> 이거는 추후 빼도 될듯 @@ -425,19 +431,18 @@ namespace Million var mTotalDataList = DbServiceFunctions.GetCandleData(market, startDate, endDate); foreach (var minData in mTotalDataList.CandleDataLists_Im) { - - var compareMin = standardData[CommonProperty.MCandleTimeType.M1].LastOrDefault(); - if (compareMin.DateTime == minData.DateTime) continue; + if (compareMin == null || compareMin.DateTime == minData.DateTime || compareMin.DateTime > minData.DateTime) continue; //remove standardData[CommonProperty.MCandleTimeType.M1].RemoveAt(0); if (standardData[CommonProperty.MCandleTimeType.H1].Count > 300) standardData[CommonProperty.MCandleTimeType.H1].RemoveAt(0); + //1분씩 증가하면서 1h 처리 minData.RecentlyDataFlag = true; standardData[CommonProperty.MCandleTimeType.M1].Add(minData); - + var compareHour = standardData[CommonProperty.MCandleTimeType.H1].LastOrDefault(); if (compareHour.DateTime.Hour != minData.DateTime.Hour) @@ -460,13 +465,14 @@ namespace Million } else { - compareHour.HighValue = compareHour.HighValue < compareMin.HighValue ? compareMin.HighValue : compareHour.HighValue; - compareHour.LowValue = compareHour.LowValue < compareMin.LowValue ? compareMin.LowValue : compareHour.LowValue; - compareHour.EndValue = compareMin.EndValue; + compareHour.HighValue = compareHour.HighValue < minData.HighValue ? minData.HighValue : compareHour.HighValue; + compareHour.LowValue = compareHour.LowValue < minData.LowValue ? compareHour.LowValue : minData.LowValue; + compareHour.EndValue = minData.EndValue; compareHour.RecentlyDataFlag = true; } - //1분씩 증가하면서 1h 처리 + standardData = DataManager.GetExecuteData(standardData, totalIndicator); + var minDateTime = standardData[CommonProperty.MCandleTimeType.M1].Select(t => t.DateTime).Min(); var maxDateTime = standardData[CommonProperty.MCandleTimeType.M1].Select(t => t.DateTime).Max().AddHours(1); @@ -488,7 +494,6 @@ namespace Million if (!buyList.Any(t => t.ConGoodsData.CoinFullName == item)) { - var flag = buyScript.DicExcuteScript(recentlyData.CalculateFlag); if (flag) { @@ -559,6 +564,19 @@ namespace Million } } } + + if(buyList.Count > 0) + { + foreach(var buy in buyList) + { + var lastData = mTotalDataList.CandleDataLists_Im.LastOrDefault(); + lastData.SellValue = lastData.EndValue; + lastData.SellTime = new DateTime(2000, 1, 1); + var result = DataManager.GetBuyerSearchResult(buy.CandleDataLists_Im[0], mTotalDataList.CandleDataLists_Im.LastOrDefault(), buy.ConGoodsData); + resultData.Add(result); + } + } + return resultData; } diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 220c7bb..37072e4 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -338,6 +338,8 @@ namespace Million public static string DataExtend = ".data"; // Save 결과 분석 데이터 public static string AnalysisExtendFolder = "_analysis"; + + public static bool InsertLogFlag = true; #endregion #region Buyer Flag diff --git a/Million/Data/CandleData.cs b/Million/Data/CandleData.cs index ac542a4..6365a0e 100644 --- a/Million/Data/CandleData.cs +++ b/Million/Data/CandleData.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using static Million.CommonProperty; @@ -37,6 +38,7 @@ namespace Million.Data public Dictionary SellLogicFlag { get; set; } = new Dictionary(); public Dictionary CalculateFlag { get; set; } = new Dictionary(); + [JsonIgnore] public Dictionary ParentCandleData = new Dictionary(); diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index f0f531d..1c2feaa 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -679,7 +679,7 @@ namespace Million.Manager if (recentlyDataFlag) { - if (!subManagement[coinFullName]) + if (!subManagement[coinFullName] && CommonProperty.InsertLogFlag) { str = "Buyer(Realtime) Mode\r\n"; str += coinFullName + " 최초 돌파 Sub조건 초기화 됨\r\n"; diff --git a/Million/Manager/DataManager.cs b/Million/Manager/DataManager.cs index 36c387a..d03eb64 100644 --- a/Million/Manager/DataManager.cs +++ b/Million/Manager/DataManager.cs @@ -69,7 +69,7 @@ namespace Million.Manager } /// - /// Recently Data관련 Data Setting 및 데이터 들고오기 + /// Data Indicator Execute /// /// /// @@ -94,6 +94,29 @@ namespace Million.Manager return dic; } + /// + /// Data Indicator Execute + /// + /// + /// + /// + public static Dictionary> GetExecuteData(Dictionary> dataList, List totalIndicatorList) + { + var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicatorList); + + foreach (var key in dataList.Keys) + { + var indicatorSetUpList = distinctIndicator.Where(t => t.MCandleTimeType == key).ToList(); + foreach (var setup in indicatorSetUpList) + { + setup.excute(dataList[key], true); + } + } + return dataList; + } + + + /// /// Sub Indicator List String 반환 Function /// diff --git a/Million/Manager/LogManager.cs b/Million/Manager/LogManager.cs index b3f3b4f..f0960e8 100644 --- a/Million/Manager/LogManager.cs +++ b/Million/Manager/LogManager.cs @@ -25,6 +25,8 @@ namespace Million.Manager /// public static bool WriteLog(string message, string coinFullName = "") { + if (!CommonProperty.InsertLogFlag) return false; + if (coinFullName == "") coinFullName = "common"; var returnData = true; var defaultMesage = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "=>" + message +"\r\n";