ProtoOAGetTrendbarsRes - CtidTraderAccountId not populated correctly
Created at 06 Feb 2024, 02:23
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;
}