Show / Hide Table of Contents

Interface IAlpacaDataClient

Provides unified type-safe access for Alpaca Data API via HTTP/REST.

Inherited Members
IHistoricalQuotesClient<HistoricalQuotesRequest>.ListHistoricalQuotesAsync(HistoricalQuotesRequest, CancellationToken)
IHistoricalQuotesClient<HistoricalQuotesRequest>.GetHistoricalQuotesAsync(HistoricalQuotesRequest, CancellationToken)
IHistoricalTradesClient<HistoricalTradesRequest>.ListHistoricalTradesAsync(HistoricalTradesRequest, CancellationToken)
IHistoricalTradesClient<HistoricalTradesRequest>.GetHistoricalTradesAsync(HistoricalTradesRequest, CancellationToken)
IHistoricalBarsClient<HistoricalBarsRequest>.ListHistoricalBarsAsync(HistoricalBarsRequest, CancellationToken)
IHistoricalBarsClient<HistoricalBarsRequest>.GetHistoricalBarsAsync(HistoricalBarsRequest, CancellationToken)
IAlpacaScreenerClient.GetTopMarketMoversAsync(Nullable<Int32>, CancellationToken)
IRateLimitProvider.GetRateLimitValues()
Namespace: Alpaca.Markets
Assembly: Alpaca.Markets.dll
Syntax
public interface IAlpacaDataClient : IHistoricalQuotesClient<HistoricalQuotesRequest>, IHistoricalTradesClient<HistoricalTradesRequest>, IHistoricalBarsClient<HistoricalBarsRequest>, IAlpacaScreenerClient, IRateLimitProvider

Methods

| Improve this Doc View Source

GetHistoricalAuctionsAsync(HistoricalAuctionsRequest, CancellationToken)

Gets historical auctions dictionary for several assets from Alpaca REST API endpoint.

