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] =?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 } };