Class EnumerableExtensions
Set of extensions methods for obtaining simple statistical functions from bars list.
Inheritance
Inherited Members
Namespace: Alpaca.Markets.Extensions
Assembly: Alpaca.Markets.Extensions.dll
Syntax
public static class EnumerableExtensions
Methods
| Improve this Doc View SourceGetAverageDailyTradeVolume(IEnumerable<IBar>)
Gets the average trade volume for the given list of IBar objects.
Declaration
public static (Decimal, UInt32) GetAverageDailyTradeVolume(this IEnumerable<IBar> bars)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IBar> | bars | Target list of the IBar instances. |
Returns
Type | Description |
---|---|
System.ValueTuple<Decimal, UInt32> | The pair of ADTV value and number of processed day bars. |
GetAverageDailyTradeVolumeAsync(IAsyncEnumerable<IBar>)
Gets the average trade volume for the given list of IBar objects.
Declaration
public static Task<(Decimal, UInt32)> GetAverageDailyTradeVolumeAsync(this IAsyncEnumerable<IBar> bars)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<IBar> | bars | Target list of the IBar instances. |
Returns
Type | Description |
---|---|
Task<System.ValueTuple<Decimal, UInt32>> | The pair of ADTV value and number of processed day bars. |
GetAverageDailyTradeVolumeAsync(IAsyncEnumerable<IBar>, CancellationToken)
Gets the average trade volume for the given list of IBar objects.
Declaration
public static async Task<(Decimal, UInt32)> GetAverageDailyTradeVolumeAsync(this IAsyncEnumerable<IBar> bars, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<IBar> | bars | Target list of the IBar instances. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<System.ValueTuple<Decimal, UInt32>> | The pair of ADTV value and number of processed day bars. |
GetSimpleMovingAverage(IEnumerable<IBar>, Int32)
Gets the simple moving average values for the given list of IBar objects.
Declaration
public static IEnumerable<IBar> GetSimpleMovingAverage(this IEnumerable<IBar> bars, Int32 window)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IBar> | bars | Target list of the IBar instances. |
Int32 | window | Size of the moving average window. |
Returns
Type | Description |
---|---|
IEnumerable<IBar> | The list of bars with SMA values for all IBar properties. |
GetSimpleMovingAverageAsync(IAsyncEnumerable<IBar>, Int32)
Gets the simple moving average values for the given list of IBar objects.
Declaration
public static IAsyncEnumerable<IBar> GetSimpleMovingAverageAsync(this IAsyncEnumerable<IBar> bars, Int32 window)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<IBar> | bars | Target list of the IBar instances. |
Int32 | window | Size of the moving average window. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IBar> | The list of bars with SMA values for all IBar properties. |
GetSimpleMovingAverageAsync(IAsyncEnumerable<IBar>, Int32, CancellationToken)
Gets the simple moving average values for the given list of IBar objects.
Declaration
public static async IAsyncEnumerable<IBar> GetSimpleMovingAverageAsync(this IAsyncEnumerable<IBar> bars, Int32 window, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<IBar> | bars | Target list of the IBar instances. |
Int32 | window | Size of the moving average window. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IBar> | The list of bars with SMA values for all IBar properties. |