ProtoOAGetTrendbarsRes - CtidTraderAccountId not populated correctly

Created at 06 Feb 2024, 02:23
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MB

mbryant42

Joined 06.02.2024

ProtoOAGetTrendbarsRes - CtidTraderAccountId not populated correctly
06 Feb 2024, 02:23


As context I'm using the open api c# sdk (https://github.com/spotware/OpenAPI.Net)

Specifically the WPF.Sample

There seems to be a recent issue with the CtidTraderAccountId in the ProtoOAGetTrendbarsRes as it is not populated correctly - seems to be a partially based on the client id.

Removing the account id condition in the below code snippit I can get a response.

public Task<ProtoOATrendbar[]> GetTrendbars(long accountId, bool isLive, DateTimeOffset from, DateTimeOffset to, ProtoOATrendbarPeriod period, long symbolId)
{
   VerifyConnection();
   var periodMaximum = period.GetMaximumTime();
   if (from == default) from = to.Add(-periodMaximum);
   if (to - from > periodMaximum) throw new ArgumentOutOfRangeException(nameof(to), "The time range is not valid");
   var client = GetClient(isLive);
   var taskCompletionSource = new TaskCompletionSource<ProtoOATrendbar[]>();
   IDisposable disposable = null;
   disposable = client.OfType<ProtoOAGetTrendbarsRes>()./*Where(response => response.CtidTraderAccountId == accountId).*/Subscribe(response =>
   {
       taskCompletionSource.SetResult(response.Trendbar.ToArray());
       disposable?.Dispose();
   });
   var requestMessage = new ProtoOAGetTrendbarsReq
   {
       FromTimestamp = from.ToUnixTimeMilliseconds(),
       ToTimestamp = to.ToUnixTimeMilliseconds(),
       CtidTraderAccountId = accountId,
       Period = period,
       SymbolId = symbolId
   };
   EnqueueMessage(requestMessage, ProtoOAPayloadType.ProtoOaGetTrendbarsReq, client);
   return taskCompletionSource.Task;
}

 


@mbryant42