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) {