Closed forReason closed 1 year ago
upon further investigation: begin is not added to the request at all:
var tradeResult = GetTransactionHistoryAsync(begin: 1685111064573);
At the same time, before is inserted multiple times:
var tradeResult = GetTransactionHistoryAsync(before: 603645086244941837);
unchanged code where the suspected issue is.
/// <summary>
/// Retrieve recently-filled transaction details in the last 3 day.
/// </summary>
/// <param name="instrumentType">Instrument Type</param>
/// <param name="instrumentId">Instrument ID</param>
/// <param name="instFamily">Instrument family</param>
/// <param name="underlying">Underlying</param>
/// <param name="orderId">Order ID</param>
/// <param name="after">Pagination of data to return records earlier than the requested ts, Unix timestamp format in milliseconds, e.g. 1597026383085</param>
/// <param name="before">Pagination of data to return records newer than the requested ts, Unix timestamp format in milliseconds, e.g. 1597026383085</param>
/// <param name="begin">Filter with a begin timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085</param>
/// <param name="end">Filter with a begin timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085</param>
/// <param name="limit">Number of results per request. The maximum is 100; the default is 100.</param>
/// <param name="ct">Cancellation Token</param>
/// <returns></returns>
public virtual async Task<RestCallResult<IEnumerable<OkxTransaction>>> GetTransactionHistoryAsync(
OkxInstrumentType? instrumentType = null,
string instrumentId = null,
string instFamily = null,
string underlying = null,
long? orderId = null,
long? after = null,
long? before = null,
long? begin = null,
long? end = null,
int limit = 100,
CancellationToken ct = default)
{
limit.ValidateIntBetween(nameof(limit), 1, 100);
var parameters = new Dictionary<string, object>();
parameters.AddOptionalParameter("instType", JsonConvert.SerializeObject(instrumentType, new InstrumentTypeConverter(false)));
parameters.AddOptionalParameter("uly", underlying);
parameters.AddOptionalParameter("instFamily", instFamily);
parameters.AddOptionalParameter("instId", instrumentId);
parameters.AddOptionalParameter("ordId", orderId?.ToOkxString());
parameters.AddOptionalParameter("after", after?.ToOkxString());
parameters.AddOptionalParameter("before", before?.ToOkxString());
parameters.AddOptionalParameter("begin", before?.ToOkxString());
parameters.AddOptionalParameter("end", before?.ToOkxString());
parameters.AddOptionalParameter("limit", limit.ToOkxString());
return await SendOKXRequest<IEnumerable<OkxTransaction>>(GetUri(v5TradeFills), HttpMethod.Get, ct, signed: true, queryParameters: parameters).ConfigureAwait(false);
}
This would be the corrected code (untested):
public virtual async Task<RestCallResult<IEnumerable<OkxTransaction>>> GetTransactionHistoryAsync(
OkxInstrumentType? instrumentType = null,
string instrumentId = null,
string instFamily = null,
string underlying = null,
long? orderId = null,
long? after = null,
long? before = null,
long? begin = null,
long? end = null,
int limit = 100,
CancellationToken ct = default)
{
limit.ValidateIntBetween(nameof(limit), 1, 100);
var parameters = new Dictionary<string, object>();
parameters.AddOptionalParameter("instType", JsonConvert.SerializeObject(instrumentType, new InstrumentTypeConverter(false)));
parameters.AddOptionalParameter("uly", underlying);
parameters.AddOptionalParameter("instFamily", instFamily);
parameters.AddOptionalParameter("instId", instrumentId);
parameters.AddOptionalParameter("ordId", orderId?.ToOkxString());
parameters.AddOptionalParameter("after", after?.ToOkxString());
parameters.AddOptionalParameter("before", before?.ToOkxString());
parameters.AddOptionalParameter("begin", begin?.ToOkxString()); // Use 'begin' variable for the 'begin' parameter
parameters.AddOptionalParameter("end", end?.ToOkxString()); // Use 'end' variable for the 'end' parameter
parameters.AddOptionalParameter("limit", limit.ToOkxString());
return await SendOKXRequest<IEnumerable<OkxTransaction>>(GetUri(v5TradeFills), HttpMethod.Get, ct, signed: true, queryParameters: parameters).ConfigureAwait(false);
}
created corresponding pull ruquest: Update OKXTradeRestApiClient.cs #23
Thank you for your feedback and commit.
Version 1.2.0 released
GetTransactionHistoryAsync
only returns the trades from the last trading day, if supplied no filter/pagination values.However, when supplying values, the request is malformed. This is my request:
before
parameter