From c15a5f000b5de726d8fc881601ec11e6f97ec854 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Thu, 29 Aug 2024 11:48:21 +0900 Subject: [PATCH] =?UTF-8?q?1.=20account=20=EC=B2=98=EB=A6=AC=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=202.=20cancel,=20order,=20pendinglist=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=A4=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EB=A7=8C=20=ED=95=A8(Test=ED=95=84=EC=9A=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BitgetApi/CommonProperty.cs | 11 ++++-- .../IndicatorProcess.cs | 37 ++++++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/BitgetApi/CommonProperty.cs b/BitgetApi/CommonProperty.cs index c09d510..b8b14d5 100644 --- a/BitgetApi/CommonProperty.cs +++ b/BitgetApi/CommonProperty.cs @@ -94,7 +94,11 @@ namespace BitgetAPI [Description("BitgetAccountList_FUTURE")] BitgetAccountList_Future = 30, [Description("BitgetOrder_FUTURE")] - BitgetOrder_Future = 31 + BitgetOrder_Future = 31, + [Description("BitgetOrderCancel_FUTURE")] + BitgetCancelOrder_Future = 32, + [Description("BitgetPendingOrder_FUTURE")] + BitgetPendingOrder_Future = 33 #endregion } @@ -220,8 +224,9 @@ namespace BitgetAPI public static string BitgetURL_MarketCandle_Future = "https://api.bitget.com/api/v2/mix/market/candles?symbol={0}&granularity={1}&limit={2}&productType={3}"; public static string BitgetURL_AccountList_Future = @"https://api.bitget.com/api/v2/mix/account/accounts?productType=USDT-FUTURES"; - public static string BitgetURL_BuySellOrder_Future = @"https://api.bitget.com/api/v2/mix/order/place-order?"; - + public static string BitgetURL_BuySellOrder_Future = @"https://api.bitget.com/api/v2/mix/order/place-order"; + public static string BitgetURL_CancelOrder_Future = @"https://api.bitget.com/api/v2/mix/order/cancel-order"; + public static string BitgetURL_PendingOrders_Future = @"https://api.bitget.com/api/v2/mix/order/orders-pending?productType=usdt-futures"; #endregion } } diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index c5f29e5..a1fb152 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -846,6 +846,24 @@ namespace BitgetAPI.IndicatorConditionSetup } } + public Dictionary GetPendingOrders() + { + var timeSpan = DateTime.Now; + + var timestamp = (((DateTimeOffset)timeSpan).ToUnixTimeSeconds() * 1000).ToString(); + + var reqStr = "/api/v2/mix/order/orders-pending"; + + var nvc = new NameValueCollection { + {"ACCESS-KEY", YHKIM_AccessKey}, + {"ACCESS-SIGN", GenerateSignString(timestamp, "GET", reqStr, "productType=USDT-FUTURES", null, YHKIM_SecreteKey) }, + {"ACCESS-PASSPHRASE", YHKIM_PassphraseKey }, + {"ACCESS-TIMESTAMP",timestamp} + }; + + return (Dictionary)WebConnection.SendWebServer(ExchangeWebReqType.BitgetPendingOrder_Future, BitgetURL_PendingOrders_Future, null, MCandleTimeType.M1, "", "", nvc); + } + public List> GetFutureAccountList() { var timeSpan = DateTime.Now; @@ -864,7 +882,24 @@ namespace BitgetAPI.IndicatorConditionSetup return (List>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetAccountList_Future, BitgetURL_AccountList_Future, null, MCandleTimeType.M1, "", "", nvc); } - + public Dictionary CancelFutureOrder(string symbol, string orderId) + { + var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)); + + var timestamp = (timeSpan.TotalSeconds * 1000).ToString(); + + var reqStr = "/api/v2/mix/order/cancel-order"; + var nvc = new NameValueCollection { + {"ACCESS-KEY", new Guid().ToString()}, + {"ACCESS-SIGN", GenerateSignString(timestamp, "POST", reqStr, "", null, YHKIM_SecreteKey)}, + {"ACCESS-PASSPHRASE", YHKIM_PassphraseKey }, + {"ACCESS-TIMESTAMP", timestamp} + }; + + var postStr = string.Format("{\"symbol\" : \"{0}\", \"orderId\" : \"{1}\", \"productType\" : \"usdt-futures\" , \"marginCoin\" : \"USDT\"}", symbol, orderId); + + return (Dictionary)WebConnection.SendWebServer(ExchangeWebReqType.BitgetCancelOrder_Future, BitgetURL_CancelOrder_Future, null, MCandleTimeType.M1, postStr, "", nvc); + } public Dictionary FutureOrder(string symbol, FutureMarginMode marginMode, double size, double price, FutureSide futureSide, OrderType orderType) {