From 0f3145d92793cb53f5653ed25904d4ec272a0122 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Tue, 18 Oct 2022 16:23:43 +0900 Subject: [PATCH] =?UTF-8?q?Hunter=20Error=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataSaver/MainForm.cs | 6 +- Million Buyer/MainForm.Designer.cs | 96 +++++++++++++----- Million Buyer/MainForm.cs | 98 +++++++++++++++++-- Million Buyer/Million Buyer.csproj | 4 + Million Buyer/Properties/licenses.licx | 1 + Million Buyer/packages.config | 1 + Million Hunter/HunterMainForm.cs | 26 ++--- .../HunterSubForm/ResultViewerForm.cs | 2 +- Million Hunter/Million Hunter.csproj | 1 + Million/CommonProperty.cs | 2 + Million/Data/MarketData.cs | 2 +- Million/DbMangement/DBConnection.cs | 4 +- Million/DbMangement/DBServiceFunctions.cs | 9 +- Million/Manager/CalculateManager.cs | 4 +- Million/Manager/InteratorScripter.cs | 5 + Million/WebMangement/Upbit/UpbitAPI.cs | 12 ++- Million/WebMangement/WebServiceFunctions.cs | 10 +- 17 files changed, 218 insertions(+), 65 deletions(-) create mode 100644 Million Buyer/Properties/licenses.licx diff --git a/DataSaver/MainForm.cs b/DataSaver/MainForm.cs index ae1f8fe..776c366 100644 --- a/DataSaver/MainForm.cs +++ b/DataSaver/MainForm.cs @@ -77,7 +77,7 @@ namespace DataSaver // 데이터 입력 var marketList = CommonProperty.selectedMarketOfPlaceList; - comboBoxEdit_MarketInfo.Properties.Items.AddRange(marketList.Select(t => t.CodeName).ToList()); + comboBoxEdit_MarketInfo.Properties.Items.AddRange(marketList.Select(t => t.CoinName).ToList()); } /// @@ -205,9 +205,9 @@ namespace DataSaver { if (!dbMarketDataList.Any(t => t.CoinFullName == data.CoinFullName)) sqlQuery += string.Format( - "INSERT INTO [dbo].[{0}]([CoinFullName], [ExchangePlace], [KorName], [CodeName], [Payment], [IsValid]) VALUES ('{1}','{2}','{3}','{4}','{5}',{6})", + "INSERT INTO [dbo].[{0}]([CoinFullName], [ExchangePlace], [KorName], [CoinName], [Payment], [IsValid]) VALUES ('{1}','{2}','{3}','{4}','{5}',{6})", comboBoxEdit_ExchangePlace.SelectedItem, data.CoinFullName, - data.ExchangePlace, data.KorName, data.CodeName, data.Payment, 1); + data.ExchangePlace, data.KorName, data.CoinName, data.Payment, 1); } foreach (var data in dbMarketDataList) diff --git a/Million Buyer/MainForm.Designer.cs b/Million Buyer/MainForm.Designer.cs index 027cbb9..f47c4db 100644 --- a/Million Buyer/MainForm.Designer.cs +++ b/Million Buyer/MainForm.Designer.cs @@ -74,11 +74,15 @@ 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_Money = new System.Windows.Forms.TextBox(); + this.tb_Price = new System.Windows.Forms.TextBox(); this.lb_CoinFullName = new System.Windows.Forms.Label(); - this.lb_Money = 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.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tl_BuyList)).BeginInit(); @@ -502,9 +506,11 @@ // lb_log // 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.Name = "lb_log"; + this.lb_log.ScrollAlwaysVisible = true; this.lb_log.Size = new System.Drawing.Size(362, 316); this.lb_log.TabIndex = 16; // @@ -520,64 +526,106 @@ // // tb_CoinFullName // - this.tb_CoinFullName.Location = new System.Drawing.Point(423, 737); + 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; // - // tb_Money + // tb_Price // - this.tb_Money.Location = new System.Drawing.Point(606, 738); - this.tb_Money.Name = "tb_Money"; - this.tb_Money.Size = new System.Drawing.Size(100, 21); - this.tb_Money.TabIndex = 18; + 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; // // lb_CoinFullName // this.lb_CoinFullName.AutoSize = true; - this.lb_CoinFullName.Location = new System.Drawing.Point(324, 742); + 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"; // - // lb_Money + // lb_Price // - this.lb_Money.AutoSize = true; - this.lb_Money.Location = new System.Drawing.Point(556, 742); - this.lb_Money.Name = "lb_Money"; - this.lb_Money.Size = new System.Drawing.Size(44, 12); - this.lb_Money.TabIndex = 20; - this.lb_Money.Text = "Money"; + 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"; // // bt_Buy // - this.bt_Buy.Location = new System.Drawing.Point(712, 738); + 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); // // bt_Sell // - this.bt_Sell.Location = new System.Drawing.Point(793, 738); + 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); + // + // lb_Volume + // + 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"; + // + // tb_Volume + // + 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; + // + // bt_Search + // + 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); + // + // bt_Cancel + // + 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); // // 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_Money); + this.Controls.Add(this.lb_Price); this.Controls.Add(this.lb_CoinFullName); - this.Controls.Add(this.tb_Money); + this.Controls.Add(this.tb_Price); this.Controls.Add(this.tb_CoinFullName); this.Controls.Add(this.bt_alive); this.Controls.Add(this.lb_log); @@ -653,11 +701,15 @@ 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_Money; + private System.Windows.Forms.TextBox tb_Price; private System.Windows.Forms.Label lb_CoinFullName; - private System.Windows.Forms.Label lb_Money; + 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; } } diff --git a/Million Buyer/MainForm.cs b/Million Buyer/MainForm.cs index 6511ea8..0b7d915 100644 --- a/Million Buyer/MainForm.cs +++ b/Million Buyer/MainForm.cs @@ -2,11 +2,13 @@ using Microsoft.CodeAnalysis.CSharp.Scripting; using Million; using Million.Data; +using Million.Data.Upbit.Order; using Million.DbManagement; using Million.IndicatorConditionSetup; using Million.Manager; using Million.SaveData; using Million_Buyer.SubForm; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; @@ -38,7 +40,7 @@ namespace Million_Buyer Thread thread = null; - + List orderList = new List(); public MainForm() { @@ -272,13 +274,7 @@ namespace Million_Buyer InsertLog("Ticker 계산 시간 : " + sw.Elapsed.ToString()); } } - #endregion - - if (AliveCheck) - { - InsertLog("Alive Check Log"); - AliveCheck = false; - } + #endregion //Ticker 초기화 if (DateTime.Now.Minute == 0 && saveFlag) @@ -609,10 +605,92 @@ namespace Million_Buyer lb_log.Items.Insert(0, log); })); } - + /// + /// Thread 가 살아 있는지 확인 + /// + /// + /// private void bt_alive_Click(object sender, EventArgs e) { - AliveCheck = true; + if (thread != null && thread.IsAlive) + InsertLog("Thread Alive."); + else + InsertLog("Thread Death."); + } + + #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); + var side = UpbitOrderSide.bid; + var ordType = UpbitOrderType.limit; + + if (string.IsNullOrWhiteSpace(price)) + ordType = UpbitOrderType.price; + var returnData = CommonProperty.UpbitApi.TryOrder(coinFullName, side, volume, priceData, ordType); + InsertLog("------------------------------------"); + InsertLog("Buy Return Data : " + JsonConvert.SerializeObject(returnData)); + InsertLog("------------------------------------"); + } + + 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); + + var side = UpbitOrderSide.ask; + var ordType = UpbitOrderType.limit; + + if (string.IsNullOrWhiteSpace(price)) + ordType = UpbitOrderType.market; + + var returnData = CommonProperty.UpbitApi.TryOrder(coinFullName, side, volume, priceData, ordType); + InsertLog("------------------------------------"); + InsertLog("Sell Return Data : " + JsonConvert.SerializeObject(returnData)); + InsertLog("------------------------------------"); + } + #endregion + + private void bt_Cancel_Click(object sender, EventArgs e) + { + InsertLog("------------------------------------"); + InsertLog("Order Cancel"); + + foreach (var item in this.orderList) + { + if(item.State == "wait" || item.State == "watch") + { + var returnData = CommonProperty.UpbitApi.CancelOrder(item.Uuid); + InsertLog("Order Cancel Data : " + JsonConvert.SerializeObject(returnData)); + } + } + InsertLog("------------------------------------"); } } } diff --git a/Million Buyer/Million Buyer.csproj b/Million Buyer/Million Buyer.csproj index 5b95a3f..dfc73b7 100644 --- a/Million Buyer/Million Buyer.csproj +++ b/Million Buyer/Million Buyer.csproj @@ -74,6 +74,9 @@ ..\packages\Microsoft.CodeAnalysis.Scripting.Common.4.3.0\lib\netstandard2.0\Microsoft.CodeAnalysis.Scripting.dll + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll @@ -129,6 +132,7 @@ MainForm.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/Million Buyer/Properties/licenses.licx b/Million Buyer/Properties/licenses.licx new file mode 100644 index 0000000..89458f2 --- /dev/null +++ b/Million Buyer/Properties/licenses.licx @@ -0,0 +1 @@ +DevExpress.XtraTreeList.TreeList, DevExpress.XtraTreeList.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Million Buyer/packages.config b/Million Buyer/packages.config index 013a52b..1b96f1f 100644 --- a/Million Buyer/packages.config +++ b/Million Buyer/packages.config @@ -9,6 +9,7 @@ + diff --git a/Million Hunter/HunterMainForm.cs b/Million Hunter/HunterMainForm.cs index 2fda94e..65b9bc9 100644 --- a/Million Hunter/HunterMainForm.cs +++ b/Million Hunter/HunterMainForm.cs @@ -35,7 +35,7 @@ namespace Million // 마지막 사용된 Index private int _lastIndexString; - + public MainForm() { @@ -215,8 +215,8 @@ namespace Million if (_curIndicatorSetup == null) return; // 해당 List안에 있는 Class를 삭제 - if(_curIndicatorSetup.ByBuySellType == CommonProperty.BuySellType.Buy) - { + if (_curIndicatorSetup.ByBuySellType == CommonProperty.BuySellType.Buy) + { _saveResultData.BuySetupList.RemoveAt(_indexOfList); treeList_BuySetupList.RefreshDataSource(); } @@ -228,9 +228,9 @@ namespace Million // 조건 설정 창 초기화 - _curruentIndicatorform = null; + _curruentIndicatorform = null; panelControl_IndicatorSetup.Controls.Clear(); - comboBoxEdit_IndicatorSelection.Text = ""; + comboBoxEdit_IndicatorSelection.Text = ""; // 지표 새로 추가 시 수정/삭제 버튼 Visible 처리 simpleButton_SetupEdit.Visible = false; @@ -279,10 +279,10 @@ namespace Million var totalIndicator = new List(); totalIndicator.AddRange(buyIndicatorList); - totalIndicator.AddRange(sellIndicatorList); + totalIndicator.AddRange(sellIndicatorList); var tableList = CommonProperty.selectedMarketOfPlaceList; - + var totalResultList = new List(); var startDate = _saveResultData.StartDateTime; @@ -294,7 +294,7 @@ namespace Million Parallel.For(0, tableList.Count, i => { //임시로 하나만 - //for (var i = 0; i < tableList.Count; i++) + // for (var i = 0; i < tableList.Count; i++) //{ var selectTable = tableList[i]; //data setting @@ -320,7 +320,7 @@ namespace Million CalculateManager.GetCalculateIndicator(totalIndicator, subIndStringiList, lossIndicator, startDate, endDate, resultCandleDataList, subIndicator, dic, upperMainIndicatorFlag); - + var totalIndi = totalIndicator.Select(t => t.IndexString).ToList(); // 중복계산 방지 @@ -343,7 +343,7 @@ namespace Million double win = 0; double lose = 0; double firstProfitRate = 0; - double firstWin = 0; + double firstWin = 0; //승률, 수익률 계산 foreach (var item in totalResultList) @@ -407,7 +407,7 @@ namespace Million { simpleButton_ViewResultData.Appearance.BackColor = Color.FromArgb(128, 128, 255); } - + } @@ -421,7 +421,7 @@ namespace Million return; } - var resultViewerForm = new ResultViewerForm(_saveResultData) { StartPosition = FormStartPosition.CenterScreen}; + var resultViewerForm = new ResultViewerForm(_saveResultData) { StartPosition = FormStartPosition.CenterScreen }; resultViewerForm.ShowDialog(); } @@ -464,7 +464,7 @@ namespace Million _saveResultData.StartDateTime = dateEdit_StartDateTime.DateTime; _saveResultData.EndDateTime = dateEdit_EndDateTime.DateTime; _saveResultData.SavedDateTime = DateTime.Now; - if(_saveResultData == null) + if (_saveResultData == null) _saveResultData.SearchResultList = new List(); _saveResultData.BuyRegularExpression = textEdit_BuyRegularExpression.Text; _saveResultData.SellRegularExpression = textEdit_SellRegularExpression.Text; diff --git a/Million Hunter/HunterSubForm/ResultViewerForm.cs b/Million Hunter/HunterSubForm/ResultViewerForm.cs index 150a187..c87f8df 100644 --- a/Million Hunter/HunterSubForm/ResultViewerForm.cs +++ b/Million Hunter/HunterSubForm/ResultViewerForm.cs @@ -127,7 +127,7 @@ namespace Million.HunterSubForm SavedAnalysisData savedAnalysisData = new SavedAnalysisData() { AnalysisDataList = saveDataList, - TreeListFilterString = treeList_ResultData.ActiveFilterString, + TreeListFilterString = treeList_ResultData.ActiveFilterString.Replace("'", ""), Description = textEdit_Description.Text, FirstWinRate = winRate, FirstProfitRate = profitRate, diff --git a/Million Hunter/Million Hunter.csproj b/Million Hunter/Million Hunter.csproj index 125dc9a..8ff2e74 100644 --- a/Million Hunter/Million Hunter.csproj +++ b/Million Hunter/Million Hunter.csproj @@ -134,6 +134,7 @@ HunterMainForm.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index bf6f19d..b807156 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -219,6 +219,8 @@ namespace Million public enum UpbitOrderType { limit, price, market } public enum UpbitCandleKindsType { minutes, days, weeks, months } + public enum UpbitOrderListTypes { wait, watch, done, cancel, waitwatch, donecancel} + public enum UpbitOrderListOrderByType { asc, desc } #endregion #region 빗썸 URL diff --git a/Million/Data/MarketData.cs b/Million/Data/MarketData.cs index 9d85136..0546dcd 100644 --- a/Million/Data/MarketData.cs +++ b/Million/Data/MarketData.cs @@ -10,7 +10,7 @@ namespace Million.Data // 코인 이름 public string KorName { get; set; } // 코인 코드 - public string CodeName { get; set; } + public string CoinName { get; set; } // BTC, KRW 구분 public string Payment { get; set; } // 코인- Payment (Key로 사용) diff --git a/Million/DbMangement/DBConnection.cs b/Million/DbMangement/DBConnection.cs index 7dcf1c3..92d6a0d 100644 --- a/Million/DbMangement/DBConnection.cs +++ b/Million/DbMangement/DBConnection.cs @@ -46,7 +46,7 @@ namespace Million.DbManagement while (rdr.Read()) { var marKetData = new MarketData(); - marKetData.CodeName = rdr["CodeName"].ToString(); + marKetData.CoinName = rdr["CoinName"].ToString(); marKetData.CoinFullName = rdr["CoinFullName"].ToString(); marKetData.ExchangePlace = rdr["ExchangePlace"].ToString(); marKetData.Payment = rdr["Payment"].ToString(); @@ -533,7 +533,7 @@ namespace Million.DbManagement if (resultIdList != null) { - sqlQuery = " [SavedResultDataId] IN("; + sqlQuery += " [SavedResultDataId] IN("; for (var i = 0; i < resultIdList.Count; i++) { sqlQuery += resultIdList[i]; diff --git a/Million/DbMangement/DBServiceFunctions.cs b/Million/DbMangement/DBServiceFunctions.cs index ef1180a..0eb8649 100644 --- a/Million/DbMangement/DBServiceFunctions.cs +++ b/Million/DbMangement/DBServiceFunctions.cs @@ -111,7 +111,7 @@ namespace Million.DbManagement ExchangePlace nvarchar(50) not null, KorName nvarchar(50), CoinFullName nvarchar(50) not null, - CodeName nvarchar(50) not null, + CoinName nvarchar(50) not null, Payment nvarchar(50) not null, IsValid bit not null ) "; @@ -537,10 +537,10 @@ namespace Million.DbManagement '{1}', '{2}', '{3}', + '{4}', @BuySetupList, @SellSetupList, - @SearchResultList, - '{4}', + @SearchResultList, '{5}', '{6}', '{7}', @@ -550,7 +550,8 @@ namespace Million.DbManagement '{11}', '{12}', '{13}', - '{14}' + '{14}', + '{15}' );", item.ParentId, item.Name, diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index 7f14f84..7c77583 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -586,7 +586,9 @@ namespace Million.Manager var firstFlag = false; // realtime(recentlydata가 true일경우)에만 사용하는 데이터 -> 최초 시점 잡기위함 - var subManagement = CommonProperty.subIndicatorStateManagement[setUp.IndexString]; + Dictionary subManagement = null; + if(recentlyDataFlag) + subManagement = CommonProperty.subIndicatorStateManagement[setUp.IndexString]; foreach (var parent in parentCandleDataList) { diff --git a/Million/Manager/InteratorScripter.cs b/Million/Manager/InteratorScripter.cs index 64e8984..07ce14f 100644 --- a/Million/Manager/InteratorScripter.cs +++ b/Million/Manager/InteratorScripter.cs @@ -26,6 +26,7 @@ namespace Million.Manager /// public bool DicExcuteScript(Dictionary RegularExpression) { + try { //중복 검사 var data = rememberDic.Keys.FirstOrDefault(x => !x.Except(RegularExpression).Any()); if (data != null) @@ -36,6 +37,10 @@ namespace Million.Manager { return rememberDic[RegularExpression] = ScriptExcute(ChangeScript(regularExpressionString, RegularExpression)); } + }catch(Exception e) + { + return ScriptExcute(ChangeScript(regularExpressionString, RegularExpression)); + } } /// diff --git a/Million/WebMangement/Upbit/UpbitAPI.cs b/Million/WebMangement/Upbit/UpbitAPI.cs index 52894fe..767982f 100644 --- a/Million/WebMangement/Upbit/UpbitAPI.cs +++ b/Million/WebMangement/Upbit/UpbitAPI.cs @@ -98,10 +98,18 @@ namespace Million.WebMangement.Upbit /// Order List가져오는 함수 /// /// - public List GetOrderListInformation() + public List GetOrderListInformation(UpbitOrderListTypes type, UpbitOrderListOrderByType orderType = UpbitOrderListOrderByType.desc) { var url = UpbitURL_Orders; - var resResult = process.CallAPI(url, HttpMethod.Get); + + var typeStr = type.ToString(); + + if (type == UpbitOrderListTypes.waitwatch) + typeStr = "wait,watch"; + else if (type == UpbitOrderListTypes.donecancel) + typeStr = "done,cancel"; + + var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "states", typeStr },{ "order_by", orderType.ToString() } }); return WebServiceFunctions.GetOrderListInformation(resResult); } diff --git a/Million/WebMangement/WebServiceFunctions.cs b/Million/WebMangement/WebServiceFunctions.cs index fd5aac3..3dca1fd 100644 --- a/Million/WebMangement/WebServiceFunctions.cs +++ b/Million/WebMangement/WebServiceFunctions.cs @@ -52,7 +52,7 @@ namespace Million.WebServices foreach (var item in objectList) { var tempMarketData = new MarketData(); - tempMarketData.CodeName = item.Key; + tempMarketData.CoinName = item.Key; //tempMarketData.ExchangePlace = CommonProperty.ExchangePlace.Bithumb; tempMarketData.KorName = ""; tempMarketData.Payment = Payment; @@ -79,7 +79,7 @@ namespace Million.WebServices var marketData = new MarketData(); marketData.CoinFullName = item["market"].ToString(); var names = marketData.CoinFullName.Split('-'); - marketData.CodeName = names[1]; + marketData.CoinName = names[1]; marketData.KorName = item["korean_name"].ToString(); marketData.Payment = names[0]; marketData.ExchangePlace = @@ -353,14 +353,12 @@ namespace Million.WebServices double.TryParse(data["paid_fee"]?.ToString(), out var paid_fee); double.TryParse(data["locked"]?.ToString(), out var lockedCost); double.TryParse(data["executed_volume"]?.ToString(), out var executed_volume); - double.TryParse(data["avg_price"]?.ToString(), out var avg_price); - + int.TryParse(data["trades_count"]?.ToString(), out var trades_count); returnData.Uuid = data["uuid"]?.ToString(); returnData.OrderType = data["ord_type"]?.ToString(); - returnData.OrderPrice = price; - returnData.AveragePrice = avg_price; + returnData.OrderPrice = price; returnData.Side = data["side"]?.ToString(); returnData.State = data["state"]?.ToString(); returnData.CoinFullName = data["market"]?.ToString();