public class AlpacaAPI extends Object
AlpacaAPI
class contains several instances of various AlpacaEndpoint
s and
AlpacaWebsocket
s to interface with Alpaca. You will generally only need one instance of this class in your
application. Note that many methods inside the various AlpacaEndpoint
s allow null
to be passed
in as a parameter if it is optional.
Modifier and Type | Class and Description |
---|---|
static class |
AlpacaAPI.Builder
A builder for
AlpacaAPI |
Constructor and Description |
---|
AlpacaAPI()
Instantiates a new
AlpacaAPI using properties specified in alpaca.properties file (or their
associated defaults). |
AlpacaAPI(okhttp3.OkHttpClient okHttpClient,
String keyID,
String secretKey,
String oAuthToken,
EndpointAPIType endpointAPIType,
DataAPIType dataAPIType)
Instantiates a new
AlpacaAPI . |
AlpacaAPI(String oAuthToken)
Instantiates a new
AlpacaAPI . |
AlpacaAPI(String keyID,
String secretKey)
Instantiates a new
AlpacaAPI . |
AlpacaAPI(String keyID,
String secretKey,
EndpointAPIType endpointAPIType,
DataAPIType dataAPIType)
Instantiates a new
AlpacaAPI . |
Modifier and Type | Method and Description |
---|---|
AccountEndpoint |
account() |
AccountActivitiesEndpoint |
accountActivities() |
AccountConfigurationEndpoint |
accountConfiguration() |
AssetsEndpoint |
assets() |
static AlpacaAPI.Builder |
builder()
Creates a
AlpacaAPI.Builder for AlpacaAPI . |
CalendarEndpoint |
calendar() |
ClockEndpoint |
clock() |
CryptoMarketDataEndpoint |
cryptoMarketData() |
MarketDataWebsocketInterface |
cryptoMarketDataStreaming() |
AlpacaClient |
getBrokerClient() |
AlpacaClient |
getCryptoDataClient() |
okhttp3.OkHttpClient |
getOkHttpClient() |
AlpacaClient |
getStockDataClient() |
OrdersEndpoint |
orders() |
PortfolioHistoryEndpoint |
portfolioHistory() |
PositionsEndpoint |
positions() |
StockMarketDataEndpoint |
stockMarketData() |
MarketDataWebsocketInterface |
stockMarketDataStreaming() |
StreamingWebsocketInterface |
streaming() |
WatchlistEndpoint |
watchlist() |
public AlpacaAPI()
AlpacaAPI
using properties specified in alpaca.properties
file (or their
associated defaults).public AlpacaAPI(String keyID, String secretKey)
AlpacaAPI
.keyID
- the key IDsecretKey
- the secret keypublic AlpacaAPI(String keyID, String secretKey, EndpointAPIType endpointAPIType, DataAPIType dataAPIType)
AlpacaAPI
.keyID
- the key IDsecretKey
- the secret keyendpointAPIType
- the EndpointAPIType
dataAPIType
- the DataAPIType
public AlpacaAPI(String oAuthToken)
AlpacaAPI
.oAuthToken
- the OAuth token. Note that the Data API v2 does not work with OAuth tokens.public AlpacaAPI(okhttp3.OkHttpClient okHttpClient, String keyID, String secretKey, String oAuthToken, EndpointAPIType endpointAPIType, DataAPIType dataAPIType)
AlpacaAPI
.okHttpClient
- the OkHttpClient
or null
to create a default instancekeyID
- the key IDsecretKey
- the secret keyoAuthToken
- the OAuth tokenendpointAPIType
- the EndpointAPIType
dataAPIType
- the DataAPIType
public AccountEndpoint account()
AccountEndpoint
public CryptoMarketDataEndpoint cryptoMarketData()
CryptoMarketDataEndpoint
public StockMarketDataEndpoint stockMarketData()
StockMarketDataEndpoint
public OrdersEndpoint orders()
OrdersEndpoint
public PositionsEndpoint positions()
PositionsEndpoint
public AssetsEndpoint assets()
AssetsEndpoint
public WatchlistEndpoint watchlist()
WatchlistEndpoint
public CalendarEndpoint calendar()
CalendarEndpoint
public ClockEndpoint clock()
ClockEndpoint
public AccountConfigurationEndpoint accountConfiguration()
AccountConfigurationEndpoint
public AccountActivitiesEndpoint accountActivities()
AccountActivitiesEndpoint
public PortfolioHistoryEndpoint portfolioHistory()
PortfolioHistoryEndpoint
public StreamingWebsocketInterface streaming()
StreamingWebsocketInterface
public MarketDataWebsocketInterface cryptoMarketDataStreaming()
MarketDataWebsocketInterface
public MarketDataWebsocketInterface stockMarketDataStreaming()
MarketDataWebsocketInterface
public okhttp3.OkHttpClient getOkHttpClient()
public AlpacaClient getBrokerClient()
public AlpacaClient getCryptoDataClient()
public AlpacaClient getStockDataClient()
public static AlpacaAPI.Builder builder()
AlpacaAPI.Builder
for AlpacaAPI
.AlpacaAPI.Builder