示例#1
0
        /// <summary>
        /// Gets the list of exchanges.
        /// </summary>
        /// <param name="client"><see cref="IOpenfeedClient"/></param>
        /// <param name="ct"><see cref="CancellationToken"/>.</param>
        /// <returns>The <see cref="IReadOnlyList{Exchange}"/></returns>
        public static async ValueTask <IReadOnlyList <Exchange> > GetExchangesAsync(this IOpenfeedClient client, CancellationToken ct)
        {
            for (; ;)
            {
                try {
                    var connection = await client.GetConnectionAsync(ct).ConfigureAwait(false);

                    return(await connection.GetExchangesAsync(ct).ConfigureAwait(false));
                }
                catch (OpenfeedDisconnectedException) {
                }
            }
        }
示例#2
0
        /// <summary>
        /// Gets the list of instrument references for a symbol.
        /// </summary>
        /// <param name="client"><see cref="IOpenfeedClient"/>.</param>
        /// <param name="marketId">Market ID for which to obtain the <see cref="InstrumentReferenceResponse"/>.</param>
        /// <param name="ct"><see cref="CancellationToken"/>.</param>
        /// <returns><see cref="InstrumentReferenceResponse"/>.</returns>
        public static async Task <InstrumentReferenceResponse> GetInstrumentReferenceAsync(this IOpenfeedClient client, long marketId, CancellationToken ct)
        {
            for (; ;)
            {
                try {
                    var connection = await client.GetConnectionAsync(ct).ConfigureAwait(false);

                    return(await connection.GetInstrumentReferenceAsync(new InstrumentReferenceRequest { MarketId = marketId }, ct));
                }
                catch (OpenfeedDisconnectedException) {
                }
            }
        }