Declaration
Task<IMultiPage<IAuction>> GetHistoricalAuctionsAsync(HistoricalAuctionsRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
HistoricalAuctionsRequest request

Historical auctions request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IMultiPage<IAuction>>

Read-only dictionary of historical auctions for specified assets (with pagination data).

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

GetLatestBarAsync(LatestMarketDataRequest, CancellationToken)

Gets most recent bar for single asset from Alpaca REST API endpoint.

Declaration
Task<IBar> GetLatestBarAsync(LatestMarketDataRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataRequest request

Latest bar data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IBar>

Read-only latest bar information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

GetLatestQuoteAsync(LatestMarketDataRequest, CancellationToken)

Gets most recent quote for singe asset from Alpaca REST API endpoint.

Declaration
Task<IQuote> GetLatestQuoteAsync(LatestMarketDataRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataRequest request

Latest quote data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IQuote>

Read-only current quote information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

GetLatestTradeAsync(LatestMarketDataRequest, CancellationToken)

Gets most recent trade for singe asset from Alpaca REST API endpoint.

Declaration
Task<ITrade> GetLatestTradeAsync(LatestMarketDataRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataRequest request

Latest trade data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<ITrade>

Read-only latest trade information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

GetSnapshotAsync(LatestMarketDataRequest, CancellationToken)

Gets current snapshot (latest trade/quote and minute/days bars) for singe asset from Alpaca REST API endpoint.

Declaration
Task<ISnapshot> GetSnapshotAsync(LatestMarketDataRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataRequest request

Latest snapshot data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<ISnapshot>

Read-only current snapshot information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListCorporateActionsAsync(CorporateActionsRequest, CancellationToken)

Returns the historical corporate actions for the current trading session according to request parameters.

Declaration
Task<ICorporateActionsResponse> ListCorporateActionsAsync(CorporateActionsRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
CorporateActionsRequest request

Historical auctions request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<ICorporateActionsResponse>

Read-only list of most active stocks ranked by trade count.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListExchangesAsync(CancellationToken)

Gets dictionary with exchange code to the exchange name mappings.

Declaration
Task<IReadOnlyDictionary<String, String>> ListExchangesAsync(CancellationToken cancellationToken = null)
Parameters
Type Name Description
CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, String>>

Read-only dictionary where the key is the exchange code and the value is the code's corresponding exchange name.

Exceptions
Type Condition
RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListHistoricalAuctionsAsync(HistoricalAuctionsRequest, CancellationToken)

Gets historical auctions list for single asset from Alpaca REST API endpoint.

Declaration
Task<IPage<IAuction>> ListHistoricalAuctionsAsync(HistoricalAuctionsRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
HistoricalAuctionsRequest request

Historical auctions request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IPage<IAuction>>

Read-only list of historical auctions for specified asset (with pagination data).

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListLatestBarsAsync(LatestMarketDataListRequest, CancellationToken)

Gets most recent bars for several assets from Alpaca REST API endpoint.

Declaration
Task<IReadOnlyDictionary<String, IBar>> ListLatestBarsAsync(LatestMarketDataListRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataListRequest request

Latest bar data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, IBar>>

Read-only dictionary with the latest bars information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListLatestQuotesAsync(LatestMarketDataListRequest, CancellationToken)

Gets most recent quotes for several assets from Alpaca REST API endpoint.

Declaration
Task<IReadOnlyDictionary<String, IQuote>> ListLatestQuotesAsync(LatestMarketDataListRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataListRequest request

Latest quote data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, IQuote>>

Read-only dictionary with the latest quotes information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListLatestTradesAsync(LatestMarketDataListRequest, CancellationToken)

Gets most recent trades for several assets from Alpaca REST API endpoint.

Declaration
Task<IReadOnlyDictionary<String, ITrade>> ListLatestTradesAsync(LatestMarketDataListRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataListRequest request

Latest trade data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, ITrade>>

Read-only dictionary with the latest trades information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListMostActiveStocksByTradeCountAsync(Nullable<Int32>, CancellationToken)

Returns the most active stocks by trade count for the current trading session.

Declaration
Task<IReadOnlyList<IActiveStock>> ListMostActiveStocksByTradeCountAsync(Int32? numberOfTopMostActiveStocks = null, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Nullable<Int32> numberOfTopMostActiveStocks

Number of top most active stocks to fetch per day.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyList<IActiveStock>>

Read-only list of most active stocks ranked by trade count.

Exceptions
Type Condition
RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListMostActiveStocksByVolumeAsync(Nullable<Int32>, CancellationToken)

Returns the most active stocks by volume for the current trading session.

Declaration
Task<IReadOnlyList<IActiveStock>> ListMostActiveStocksByVolumeAsync(Int32? numberOfTopMostActiveStocks = null, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Nullable<Int32> numberOfTopMostActiveStocks

Number of top most active stocks to fetch per day.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyList<IActiveStock>>

Read-only list of most active stocks ranked by volume.

Exceptions
Type Condition
RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListNewsArticlesAsync(NewsArticlesRequest, CancellationToken)

Gets historical news articles list from Alpaca REST API endpoint.

Declaration
Task<IPage<INewsArticle>> ListNewsArticlesAsync(NewsArticlesRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
NewsArticlesRequest request

Historical news articles request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IPage<INewsArticle>>

Read-only list of historical news articles for specified parameters (with pagination data).

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListQuoteConditionsAsync(Tape, CancellationToken)

Gets dictionary with quotes conditions code to the condition description mappings.

Declaration
Task<IReadOnlyDictionary<String, String>> ListQuoteConditionsAsync(Tape tape, CancellationToken cancellationToken = null)
Parameters
Type Name Description
Tape tape

SIP tape identifier for retrieving quote conditions.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, String>>

Read-only dictionary where the key is the quote conditions code and the value is the corresponding condition description.

Exceptions
Type Condition
RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListSnapshotsAsync(LatestMarketDataListRequest, CancellationToken)

Gets current snapshot (latest trade/quote and minute/days bars) for several assets from Alpaca REST API endpoint.

Declaration
Task<IReadOnlyDictionary<String, ISnapshot>> ListSnapshotsAsync(LatestMarketDataListRequest request, CancellationToken cancellationToken = null)
Parameters
Type Name Description
LatestMarketDataListRequest request

Latest snapshot data request parameters.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, ISnapshot>>

Read-only dictionary with the current snapshot information.

Exceptions
Type Condition
RequestValidationException

The request argument contains invalid data or some required data is missing, unable to create a valid HTTP request.

RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

| Improve this Doc View Source

ListTradeConditionsAsync(Tape, CancellationToken)

Gets dictionary with trades conditions code to the condition description mappings.

Declaration
Task<IReadOnlyDictionary<String, String>> ListTradeConditionsAsync(Tape tape, CancellationToken cancellationToken = null)
Parameters
Type Name Description
Tape tape

SIP tape identifier for retrieving trade conditions.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IReadOnlyDictionary<String, String>>

Read-only dictionary where the key is the trade conditions code and the value is the corresponding condition description.

Exceptions
Type Condition
RestClientErrorException

The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX