1. account 처리 완료

2. cancel, order, pendinglist 가져오는 함수 생성만 함(Test필요)
This commit is contained in:
kyh
2024-08-29 11:48:21 +09:00
parent 7b4d8652fb
commit c15a5f000b
2 changed files with 44 additions and 4 deletions

View File

@@ -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
}
}

View File

@@ -846,6 +846,24 @@ namespace BitgetAPI.IndicatorConditionSetup
}
}
public Dictionary<string, object> 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<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetPendingOrder_Future, BitgetURL_PendingOrders_Future, null, MCandleTimeType.M1, "", "", nvc);
}
public List<Dictionary<string, object>> GetFutureAccountList()
{
var timeSpan = DateTime.Now;
@@ -864,7 +882,24 @@ namespace BitgetAPI.IndicatorConditionSetup
return (List<Dictionary<string, object>>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetAccountList_Future, BitgetURL_AccountList_Future, null, MCandleTimeType.M1, "", "", nvc);
}
public Dictionary<string, object> 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<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetCancelOrder_Future, BitgetURL_CancelOrder_Future, null, MCandleTimeType.M1, postStr, "", nvc);
}
public Dictionary<string, object> FutureOrder(string symbol, FutureMarginMode marginMode, double size, double price, FutureSide futureSide, OrderType orderType)
{