From 9425773b0c1e1a61de8b30e79901a9b7dae89569 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Wed, 12 Oct 2022 10:52:44 +0900 Subject: [PATCH] =?UTF-8?q?Upbit=20API=20=EC=A0=95=EB=A6=AC(=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EB=90=9C=20API=20=EC=82=AC=ED=95=AD=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million Buyer/MainForm.cs | 47 +++++++++++++------------- Million/CommonProperty.cs | 7 ++-- Million/WebMangement/Upbit/UpbitAPI.cs | 2 +- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Million Buyer/MainForm.cs b/Million Buyer/MainForm.cs index 5ff6e32..887bf9c 100644 --- a/Million Buyer/MainForm.cs +++ b/Million Buyer/MainForm.cs @@ -141,7 +141,7 @@ namespace Million_Buyer ThreadFlag = true; bt_Start.Enabled = false; rd_buyer.Enabled = false; - rd_Realtime.Enabled = false; + rd_Realtime.Enabled = false; } } } @@ -210,9 +210,9 @@ namespace Million_Buyer RealtimeDataSettingManager realTimeMsg = null; - var standardTime = DateTime.Now; + var standardTime = DateTime.Now; + - this.BeginInvoke(new Action(delegate () { lb_StartDate.Text = standardTime.ToString("yyyy-MM-dd HH:mm:ss"); @@ -225,7 +225,7 @@ namespace Million_Buyer var cnt = 0; sw.Start(); - + while (ThreadFlag) { try @@ -268,8 +268,8 @@ namespace Million_Buyer sw.Restart(); dataList = realTimeMsg.ProcessRecentlyCandleDatas(dataList, candleTypeList); sw.Stop(); - if(sw.Elapsed.TotalSeconds > 1) - InsertLog("Ticker 계산 시간 : " + sw.Elapsed.ToString()); + if (sw.Elapsed.TotalSeconds > 1) + InsertLog("Ticker 계산 시간 : " + sw.Elapsed.ToString()); } } #endregion @@ -437,20 +437,20 @@ namespace Million_Buyer var moneyVal = (sellVal * (1 - 0.0005) - buyCandleData.BuyValue * (1 - 0.0005)) * result.BuyCount; - tl_Result.AppendNode(new object[] { - buyNode.GetValue("BuyMarket"), - buyNode.GetValue("BuyValue"), - buyNode.GetValue("BuyCount"), - buyNode.GetValue("BuyDateTime"), - sellVal, - result.SellCount, - time.ToString("yyyy-MM-dd HH:mm:ss"), - result.FirstEarningRate, - moneyVal}, null); + tl_Result.AppendNode(new object[] { + buyNode.GetValue("BuyMarket"), + buyNode.GetValue("BuyValue"), + buyNode.GetValue("BuyCount"), + buyNode.GetValue("BuyDateTime"), + sellVal, + result.SellCount, + time.ToString("yyyy-MM-dd HH:mm:ss"), + result.FirstEarningRate, + moneyVal + }, null); tl_BuyList.Nodes.Remove(buyNode); - lb_BuyMarketCount.Text = buyList.Count.ToString(); double totalRate = 0; double totalMoneyValue = 0; @@ -474,9 +474,9 @@ namespace Million_Buyer } } #endregion - } + } cnt++; - if(cnt%60 == 0) + if (cnt % 60 == 0) { InsertLog("Scanning......" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); cnt = 0; @@ -488,16 +488,17 @@ namespace Million_Buyer } } - //Stop 시 저장 -> Real Time의 경우 Search Result List만 저장 if (RealTimeFlag) { - SaveData(); + } else { - //이거는 결정해야함 + } + + SaveData(); InsertLog("Thread Out"); } /// @@ -598,7 +599,7 @@ namespace Million_Buyer /// private void InsertLog(string log) { - + this.BeginInvoke(new Action(delegate () { if (lb_log.Items.Count > 500) diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 97522fb..296983b 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -215,7 +215,7 @@ namespace Million public static string BithumbURL_CoinGoods = "https://api.bithumb.com/public/orderbook/ALL_KRW"; #endregion - #region 업비트 URL + #region 업비트 URL public static string UpbitURL = "https://api.upbit.com/"; public static string UpbitURL_MarketInfo = "https://api.upbit.com/v1/market/all"; public static string UpbitURL_MCandleStick = "https://api.upbit.com/v1/candles/minutes/"; @@ -225,12 +225,13 @@ namespace Million public static string UpbitURL_Accounts = "https://api.upbit.com/v1/accounts"; public static string UpbitURL_Ticker = "https://api.upbit.com/v1/ticker"; - public static string UpbitURL_Ticks = "https://api.upbit.com/v1/ticks"; + public static string UpbitURL_Ticks = "https://api.upbit.com/v1/trades/ticks"; public static string UpbitURL_Orders = "https://api.upbit.com/v1/orders"; public static string UpbitURL_Order = "https://api.upbit.com/v1/order"; + public static string UpbitURL_TryOrder = "https://api.upbit.com/v1/orders"; public static string UpbitURL_Orderbook = "https://api.upbit.com/v1/orderbook"; - public static string UpbitURL_OrderChace = "https://api.upbit.com/v1/chance"; + public static string UpbitURL_OrderChace = "https://api.upbit.com/v1/orders/chance"; #endregion diff --git a/Million/WebMangement/Upbit/UpbitAPI.cs b/Million/WebMangement/Upbit/UpbitAPI.cs index fde8254..81873cd 100644 --- a/Million/WebMangement/Upbit/UpbitAPI.cs +++ b/Million/WebMangement/Upbit/UpbitAPI.cs @@ -116,7 +116,7 @@ namespace Million.WebMangement.Upbit /// public Order TryOrder(string codeFullName, UpbitOrderSide side, double volume, double price, UpbitOrderType ord_type = UpbitOrderType.limit) { - string url = UpbitURL_Order; + string url = UpbitURL_TryOrder; var namevalCollection = new NameValueCollection { { "market", codeFullName }, { "side", side.ToString() },