Class StockMarketDataEndpoint
java.lang.Object
net.jacobpeterson.alpaca.rest.endpoint.AlpacaEndpoint
net.jacobpeterson.alpaca.rest.endpoint.marketdata.stock.StockMarketDataEndpoint
public class StockMarketDataEndpoint extends AlpacaEndpoint
-
Field Summary
Fields inherited from class net.jacobpeterson.alpaca.rest.endpoint.AlpacaEndpoint
alpacaClient, endpointPathSegment
-
Constructor Summary
Constructors Constructor Description StockMarketDataEndpoint(AlpacaClient alpacaClient)
Instantiates a newStockMarketDataEndpoint
. -
Method Summary
Modifier and Type Method Description StockBarsResponse
getBars(String symbol, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken, int barTimePeriodDuration, BarTimePeriod barTimePeriod, BarAdjustment barAdjustment, BarFeed barFeed)
GetsStockBar
aggregate historical data for the requested security.MultiStockBarsResponse
getBars(Collection<String> symbols, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken, int barTimePeriodDuration, BarTimePeriod barTimePeriod, BarAdjustment barAdjustment, BarFeed barFeed)
GetsStockBar
aggregate historical data for the requested securities.LatestStockQuoteResponse
getLatestQuote(String symbol)
Gets the latestStockQuote
for the requested security.LatestStockTradeResponse
getLatestTrade(String symbol)
Gets the latestStockTrade
for the requested security.StockQuotesResponse
getQuotes(String symbol, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken)
GetsStockQuote
(NBBO or National Best Bid and Offer) historical data for the requested security.Snapshot
getSnapshot(String symbol)
Gets aSnapshot
of the requested security.Map<String,Snapshot>
getSnapshots(Collection<String> symbols)
GetsSnapshot
s of the requested securities.StockTradesResponse
getTrades(String symbol, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken)
GetsStockTrade
historical data for the requested security.
-
Constructor Details
-
StockMarketDataEndpoint
Instantiates a newStockMarketDataEndpoint
.- Parameters:
alpacaClient
- theAlpacaClient
-
-
Method Details
-
getTrades
public StockTradesResponse getTrades(String symbol, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken) throws AlpacaClientExceptionGetsStockTrade
historical data for the requested security.- Parameters:
symbol
- the symbol to query forstart
- filter data equal to or after thisZonedDateTime
. Fractions of a second are not accepted.end
- filter data equal to or before thisZonedDateTime
. Fractions of a second are not accepted.limit
- number of data points to return. Must be in range 1-10000, defaults to 1000 ifnull
is givenpageToken
- pagination token to continue from- Returns:
- the
StockTradesResponse
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getLatestTrade
Gets the latestStockTrade
for the requested security.- Parameters:
symbol
- the symbol to query for- Returns:
- the
LatestStockTradeResponse
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getQuotes
public StockQuotesResponse getQuotes(String symbol, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken) throws AlpacaClientExceptionGetsStockQuote
(NBBO or National Best Bid and Offer) historical data for the requested security.- Parameters:
symbol
- the symbol to query forstart
- filter data equal to or after thisZonedDateTime
. Fractions of a second are not accepted.end
- filter data equal to or before thisZonedDateTime
. Fractions of a second are not accepted.limit
- number of data points to return. Must be in range 1-10000, defaults to 1000 ifnull
is givenpageToken
- pagination token to continue from- Returns:
- the
StockQuotesResponse
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getLatestQuote
Gets the latestStockQuote
for the requested security.- Parameters:
symbol
- the symbol to query for- Returns:
- the
LatestStockQuoteResponse
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getBars
public StockBarsResponse getBars(String symbol, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken, int barTimePeriodDuration, BarTimePeriod barTimePeriod, BarAdjustment barAdjustment, BarFeed barFeed) throws AlpacaClientExceptionGetsStockBar
aggregate historical data for the requested security.- Parameters:
symbol
- the symbol to query forstart
- filter data equal to or after thisZonedDateTime
. Fractions of a second are not accepted.end
- filter data equal to or before thisZonedDateTime
. Fractions of a second are not accepted.limit
- number of data points to return. Must be in range 1-10000, defaults to 1000 ifnull
is givenpageToken
- pagination token to continue frombarTimePeriodDuration
- the duration for the givenbarTimePeriod
parameter. e.g. for15Min
bars, you would supply15
for this parameter andBarTimePeriod.MINUTE
for thebarTimePeriod
parameter.barTimePeriod
- theBarTimePeriod
. e.g. for15Min
bars, you would supplyBarTimePeriod.MINUTE
for this parameter and15
for thebarTimePeriodDuration
parameter.barAdjustment
- specifies the corporate action adjustment for the stocks. Default value isBarAdjustment.RAW
barFeed
- defaults toBarFeed.IEX
for Free users andBarFeed.SIP
for users with an Unlimited subscription- Returns:
- the
StockBarsResponse
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getBars
public MultiStockBarsResponse getBars(Collection<String> symbols, ZonedDateTime start, ZonedDateTime end, Integer limit, String pageToken, int barTimePeriodDuration, BarTimePeriod barTimePeriod, BarAdjustment barAdjustment, BarFeed barFeed) throws AlpacaClientExceptionGetsStockBar
aggregate historical data for the requested securities.- Parameters:
symbols
- aCollection
of symbols to query forstart
- filter data equal to or after thisZonedDateTime
. Fractions of a second are not accepted.end
- filter data equal to or before thisZonedDateTime
. Fractions of a second are not accepted.limit
- number of data points to return. Must be in range 1-10000, defaults to 1000 ifnull
is givenpageToken
- pagination token to continue frombarTimePeriodDuration
- the duration for the givenbarTimePeriod
parameter. e.g. for15Min
bars, you would supply15
for this parameter andBarTimePeriod.MINUTE
for thebarTimePeriod
parameter.barTimePeriod
- theBarTimePeriod
. e.g. for15Min
bars, you would supplyBarTimePeriod.MINUTE
for this parameter and15
for thebarTimePeriodDuration
parameter.barAdjustment
- specifies the corporate action adjustment for the stocks. Default value isBarAdjustment.RAW
barFeed
- defaults toBarFeed.IEX
for Free users andBarFeed.SIP
for users with an Unlimited subscription- Returns:
- the
MultiStockBarsResponse
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getSnapshots
GetsSnapshot
s of the requested securities.- Parameters:
symbols
- aCollection
of symbols to query for- Returns:
- a
Map
with they keys being the symbol and their values being theSnapshot
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-
getSnapshot
Gets aSnapshot
of the requested security.- Parameters:
symbol
- the symbol to query for- Returns:
- the
Snapshot
- Throws:
AlpacaClientException
- thrown forAlpacaClientException
s
-