From bfa898df2f7f7ee982f3fba0e3fb68accd13b09d Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Thu, 31 Oct 2024 10:26:13 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndicatorProcess.cs | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index 7cf4976..3efea92 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -268,7 +268,7 @@ namespace BitgetAPI.IndicatorConditionSetup // 없으면 생성 if (signalData == null) - { + { var price = candleData.Close; var rate = (candleData.Close / candleData.Open) * 100 - 100; @@ -711,9 +711,9 @@ namespace BitgetAPI.IndicatorConditionSetup 전고점Data["clearFlag"] = false; - if (LongCount < 3) - { - double size = 50 / price; + if (LongCount < 2) + { + double size = ((double)((double)90) / price); var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyLong, OrderType.limit, 10); var orderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(orderData["data"])); @@ -781,15 +781,16 @@ namespace BitgetAPI.IndicatorConditionSetup if (orderDic != null) { double.TryParse(orderDic["Size"].ToString(), out var size); + double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue); var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellLong, OrderType.market, 10, orderDic["orderId"].ToString()); var sellOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(sellOrder["data"])); - var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]); - var detailOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(detail["data"])); + //var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]); + //var detailOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(detail["data"])); - double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue); - double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue); - var resultRateData = ((sellPriceValue - buyPriceValue) / buyPriceValue) * 100; + //double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue); + + var resultRateData = ((price - buyPriceValue) / buyPriceValue) * 100; var orderResult = new Dictionary() { @@ -800,7 +801,7 @@ namespace BitgetAPI.IndicatorConditionSetup { "MCandleTimeType", (int)interval }, { "BuyCandle", buyItem["Candle"] }, { "SellDate", nowTime}, - { "SellPrice", detailOrderDic["price"] }, + { "SellPrice", price}, { "SellCandle", candleData }, { "Rate", resultRateData } }; @@ -1014,9 +1015,9 @@ namespace BitgetAPI.IndicatorConditionSetup 전저점Data["flag"] = false; 전저점Data["clearFlag"] = false; - if(ShortCount < 3) + if(ShortCount < 2) { - double size = 50 / price; + double size = ((double)((double)90) / price); var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyShort, OrderType.limit, 10); var orderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(orderData["data"])); @@ -1084,15 +1085,16 @@ namespace BitgetAPI.IndicatorConditionSetup if (orderDic != null) { double.TryParse(orderDic["Size"].ToString(), out var size); + double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue); var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellShort, OrderType.market, 10, orderDic["orderId"].ToString()); var sellOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(sellOrder["data"])); - var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]); - var detailOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(detail["data"])); + //var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]); + //var detailOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(detail["data"])); - double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue); - double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue); - var resultRateData = ((sellPriceValue - buyPriceValue) / buyPriceValue) * 100; + //double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue); + + var resultRateData = ((price - buyPriceValue) / buyPriceValue) * 100; var orderResult = new Dictionary() { @@ -1103,7 +1105,7 @@ namespace BitgetAPI.IndicatorConditionSetup { "MCandleTimeType", (int)interval }, { "BuyCandle", buyItem["Candle"] }, { "SellDate", nowTime}, - { "SellPrice", detailOrderDic["price"] }, + { "SellPrice", price }, { "SellCandle", candleData }, { "Rate", resultRateData } }; From 32d24ea61abb8c924319dc4da3c6c499761e097f Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Thu, 31 Oct 2024 10:46:24 +0900 Subject: [PATCH 2/3] =?UTF-8?q?2=EC=8B=9C=EA=B0=84=203=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=EB=B4=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BitgetApi/.vs/BitgetApi.csproj.dtbcache.json | 2 +- BitgetApi/BitgetApi.csproj | 1 - BitgetApi/CommonProperty.cs | 4 ++ .../IndicatorProcess.cs | 44 ++++++++++++++----- BitgetApi/WebService/WebConnection.cs | 9 +++- 5 files changed, 45 insertions(+), 15 deletions(-) diff --git a/BitgetApi/.vs/BitgetApi.csproj.dtbcache.json b/BitgetApi/.vs/BitgetApi.csproj.dtbcache.json index 8dc0f07..ed5e9f1 100644 --- a/BitgetApi/.vs/BitgetApi.csproj.dtbcache.json +++ b/BitgetApi/.vs/BitgetApi.csproj.dtbcache.json @@ -1 +1 @@ -{"RootPath":"C:\\Million Bitget_API\\BitGet_API\\BitgetApi","ProjectFileName":"BitgetApi.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"CommonProperty.cs"},{"SourceFile":"Data\\CandleData.cs"},{"SourceFile":"Data\\CandleDataList.cs"},{"SourceFile":"Data\\MarketInfo.cs"},{"SourceFile":"Data\\SignalInfoData.cs"},{"SourceFile":"Data\\TradeData.cs"},{"SourceFile":"Data\\WebSocketCandle.cs"},{"SourceFile":"Data\\IndicatorData.cs"},{"SourceFile":"IndicatorConditionSetup\\IchimokuConditionSetup.cs"},{"SourceFile":"IndicatorConditionSetup\\MovingAverageConditionSetup.cs"},{"SourceFile":"IndicatorData\\IchimokData.cs"},{"SourceFile":"IndicatorConditionSetup\\IndicatorProcess.cs"},{"SourceFile":"IndicatorData\\MovingAverageData.cs"},{"SourceFile":"MainForm.cs"},{"SourceFile":"MainForm.Designer.cs"},{"SourceFile":"Program.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Utils\\BaseSingleton.cs"},{"SourceFile":"Utils\\Convertor.cs"},{"SourceFile":"WebService\\WebConnection.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Data.Desktop.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Data.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Drawing.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Printing.v23.2.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Utils.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraBars.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraEditors.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraGrid.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraLayout.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraPrinting.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraTreeList.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Million Bitget_API\\BitGet_API\\packages\\Newtonsoft.Json.13.0.3\\lib\\net45\\Newtonsoft.Json.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\PresentationCore.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.ComponentModel.DataAnnotations.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Runtime.Remoting.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\UIAutomationClient.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\WindowsBase.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Million Bitget_API\\BitGet_API\\BitgetApi\\bin\\Debug\\BitgetApi.exe","OutputItemRelativePath":"BitgetApi.exe"},{"OutputItemFullPath":"C:\\Million Bitget_API\\BitGet_API\\BitgetApi\\bin\\Debug\\BitgetApi.pdb","OutputItemRelativePath":"BitgetApi.pdb"}],"CopyToOutputEntries":[]} \ No newline at end of file +{"RootPath":"C:\\Million Bitget_API\\BitGet_API\\BitgetApi","ProjectFileName":"BitgetApi.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"CommonProperty.cs"},{"SourceFile":"Data\\CandleData.cs"},{"SourceFile":"Data\\CandleDataList.cs"},{"SourceFile":"Data\\MarketInfo.cs"},{"SourceFile":"Data\\ResponseCandleStick.cs"},{"SourceFile":"Data\\ResponseCandleStickArg.cs"},{"SourceFile":"Data\\SignalInfoData.cs"},{"SourceFile":"Data\\TradeData.cs"},{"SourceFile":"Data\\WebSocketCandle.cs"},{"SourceFile":"Data\\IndicatorData.cs"},{"SourceFile":"IndicatorConditionSetup\\IchimokuConditionSetup.cs"},{"SourceFile":"IndicatorConditionSetup\\MovingAverageConditionSetup.cs"},{"SourceFile":"IndicatorData\\IchimokData.cs"},{"SourceFile":"IndicatorConditionSetup\\IndicatorProcess.cs"},{"SourceFile":"IndicatorData\\MovingAverageData.cs"},{"SourceFile":"MainForm.cs"},{"SourceFile":"MainForm.Designer.cs"},{"SourceFile":"Program.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Utils\\BaseSingleton.cs"},{"SourceFile":"Utils\\Convertor.cs"},{"SourceFile":"WebService\\WebConnection.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Data.Desktop.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Data.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Drawing.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Printing.v23.2.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.Utils.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraBars.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraEditors.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraGrid.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraLayout.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraPrinting.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\DevExpress 23.2\\Components\\Bin\\Framework\\DevExpress.XtraTreeList.v23.2.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Million Bitget_API\\BitGet_API\\packages\\Newtonsoft.Json.13.0.3\\lib\\net45\\Newtonsoft.Json.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\PresentationCore.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.ComponentModel.DataAnnotations.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Runtime.Remoting.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\UIAutomationClient.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\WindowsBase.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Million Bitget_API\\BitGet_API\\BitgetApi\\bin\\Debug\\BitgetApi.exe","OutputItemRelativePath":"BitgetApi.exe"},{"OutputItemFullPath":"C:\\Million Bitget_API\\BitGet_API\\BitgetApi\\bin\\Debug\\BitgetApi.pdb","OutputItemRelativePath":"BitgetApi.pdb"}],"CopyToOutputEntries":[]} \ No newline at end of file diff --git a/BitgetApi/BitgetApi.csproj b/BitgetApi/BitgetApi.csproj index f62760d..1d03ec4 100644 --- a/BitgetApi/BitgetApi.csproj +++ b/BitgetApi/BitgetApi.csproj @@ -128,7 +128,6 @@ MainForm.cs - ResXFileCodeGenerator Resources.Designer.cs diff --git a/BitgetApi/CommonProperty.cs b/BitgetApi/CommonProperty.cs index 1da22ad..c684dee 100644 --- a/BitgetApi/CommonProperty.cs +++ b/BitgetApi/CommonProperty.cs @@ -188,6 +188,10 @@ namespace BitgetAPI M30 = 30, [Description("1H")] H1 = 60, + [Description("2H")] + H2 = 120, + [Description("3H")] + H3 = 180, [Description("4H")] H4 = 240, [Description("6H")] diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index f9948d5..2869a3b 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -4,8 +4,10 @@ using BitgetAPI.IndicatorConditionSetup; using BitgetAPI.WebService; using DevExpress.Internal.WinApi.Windows.UI.Notifications; using DevExpress.Utils.IoC; +using DevExpress.Xpo.Logger; using DevExpress.XtraPrinting.Native; using Newtonsoft.Json; +using Serilog; using System; using System.Collections.Generic; using System.Collections.Specialized; @@ -117,6 +119,7 @@ namespace BitgetAPI.IndicatorConditionSetup public void calProcess() { + IchimokuConditionSetup ichimokuConditionSetup = new IchimokuConditionSetup(); MovingAverageConditionSetup movingAverageConditionSetup = new MovingAverageConditionSetup(); @@ -262,8 +265,6 @@ namespace BitgetAPI.IndicatorConditionSetup if (checked구름떼상향돌파 && candleData_전봉.Open < candleData_전봉.IchimokData.상한선 && candleData.Open > candleData.IchimokData.상한선 && candleData.Low > candleData.IchimokData.상한선 && candleData.Close > candleData.IchimokData.상한선) { - - var indicatorPrice = candleData.Open; var indicatorRate = (candleData.Close / indicatorPrice) * 100 - 100; @@ -372,15 +373,15 @@ namespace BitgetAPI.IndicatorConditionSetup var Bol12 = candleData.movingAverageDataList[12].BolangerValue; var Bol24 = candleData.movingAverageDataList[24].BolangerValue; - - if ((int)interval != 5) + //5분봉이 default이지만 15분봉으로 변경 + if ((int)interval != 15) { continue; } #region 15분봉 처리 - //60분봉 관련 처리 - var candleDatas15 = findedMarket.candleDataList[MCandleTimeType.M15]; + //15분봉이지만 60분봉으로 변경 + var candleDatas15 = findedMarket.candleDataList[MCandleTimeType.H1]; var candleDatas15_정렬 = candleDatas15.ToList().OrderBy(i => i.Argument).ToList(); var candleData15 = candleDatas15.Find(i => i.Argument == candleDatas15_정렬.Last().Argument); @@ -434,8 +435,8 @@ namespace BitgetAPI.IndicatorConditionSetup #endregion #region 1분봉 처리 - - var candleDatas1 = findedMarket.candleDataList[MCandleTimeType.M1]; + //1분봉이지만 3분봉으로 변경 + var candleDatas1 = findedMarket.candleDataList[MCandleTimeType.M3]; var candleDatas1_정렬 = candleDatas1.ToList().OrderBy(i => i.Argument).ToList(); var candleData1 = candleDatas1.Find(i => i.Argument == candleDatas1_정렬.Last().Argument); @@ -483,7 +484,8 @@ namespace BitgetAPI.IndicatorConditionSetup #endregion #region 60분봉 처리 - var candleDatas60 = findedMarket.candleDataList[MCandleTimeType.H1]; + //60분봉이지만 180분 처리 + var candleDatas60 = findedMarket.candleDataList[MCandleTimeType.H3]; var candleDatas60_정렬 = candleDatas60.ToList().OrderBy(i => i.Argument).ToList(); var candleData60 = candleDatas60.Find(i => i.Argument == candleDatas60_정렬.Last().Argument); @@ -816,7 +818,15 @@ namespace BitgetAPI.IndicatorConditionSetup { double.TryParse(orderDic["Size"].ToString(), out var size); var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellLong, OrderType.market, YHKIM_Leverage, orderDic["orderId"].ToString()); - var sellOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(sellOrder["data"])); + + if (sellOrder != null) + { + var sellOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(sellOrder["data"])); + } + else + { + Log.Error("Sell 안됨 확인 필요"); + } double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue); //var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]); //var detailOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(detail["data"])); @@ -1119,7 +1129,17 @@ namespace BitgetAPI.IndicatorConditionSetup { double.TryParse(orderDic["Size"].ToString(), out var size); var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellShort, OrderType.market, YHKIM_Leverage, orderDic["orderId"].ToString()); - var sellOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(sellOrder["data"])); + + if (sellOrder != null) + { + var sellOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(sellOrder["data"])); + } + else + { + Log.Error("Sell 안됨 확인 필요"); + } + + double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue); //var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]); //var detailOrderDic = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(detail["data"])); @@ -1330,7 +1350,7 @@ namespace BitgetAPI.IndicatorConditionSetup var result = CancelFutureOrder(symbol, id); if (result == null || result["msg"]?.ToString() != "success") { - Console.WriteLine("Sell에서 Cancel관련 Error"); + Log.Error("Sell에서 Cancel관련 Error"); } } diff --git a/BitgetApi/WebService/WebConnection.cs b/BitgetApi/WebService/WebConnection.cs index a3dd696..e5e532a 100644 --- a/BitgetApi/WebService/WebConnection.cs +++ b/BitgetApi/WebService/WebConnection.cs @@ -24,6 +24,7 @@ using DevExpress.XtraEditors.Filtering; using DevExpress.XtraExport.Xls; using DevExpress.Utils.Filtering.Internal; using System.Collections.Specialized; +using Serilog; namespace BitgetAPI.WebService { @@ -207,6 +208,12 @@ namespace BitgetAPI.WebService case CommonProperty.MCandleTimeType.H1: timespan_add = new System.TimeSpan(1, 0, 0); break; + case CommonProperty.MCandleTimeType.H2: + timespan_add = new System.TimeSpan(2, 0, 0); + break; + case CommonProperty.MCandleTimeType.H3: + timespan_add = new System.TimeSpan(3, 0, 0); + break; case CommonProperty.MCandleTimeType.H4: timespan_add = new System.TimeSpan(4, 0, 0); break; @@ -304,7 +311,7 @@ namespace BitgetAPI.WebService using (var reader = new StreamReader(Response.GetResponseStream())) { var sRespBodyData = reader.ReadToEnd(); - Console.WriteLine(sRespBodyData); + Log.Error(webEx, sRespBodyData); //return (JObject.Parse(sRespBodyData)); } } From c3c8c975dddfc86f338bbc4bab487f34320ed65a Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Fri, 1 Nov 2024 10:19:50 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=ED=91=B8=EC=89=AC=ED=91=B8=EC=89=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index 2869a3b..23602ac 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -485,7 +485,7 @@ namespace BitgetAPI.IndicatorConditionSetup #region 60분봉 처리 //60분봉이지만 180분 처리 - var candleDatas60 = findedMarket.candleDataList[MCandleTimeType.H3]; + var candleDatas60 = findedMarket.candleDataList[MCandleTimeType.H2]; var candleDatas60_정렬 = candleDatas60.ToList().OrderBy(i => i.Argument).ToList(); var candleData60 = candleDatas60.Find(i => i.Argument == candleDatas60_정렬.Last().Argument);