public async Task <ProtoOALightSymbol[]> GetConversionSymbols(long accountId, bool isLive, long baseAssetId, long quoteAssetId) { VerifyConnection(); var client = GetClient(isLive); using var cancelationTokenSource = new CancellationTokenSource(); ProtoOALightSymbol[] result = null; using var disposable = client.OfType <ProtoOASymbolsForConversionRes>().Where(response => response.CtidTraderAccountId == accountId) .Subscribe(response => { result = response.Symbol.ToArray(); cancelationTokenSource.Cancel(); }); var requestMessage = new ProtoOASymbolsForConversionReq { CtidTraderAccountId = accountId, FirstAssetId = baseAssetId, LastAssetId = quoteAssetId }; await SendMessage(requestMessage, ProtoOAPayloadType.ProtoOaSymbolsForConversionReq, client, cancelationTokenSource, () => result is not null); return(result); }
public static ProtoMessage Symbols_For_Conversion_Req(long ctidTraderAccountId, long firstAssetId, long lastAssetId) { ProtoOASymbolsForConversionReq message = new ProtoOASymbolsForConversionReq { payloadType = ProtoOAPayloadType.ProtoOaSymbolsForConversionReq, ctidTraderAccountId = ctidTraderAccountId, firstAssetId = firstAssetId, lastAssetId = lastAssetId }; Log.Info("ProtoOASymbolsForConversionReq:: " + $"ctidTraderAccountId: {ctidTraderAccountId}; " + $"firstAssetId: {firstAssetId}; " + $"lastAssetId: {lastAssetId}"); InnerMemoryStream.SetLength(0); Serializer.Serialize(InnerMemoryStream, message); return(Encode((uint)message.payloadType, InnerMemoryStream.ToArray())); }