Class AlpacaCryptoStreamingClientExtensions
Helper extension method for creating special version of the IAlpacaCryptoStreamingClient implementation with automatic reconnection (with configurable delay and number of attempts) support.
Inheritance
Inherited Members
Namespace: Alpaca.Markets.Extensions
Assembly: Alpaca.Markets.Extensions.dll
Syntax
public static class AlpacaCryptoStreamingClientExtensions
Methods
| Improve this Doc View SourceGetOrderBookSubscription(IAlpacaCryptoStreamingClient, IEnumerable<String>)
Gets the order book updates subscription for the all assets from the symbols
list.
Declaration
public static IAlpacaDataSubscription<IOrderBook> GetOrderBookSubscription(this IAlpacaCryptoStreamingClient client, IEnumerable<String> symbols)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Target instance of the IAlpacaCryptoStreamingClient interface. |
IEnumerable<String> | symbols | Alpaca asset names list (non-empty) for order book updates subscribing. |
Returns
Type | Description |
---|---|
IAlpacaDataSubscription<IOrderBook> | Subscription object for tracking updates via the Received event. |
GetOrderBookSubscription(IAlpacaCryptoStreamingClient, String[])
Gets the order book updates subscription for the all assets from the symbols
list.
Declaration
public static IAlpacaDataSubscription<IOrderBook> GetOrderBookSubscription(this IAlpacaCryptoStreamingClient client, params String[] symbols)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Target instance of the IAlpacaCryptoStreamingClient interface. |
String[] | symbols | Alpaca asset names list (non-empty) for order book updates subscribing. |
Returns
Type | Description |
---|---|
IAlpacaDataSubscription<IOrderBook> | Subscription object for tracking updates via the Received event. |
SubscribeOrderBookAsync(IAlpacaCryptoStreamingClient, IEnumerable<String>)
Gets the order book updates subscription for all assets from the symbols
list.
This subscription is returned with pending subscription state and will be unsubscribed on disposing
so you can use it inside the using
or await using
statements for more clear resource management.
Declaration
public static ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> SubscribeOrderBookAsync(this IAlpacaCryptoStreamingClient client, IEnumerable<String> symbols)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Target instance of the IAlpacaCryptoStreamingClient interface. |
IEnumerable<String> | symbols | Alpaca asset names list (non-empty) for order book updates subscribing. |
Returns
Type | Description |
---|---|
ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> | Subscription object for tracking updates via the Received event. |
SubscribeOrderBookAsync(IAlpacaCryptoStreamingClient, String)
Gets the order book updates subscription for the symbol
asset. This subscription is
returned with pending subscription state and will be unsubscribed on disposing so you can use it
inside the using
or await using
statements for more clear resource management.
Declaration
public static ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> SubscribeOrderBookAsync(this IAlpacaCryptoStreamingClient client, String symbol)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Target instance of the IAlpacaCryptoStreamingClient interface. |
String | symbol | Alpaca asset name for order book updates subscribing. |
Returns
Type | Description |
---|---|
ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> | Subscription object for tracking updates via the Received event. |
SubscribeOrderBookAsync(IAlpacaCryptoStreamingClient, String[])
Gets the order book updates subscription for all assets from the symbols
list.
This subscription is returned with pending subscription state and will be unsubscribed on disposing
so you can use it inside the using
or await using
statements for more clear resource management.
Declaration
public static ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> SubscribeOrderBookAsync(this IAlpacaCryptoStreamingClient client, params String[] symbols)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Target instance of the IAlpacaCryptoStreamingClient interface. |
String[] | symbols | Alpaca asset names list (non-empty) for order book updates subscribing. |
Returns
Type | Description |
---|---|
ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> | Subscription object for tracking updates via the Received event. |
WithReconnect(IAlpacaCryptoStreamingClient)
Wraps instance of IAlpacaCryptoStreamingClient into the helper class with automatic reconnection support and provide optional reconnection parameters.
Declaration
public static IAlpacaCryptoStreamingClient WithReconnect(this IAlpacaCryptoStreamingClient client)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Original streaming client for wrapping. |
Returns
Type | Description |
---|---|
IAlpacaCryptoStreamingClient | Wrapped version of the |
WithReconnect(IAlpacaCryptoStreamingClient, ReconnectionParameters)
Wraps instance of IAlpacaDataStreamingClient into the helper class with automatic reconnection support with the default reconnection parameters.
Declaration
public static IAlpacaCryptoStreamingClient WithReconnect(this IAlpacaCryptoStreamingClient client, ReconnectionParameters parameters)
Parameters
Type | Name | Description |
---|---|---|
IAlpacaCryptoStreamingClient | client | Original streaming client for wrapping. |
ReconnectionParameters | parameters | Reconnection parameters. |
Returns
Type | Description |
---|---|
IAlpacaCryptoStreamingClient | Wrapped version of the |