Interface IAlpacaTradingClient
Provides unified type-safe access for Alpaca Trading API via HTTP/REST.
Inherited Members
Namespace: Alpaca.Markets
Assembly: Alpaca.Markets.dll
Syntax
public interface IAlpacaTradingClient : IRateLimitProvider
Methods
| Improve this Doc View SourceAddAssetIntoWatchListByIdAsync(ChangeWatchListRequest<Guid>, CancellationToken)
Adds asset into watch list using Alpaca REST API endpoint by watch list identifier.
Declaration
Task<IWatchList> AddAssetIntoWatchListByIdAsync(ChangeWatchListRequest<Guid> request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ChangeWatchListRequest<Guid> | request | Asset adding 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<IWatchList> | Updated watch list object with proper |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
AddAssetIntoWatchListByNameAsync(ChangeWatchListRequest<String>, CancellationToken)
Adds asset into watch list using Alpaca REST API endpoint by watch list name.
Declaration
Task<IWatchList> AddAssetIntoWatchListByNameAsync(ChangeWatchListRequest<String> request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ChangeWatchListRequest<String> | request | Asset adding 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<IWatchList> | Updated watch list object with proper |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
CancelAllOrdersAsync(CancellationToken)
Cancels all open orders using Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IOrderActionStatus>> CancelAllOrdersAsync(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<IReadOnlyList<IOrderActionStatus>> | List of order cancellation status objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
CancelOrderAsync(Guid, CancellationToken)
Cancels order on server by server order ID using Alpaca REST API endpoint.
Declaration
Task<Boolean> CancelOrderAsync(Guid orderId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | orderId | Server order ID for cancelling. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<Boolean> |
|
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
CreateWatchListAsync(NewWatchListRequest, CancellationToken)
Add new watch list object into Alpaca REST API endpoint.
Declaration
Task<IWatchList> CreateWatchListAsync(NewWatchListRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
NewWatchListRequest | request | New watch list 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<IWatchList> | Newly created watch list object. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeleteAllPositionsAsync(DeleteAllPositionsRequest, CancellationToken)
Liquidates all open positions at market price using Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IPositionActionStatus>> DeleteAllPositionsAsync(DeleteAllPositionsRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteAllPositionsRequest | request | All positions deletion 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<IReadOnlyList<IPositionActionStatus>> | List of position cancellation status objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeleteAllPositionsAsync(CancellationToken)
Liquidates all open positions at market price using Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IPositionActionStatus>> DeleteAllPositionsAsync(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<IReadOnlyList<IPositionActionStatus>> | List of position cancellation status objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeleteAssetFromWatchListByIdAsync(ChangeWatchListRequest<Guid>, CancellationToken)
Deletes asset from watch list using Alpaca REST API endpoint by watch list identifier.
Declaration
Task<IWatchList> DeleteAssetFromWatchListByIdAsync(ChangeWatchListRequest<Guid> request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ChangeWatchListRequest<Guid> | request | Asset deleting 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<IWatchList> | Updated watch list object with proper |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeleteAssetFromWatchListByNameAsync(ChangeWatchListRequest<String>, CancellationToken)
Deletes asset from watch list using Alpaca REST API endpoint by watch list name.
Declaration
Task<IWatchList> DeleteAssetFromWatchListByNameAsync(ChangeWatchListRequest<String> request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ChangeWatchListRequest<String> | request | Asset deleting 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<IWatchList> | Updated watch list object with proper |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeletePositionAsync(DeletePositionRequest, CancellationToken)
Liquidate an open position at market price using Alpaca REST API endpoint.
Declaration
Task<IOrder> DeletePositionAsync(DeletePositionRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
DeletePositionRequest | request | Position deletion 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<IOrder> | The IOrder object that represents the position liquidation order (for tracking). |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeleteWatchListByIdAsync(Guid, CancellationToken)
Deletes watch list from Alpaca REST API endpoint by watch list identifier.
Declaration
Task<Boolean> DeleteWatchListByIdAsync(Guid watchListId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | watchListId | Unique watch list identifier. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<Boolean> | Returns |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
DeleteWatchListByNameAsync(String, CancellationToken)
Deletes watch list from Alpaca REST API endpoint by watch list name.
Declaration
Task<Boolean> DeleteWatchListByNameAsync(String name, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | User defined watch list name. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<Boolean> | Returns |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ExerciseOptionsPositionByIdAsync(Guid, CancellationToken)
Exercises a held option contract, converting it into the underlying asset based on the specified terms.
Declaration
Task<Boolean> ExerciseOptionsPositionByIdAsync(Guid contractId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | contractId | Option contract unique identifier. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<Boolean> | Returns |
ExerciseOptionsPositionBySymbolAsync(String, CancellationToken)
Exercises a held option contract, converting it into the underlying asset based on the specified terms.
Declaration
Task<Boolean> ExerciseOptionsPositionBySymbolAsync(String symbol, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | symbol | Option contract unique symbol name. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<Boolean> | Returns |
GetAccountAsync(CancellationToken)
Gets account information from Alpaca REST API endpoint.
Declaration
Task<IAccount> GetAccountAsync(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<IAccount> | Read-only account information. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetAccountConfigurationAsync(CancellationToken)
Gets account configuration settings from Alpaca REST API endpoint.
Declaration
Task<IAccountConfiguration> GetAccountConfigurationAsync(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<IAccountConfiguration> | Mutable version of account configuration object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetAnnouncementAsync(Guid, CancellationToken)
Gets single corporate action information from Alpaca REST API endpoint.
Declaration
Task<IAnnouncement> GetAnnouncementAsync(Guid announcementId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | announcementId | Corporate action identifier. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IAnnouncement> | Read-only corporate action information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetAssetAsync(String, CancellationToken)
Get single asset information by asset symbol from Alpaca REST API endpoint.
Declaration
Task<IAsset> GetAssetAsync(String symbol, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | symbol | Asset symbol for searching. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IAsset> | Read-only asset information. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetClockAsync(CancellationToken)
Get current time information from Alpaca REST API endpoint.
Declaration
Task<IClock> GetClockAsync(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<IClock> | Read-only clock information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetOptionContractByIdAsync(Guid, CancellationToken)
Gets option contract from Alpaca REST API endpoint using contract identifier.
Declaration
Task<IOptionContract> GetOptionContractByIdAsync(Guid contractId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | contractId | Option contract unique identifier. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IOptionContract> | Read-only list of corporate action information objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetOptionContractBySymbolAsync(String, CancellationToken)
Gets option contract from Alpaca REST API endpoint using contract symbol name.
Declaration
Task<IOptionContract> GetOptionContractBySymbolAsync(String symbol, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | symbol | Option contract unique symbol name. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IOptionContract> | Read-only list of corporate action information objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetOrderAsync(Guid, CancellationToken)
Get single order information by server order ID from Alpaca REST API endpoint.
Declaration
Task<IOrder> GetOrderAsync(Guid orderId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | orderId | Server order ID for searching. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IOrder> | Read-only order information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetOrderAsync(String, CancellationToken)
Get single order information by client order ID from Alpaca REST API endpoint.
Declaration
Task<IOrder> GetOrderAsync(String clientOrderId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | clientOrderId | Client order ID for searching. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IOrder> | Read-only order information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetPortfolioHistoryAsync(PortfolioHistoryRequest, CancellationToken)
Gets portfolio equity history from Alpaca REST API endpoint.
Declaration
Task<IPortfolioHistory> GetPortfolioHistoryAsync(PortfolioHistoryRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
PortfolioHistoryRequest | request | Portfolio history 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<IPortfolioHistory> | Read-only portfolio history information object. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetPositionAsync(String, CancellationToken)
Gets position information by asset symbol from Alpaca REST API endpoint.
Declaration
Task<IPosition> GetPositionAsync(String symbol, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | symbol | Position asset symbol. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IPosition> | Read-only position information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetWatchListByIdAsync(Guid, CancellationToken)
Get watch list object from Alpaca REST API endpoint by watch list identifier.
Declaration
Task<IWatchList> GetWatchListByIdAsync(Guid watchListId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | watchListId | Unique watch list identifier. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IWatchList> | Watch list object with proper |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
GetWatchListByNameAsync(String, CancellationToken)
Get watch list object from Alpaca REST API endpoint by watch list user-defined name.
Declaration
Task<IWatchList> GetWatchListByNameAsync(String name, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | User defined watch list name. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IWatchList> | Watch list object with proper |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListAccountActivitiesAsync(AccountActivitiesRequest, CancellationToken)
Gets list of account activities from Alpaca REST API endpoint by specific activity.
Declaration
Task<IReadOnlyList<IAccountActivity>> ListAccountActivitiesAsync(AccountActivitiesRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
AccountActivitiesRequest | request | Account activities 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<IReadOnlyList<IAccountActivity>> | Read-only list of account activity record objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListAnnouncementsAsync(AnnouncementsRequest, CancellationToken)
Gets list of different corporate actions from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IAnnouncement>> ListAnnouncementsAsync(AnnouncementsRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
AnnouncementsRequest | request | Corporate actions 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<IReadOnlyList<IAnnouncement>> | Read-only list of corporate action information objects. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListAssetsAsync(AssetsRequest, CancellationToken)
Gets list of available assets from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IAsset>> ListAssetsAsync(AssetsRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
AssetsRequest | request | Asset list 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<IReadOnlyList<IAsset>> | Read-only list of asset information objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListCalendarAsync(CalendarRequest, CancellationToken)
Gets list of trading days from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<ICalendar>> ListCalendarAsync(CalendarRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CalendarRequest | request | Calendar items 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<IReadOnlyList<ICalendar>> | Read-only list of trading date information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListIntervalCalendarAsync(CalendarRequest, CancellationToken)
Gets list of trading open/close intervals for each day from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IIntervalCalendar>> ListIntervalCalendarAsync(CalendarRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CalendarRequest | request | Calendar items 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<IReadOnlyList<IIntervalCalendar>> | Read-only list of trading date information object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListOptionContractsAsync(OptionContractsRequest, CancellationToken)
Gets list of active option contracts from Alpaca REST API endpoint. By default, only active contracts that expire before the upcoming weekend are returned.
Declaration
Task<IPage<IOptionContract>> ListOptionContractsAsync(OptionContractsRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
OptionContractsRequest | request | Option contracts 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<IOptionContract>> | Read-only list of corporate action information objects. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListOrdersAsync(ListOrdersRequest, CancellationToken)
Gets list of available orders from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IOrder>> ListOrdersAsync(ListOrdersRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ListOrdersRequest | request | List orders 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<IReadOnlyList<IOrder>> | Read-only list of order information objects. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListPositionsAsync(CancellationToken)
Gets list of available positions from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IPosition>> ListPositionsAsync(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<IReadOnlyList<IPosition>> | Read-only list of position information objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
ListWatchListsAsync(CancellationToken)
Gets list of watch list objects from Alpaca REST API endpoint.
Declaration
Task<IReadOnlyList<IWatchList>> ListWatchListsAsync(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<IReadOnlyList<IWatchList>> | Read-only list of watch list objects. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
PatchAccountConfigurationAsync(IAccountConfiguration, CancellationToken)
Updates account configuration settings using Alpaca REST API endpoint.
Declaration
Task<IAccountConfiguration> PatchAccountConfigurationAsync(IAccountConfiguration accountConfiguration, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IAccountConfiguration | accountConfiguration | New account configuration object for updating. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<IAccountConfiguration> | Mutable version of updated account configuration object. |
Exceptions
Type | Condition |
---|---|
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
PatchOrderAsync(ChangeOrderRequest, CancellationToken)
Updates existing order using Alpaca REST API endpoint.
Declaration
Task<IOrder> PatchOrderAsync(ChangeOrderRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ChangeOrderRequest | request | Patch order 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<IOrder> | Read-only order information object for updated order. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
PostOrderAsync(NewOrderRequest, CancellationToken)
Creates new order for execution using Alpaca REST API endpoint.
Declaration
Task<IOrder> PostOrderAsync(NewOrderRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
NewOrderRequest | request | New order placement 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<IOrder> | Read-only order information object for newly created order. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
PostOrderAsync(OrderBase, CancellationToken)
Creates new order for execution using Alpaca REST API endpoint.
Declaration
Task<IOrder> PostOrderAsync(OrderBase orderBase, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
OrderBase | orderBase | New order placement 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<IOrder> | Read-only order information object for newly created order. |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |
UpdateWatchListByIdAsync(UpdateWatchListRequest, CancellationToken)
Updates watch list object from Alpaca REST API endpoint by watch list identifier.
Declaration
Task<IWatchList> UpdateWatchListByIdAsync(UpdateWatchListRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateWatchListRequest | request | Update watch list 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<IWatchList> | Updated watch list object with proper |
Exceptions
Type | Condition |
---|---|
RequestValidationException | The |
RestClientErrorException | The response contains an error message or the received response cannot be deserialized properly due to JSON schema mismatch. |