Skip to content

Add futures GetOpenOrdersAsync (list-open-order endpoint)#13

Open
Da-Teach wants to merge 1 commit into
JKorf:mainfrom
Da-Teach:feat/futures-get-open-orders
Open

Add futures GetOpenOrdersAsync (list-open-order endpoint)#13
Da-Teach wants to merge 1 commit into
JKorf:mainfrom
Da-Teach:feat/futures-get-open-orders

Conversation

@Da-Teach

Copy link
Copy Markdown

Summary

The USDT-M futures trading client (IXTRestClientFuturesApiTrading) currently exposes only GetOrdersAsync, which maps to the order-history endpoint GET /future/trade/v1/order/list (filtered by state + startTime/endTime + pagination).

XT also offers a dedicated open-orders endpoint, GET /future/trade/v1/order/list-open-order, which returns only NEW / PARTIALLY_FILLED orders, takes an optional symbol (all markets when omitted), and has no time window or pagination. It's the futures analogue of the existing SpotApi.Trading.GetOpenOrdersAsync — but there was no futures wrapper for it.

This PR adds FuturesApi.Trading.GetOpenOrdersAsync(string? symbol = null, CancellationToken ct = default).

Without it, callers that need a complete snapshot of currently-open futures orders have to fall back to the history endpoint and guess at its default time window — which risks missing an old resting order.

Changes

  • IXTRestClientFuturesApiTrading.GetOpenOrdersAsync (interface + XML docs)
  • XTRestClientFuturesApiTrading.GetOpenOrdersAsync (implementation)

The implementation mirrors the existing spot GetOpenOrdersAsync (returns XTFuturesOrder[], single GET, optional lowercased symbol) and the futures rate-limit guard used by the sibling GetOrdersAsync.

public async Task<WebCallResult<XTFuturesOrder[]>> GetOpenOrdersAsync(string? symbol = null, CancellationToken ct = default)
{
    var parameters = new ParameterCollection();
    parameters.AddOptional("symbol", symbol?.ToLowerInvariant());
    var request = _definitions.GetOrCreate(HttpMethod.Get, "/future/trade/v1/order/list-open-order", XTExchange.RateLimiter.RestFutures, 1, true, limitGuard: new SingleLimitGuard(200, TimeSpan.FromSeconds(1), RateLimitWindowType.Sliding));
    var result = await _baseClient.SendAsync<XTFuturesOrder[]>(request, parameters, ct).ConfigureAwait(false);
    return result;
}

Builds clean against the current main. Note: I matched HttpMethod.Get to the sibling order/list futures query and the spot open-order endpoint; if XT actually expects POST here, happy to switch.

…order)

The USDT-M futures trading client only exposed GetOrdersAsync, which maps to the
order-history endpoint (/order/list) with state + start/end time + pagination
filters. XT also offers a dedicated open-orders endpoint
(/future/trade/v1/order/list-open-order) that returns only NEW / PARTIALLY_FILLED
orders, with an optional symbol filter (all markets when omitted) and no time
window or pagination -- the futures analogue of the spot
SpotApi.Trading.GetOpenOrdersAsync. This adds it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant