From 8de7d981eb80203310a140341dee1083cf9bd437 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Tue, 31 Oct 2023 09:58:24 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B5=9C=EC=8B=A0?= =?UTF-8?q?=ED=99=94=20=EC=B2=98=EB=A6=AC=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million Buyer/MainForm.cs | 32 ++++++++++++---------- Million Hunter/HunterMainForm.cs | 14 +++++----- Million/CommonProperty.cs | 2 +- Million/DbMangement/DBConnection.cs | 3 +- Million/DbMangement/DBServiceFunctions.cs | 14 +++++++--- Million/WebMangement/Upbit/UpbitProcess.cs | 3 +- 6 files changed, 39 insertions(+), 29 deletions(-) diff --git a/Million Buyer/MainForm.cs b/Million Buyer/MainForm.cs index 29c5ff6..11f65fb 100644 --- a/Million Buyer/MainForm.cs +++ b/Million Buyer/MainForm.cs @@ -76,6 +76,11 @@ namespace Million_Buyer { InitManager.InitFunc("Upbit", PaymentType.KRW); + cb_BigMoneyVolType.Properties.Items.Clear(); + cb_BigMoneyVolType.Properties.Items.AddRange(InitManager.GetCandleTimeTypes()); + cb_BuyBigthanHighType.Properties.Items.Clear(); + cb_BuyBigthanHighType.Properties.Items.AddRange(InitManager.GetCandleTimeTypes()); + _saveResultData = new SavedResultData { BuySetupList = new List(), @@ -161,10 +166,10 @@ namespace Million_Buyer int.TryParse(tb_BigMoneyVolCnt.Text, out BigMoneyVolCnt); BigMoneyVolFlag = ck_BigMoneyVol.Checked; - BigMoneyVolType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.ToString()); + BigMoneyVolType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString()); BuyBigthanHighValFlag = ck_BuyBigthanHighVal.Checked; - BuyBigthanHighValType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), BuyBigthanHighValType.ToString()); + BuyBigthanHighValType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString()); bt_BuyStart_Click(null, null); @@ -508,15 +513,6 @@ namespace Million_Buyer { if (overlapBuyManagementList[item]) { - InsertLog("Insert Buy Logic"); - if (programMode == BuyerMode.Buyer) - { - LogManager.WriteLog("Buy CoinFullName : " + item + "\r\nCandleData : " + JsonConvert.SerializeObject(recentlyData), "BuySell"); - InsertLog("Buy Coin Name : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); - if (buyCycleCount >= cycleCount) - continue; - } - if (StarValueLowBuyValueUp) { //if (recentlyData.StartValue < beforeData.HighValue) @@ -561,11 +557,11 @@ namespace Million_Buyer } else if ((int)BigMoneyVolType < 1440) { - date = date.AddHours(((int)BigMoneyVolType * BigMoneyVolCnt) * -1); + date = date.AddHours((((int)BigMoneyVolType / 60) * BigMoneyVolCnt) * -1); } //임시 5개 비교 - var tempList = compareList.Where(t => t.DateTime >= date).ToList(); + var tempList = compareList.Where(t => t.DateTime > date).ToList(); tempList.Remove(recentlyCompareData); var maxVol = tempList.Max(t => t.MoneyVolume); if (maxVol > recentlyCompareData.MoneyVolume) @@ -575,8 +571,14 @@ namespace Million_Buyer } } #endregion - - + InsertLog("Insert Buy Logic"); + if (programMode == BuyerMode.Buyer) + { + LogManager.WriteLog("Buy CoinFullName : " + item + "\r\nCandleData : " + JsonConvert.SerializeObject(recentlyData), "BuySell"); + InsertLog("Buy Coin Name : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss")); + if (buyCycleCount >= cycleCount) + continue; + } sw.Restart(); //if (resultDataList.Select(t => t.MarketData).ToList().Any(t => t.CoinFullName == item)) continue; var time = DateTime.Now; diff --git a/Million Hunter/HunterMainForm.cs b/Million Hunter/HunterMainForm.cs index 8cd8b5d..fbe5749 100644 --- a/Million Hunter/HunterMainForm.cs +++ b/Million Hunter/HunterMainForm.cs @@ -285,8 +285,8 @@ namespace Million CommonProperty.InsertLogFlag = false; int.TryParse(tb_BigMoneyVolCnt.Text, out int val); CalculateDatas(_saveResultData, cb_UpperMainIndi.Checked, cb_IncludeClearIndicator.Checked, cb_DownBeforeValueFlag.Checked, rd_Hunter.Checked, - ck_BigMoneyVol.Checked, (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.ToString()), - ck_BuyBigthanHighVal.Checked, (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BuyBigthanHighType.ToString()), val); + ck_BigMoneyVol.Checked, (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString()), + ck_BuyBigthanHighVal.Checked, (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BuyBigthanHighType.Text.ToString()), val); // 3. 자동으로 저장하기 if (DBConnection.QueryInsertExecuter_SavedResultData(_saveResultData)) @@ -657,15 +657,15 @@ namespace Million if((int)bigMoneyVolType < 60) { - date = date.AddMinutes(((int)bigMoneyVolType * bigMoneyVolCnt)*-1); + date = date.AddMinutes(((int)bigMoneyVolType * bigMoneyVolCnt) * -1); } else if((int)bigMoneyVolType < 1440) { - date = date.AddHours(((int)bigMoneyVolType * bigMoneyVolCnt) * -1); + date = date.AddHours((((int)bigMoneyVolType /60) * bigMoneyVolCnt) * -1); } //임시 5개 비교 - var tempList = compareList.Where(t => t.DateTime >= date).ToList(); + var tempList = compareList.Where(t => t.DateTime > date).ToList(); tempList.Remove(recentlyCompareData); var maxVol = tempList.Max(t => t.MoneyVolume); if (maxVol > recentlyCompareData.MoneyVolume) @@ -1136,7 +1136,7 @@ namespace Million if (data.BigMoneyVolFlag) { - data.BigMoneyVolType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.ToString()); + data.BigMoneyVolType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString()); int.TryParse(tb_BigMoneyVolCnt.Text, out int val); if (val == 0) val = 1; data.BigMoneyVolCnt = val; @@ -1146,7 +1146,7 @@ namespace Million if (data.BuyBigthanHighValFlag) { - data.BuyBigthanHighValType= (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BuyBigthanHighType.ToString()); + data.BuyBigthanHighValType= (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BuyBigthanHighType.Text.ToString()); } multiSavedResultDatas.Add(data); diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 2deba5a..2cbf05e 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -316,7 +316,7 @@ namespace Million //TODO 추후 관리 방안 고려 #region # 데이터 베이스 정보 # - public const string DbServerIp = "220.123.49.58"; + public const string DbServerIp = "59.26.54.110"; public const string DbServerUserId = "million"; public const string DbServerUserPassword = "million!"; public static string DbConnectionStr = $"Data Source={DbServerIp};uid={DbServerUserId};pwd={DbServerUserPassword};Database="; diff --git a/Million/DbMangement/DBConnection.cs b/Million/DbMangement/DBConnection.cs index e84800f..74285a9 100644 --- a/Million/DbMangement/DBConnection.cs +++ b/Million/DbMangement/DBConnection.cs @@ -833,6 +833,7 @@ namespace Million.DbManagement /// public static List QueryGetExecuter_SavedResultData(List idList = null, bool includeFolder = true) { + //,[SellExceptionRegularExpression] var returnData = new List(); var sqlQuery = @"SELECT [Id] ,[ParentId] @@ -915,7 +916,7 @@ namespace Million.DbManagement int.TryParse(rdr["ResultDataCount"]?.ToString(), out var resultDataCount); data.ResultDataCount = resultDataCount; - + double.TryParse(rdr["WinRate"]?.ToString(), out var winRate); data.WinRate = winRate; double.TryParse(rdr["ProfitRate"]?.ToString(), out var profitRate); diff --git a/Million/DbMangement/DBServiceFunctions.cs b/Million/DbMangement/DBServiceFunctions.cs index 96a404d..4bfc911 100644 --- a/Million/DbMangement/DBServiceFunctions.cs +++ b/Million/DbMangement/DBServiceFunctions.cs @@ -51,6 +51,7 @@ namespace Million.DbManagement SellSetupList varbinary(MAX) NULL, BuyRegularExpression varchar(100) NOT NULL, SellRegularExpression varchar(100) NOT NULL, + SellExceptionRegularExpression varchar(100) NULL, SearchResultList varbinary(MAX) NULL, ResultDataCount int NOT NULL, WinRate float NOT NULL, @@ -537,7 +538,7 @@ namespace Million.DbManagement /// public static string InsertRealTimeIndicatorQuery(SavedResultData item, string name) { - + var str = string.Format(@"INSERT INTO [ResultData].[dbo].[RealTimeIndicator] ( [Name] @@ -572,7 +573,7 @@ namespace Million.DbManagement /// public static string InsertSavedResultDataQuery(SavedResultData item) { - + //,[SellExceptionRegularExpression] var str = string.Format(@"INSERT INTO [ResultData].[dbo].[SavedResultData] ( [ParentId] @@ -594,6 +595,7 @@ namespace Million.DbManagement ,[Type] ,[SaveResultType] ,[Description] + ,[SellExceptionRegularExpression] )VALUES( '{0}', '{1}', @@ -613,7 +615,8 @@ namespace Million.DbManagement '{12}', '{13}', '{14}', - '{15}' + '{15}', + '{16} );", item.ParentId, item.Name, @@ -630,8 +633,11 @@ namespace Million.DbManagement item.ExchangePlace, item.Type, item.SaveResultType, - item.Description + item.Description, + item.SellExceptionRegularExpression ); + + //, return str; } diff --git a/Million/WebMangement/Upbit/UpbitProcess.cs b/Million/WebMangement/Upbit/UpbitProcess.cs index e7f2589..7c4d709 100644 --- a/Million/WebMangement/Upbit/UpbitProcess.cs +++ b/Million/WebMangement/Upbit/UpbitProcess.cs @@ -38,7 +38,8 @@ namespace Million.WebMangement.Upbit if (nvc != null) url += "?" + ToQueryString(nvc, true); var requestMessage = new HttpRequestMessage(httpMethod, new Uri(url)); - requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", CreateJwt(nvc)); + if(nvc != null) + requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", CreateJwt(nvc)); var response = httpClient.SendAsync(requestMessage).Result; if (response.Headers.Contains("Date"))