public class PolygonAPI
extends java.lang.Object
Constructor and Description |
---|
PolygonAPI()
Instantiates a new polygon API.
|
PolygonAPI(java.lang.String keyId)
Instantiates a new polygon API.
|
PolygonAPI(java.lang.String baseAPIURL,
java.lang.String websocketURL,
java.lang.String keyID)
Instantiates a new polygon API.
|
Modifier and Type | Method and Description |
---|---|
void |
addPolygonStreamListener(PolygonStreamListener streamListener)
Adds the polygon stream listener.
|
AggregatesResponse |
getAggregates(java.lang.String ticker,
java.lang.Integer multiplier,
Timespan timeSpan,
java.time.LocalDate fromDate,
java.time.LocalDate toDate,
java.lang.Boolean unadjusted)
Get aggregates for a date range, in custom time window sizes
|
ConditionsMapping |
getConditionsMapping(ConditionMappingsType conditionMappingsType)
The mappings for conditions on trades and quotes.
|
DailyOpenCloseResponse |
getDailyOpenClose(java.lang.String symbol,
java.time.LocalDate date)
Get the open, close and afterhours prices of a symbol on a certain date.
|
java.util.ArrayList<Exchange> |
getExchanges()
List of stock exchanges which are supported by Polygon.io
|
GroupedDailyResponse |
getGroupedDaily(java.lang.String locale,
Market market,
java.time.LocalDate date,
java.lang.Boolean unadjusted)
Get the daily OHLC for entire markets.
|
HistoricQuotesResponse |
getHistoricQuotes(java.lang.String ticker,
java.time.LocalDate date,
java.lang.Long timestamp,
java.lang.Long timestampLimit,
java.lang.Boolean reverse,
java.lang.Integer limit)
Get historic NBBO quotes for a ticker.
|
HistoricTradesResponse |
getHistoricTrades(java.lang.String ticker,
java.time.LocalDate date,
java.lang.Long timestamp,
java.lang.Long timestampLimit,
java.lang.Boolean reverse,
java.lang.Integer limit)
Get historic trades for a symbol.
|
LastQuoteResponse |
getLastQuote(java.lang.String symbol)
Get the last quote for a given stock.
|
LastTradeResponse |
getLastTrade(java.lang.String symbol)
Get the last trade for a given stock.
|
LocalesResponse |
getLocales()
Get the list of currently supported locales
|
java.util.ArrayList<MarketHoliday> |
getMarketHolidays()
Get upcoming market holidays and their open/close times.
|
MarketsResponse |
getMarkets()
Get the list of currently supported markets
|
MarketStatus |
getMarketStatus()
Current status of each market.
|
PreviousCloseResponse |
getPreviousClose(java.lang.String ticker,
java.lang.Boolean unadjusted)
Get the previous day close for the specified ticker
|
SnapshotAllTickersResponse |
getSnapshotAllTickers()
Snapshot allows you to see all tickers current minute aggregate, daily aggregate and last trade.
|
SnapshotGainersLosersResponse |
getSnapshotsGainersLosers(GainersLosersDirection gainersLosersDirection)
See the current snapshot of the top 20 gainers of the day at the moment.
|
SnapshotSingleTickerResponse |
getSnapshotSingleTicker(java.lang.String ticker)
See the current snapshot of a single ticker
|
SnapshotTickerBook |
getSnapshotTickerBook(java.lang.String locale,
Market market,
java.lang.String ticker)
See the current snapshot of Level II data on IEX for the given ticker.
|
StockDividendsResponse |
getStockDividends(java.lang.String symbol)
Get the historical dividends for this symbol.
|
StockFinancialsResponse |
getStockFinancials(java.lang.String symbol,
java.lang.Integer limit,
FinancialReportType financialReportType,
FinancialSort financialSort)
Get the historical financials for this ticker.
|
StockSplitsResponse |
getStockSplits(java.lang.String symbol)
Get the historical splits for this symbol
|
TickerDetails |
getTickerDetails(java.lang.String symbol)
Get the details of the symbol company/entity.
|
java.util.ArrayList<TickerNews> |
getTickerNews(java.lang.String symbol,
java.lang.Integer perpage,
java.lang.Integer page)
Get news articles for this symbol.
|
TickersResponse |
getTickers(TickerSort tickerSort,
StockType stockType,
Market market,
java.lang.String locale,
java.lang.String search,
java.lang.Integer perpage,
java.lang.Integer page,
java.lang.Boolean active)
Query all ticker symbols which are supported by Polygon.io.
|
TickerTypes |
getTickerTypes()
Get the mapping of ticker types to descriptions / long names.
|
void |
removePolygonStreamListener(PolygonStreamListener streamListener)
Removes the polygon stream listener.
|
java.lang.String |
toString() |
public PolygonAPI()
public PolygonAPI(java.lang.String keyId)
keyId
- the key idpublic PolygonAPI(java.lang.String baseAPIURL, java.lang.String websocketURL, java.lang.String keyID)
baseAPIURL
- the base api urlwebsocketURL
- the websocket urlkeyID
- the key idpublic TickersResponse getTickers(TickerSort tickerSort, StockType stockType, Market market, java.lang.String locale, java.lang.String search, java.lang.Integer perpage, java.lang.Integer page, java.lang.Boolean active) throws PolygonAPIRequestException
tickerSort
- Which field to sort by.stockType
- If you want the results to only container a certain type.market
- Get tickers for a specific marketlocale
- Get tickers for a specific region/localesearch
- Search the name of tickersperpage
- How many items to be on each page during pagination. Max 50page
- Which page of results to returnactive
- Filter for only active or inactive symbolsPolygonAPIRequestException
- the polygon API exceptionpublic TickerTypes getTickerTypes() throws PolygonAPIRequestException
PolygonAPIRequestException
public TickerDetails getTickerDetails(java.lang.String symbol) throws PolygonAPIRequestException
symbol
- symbol we want details forPolygonAPIRequestException
- the polygon API exceptionpublic java.util.ArrayList<TickerNews> getTickerNews(java.lang.String symbol, java.lang.Integer perpage, java.lang.Integer page) throws PolygonAPIRequestException
symbol
- the symbol we want details forperpage
- How many items to be on each page during pagination. Max 50page
- Which page of results to returnPolygonAPIRequestException
- the polygon API exceptionpublic MarketsResponse getMarkets() throws PolygonAPIRequestException
PolygonAPIRequestException
- the polygon API exceptionpublic LocalesResponse getLocales() throws PolygonAPIRequestException
PolygonAPIRequestException
- the polygon API exceptionpublic StockSplitsResponse getStockSplits(java.lang.String symbol) throws PolygonAPIRequestException
symbol
- symbol we want details forPolygonAPIRequestException
- the polygon API exceptionpublic StockDividendsResponse getStockDividends(java.lang.String symbol) throws PolygonAPIRequestException
symbol
- symbol we want details forPolygonAPIRequestException
- the polygon API exceptionpublic StockFinancialsResponse getStockFinancials(java.lang.String symbol, java.lang.Integer limit, FinancialReportType financialReportType, FinancialSort financialSort) throws PolygonAPIRequestException
symbol
- symbol we want details forlimit
- limit the number of resultsfinancialReportType
- type of reportsfinancialSort
- sort directionPolygonAPIRequestException
- the polygon API exceptionpublic MarketStatus getMarketStatus() throws PolygonAPIRequestException
PolygonAPIRequestException
- the polygon api request exceptionpublic java.util.ArrayList<MarketHoliday> getMarketHolidays() throws PolygonAPIRequestException
PolygonAPIRequestException
- the polygon api request exceptionpublic java.util.ArrayList<Exchange> getExchanges() throws PolygonAPIRequestException
PolygonAPIRequestException
- the polygon API exceptionpublic HistoricTradesResponse getHistoricTrades(java.lang.String ticker, java.time.LocalDate date, java.lang.Long timestamp, java.lang.Long timestampLimit, java.lang.Boolean reverse, java.lang.Integer limit) throws PolygonAPIRequestException
ticker
- Ticker symbol we want ticks fordate
- Date/Day of the historic ticks to retrievetimestamp
- Timestamp offset, used for pagination. This is the offset at which to start the results.
Using the timestamp of the last result as the offset will give you the next page of
results.timestampLimit
- Maximum timestamp allowed in the results.reverse
- Reverse the order of the results. This is useful in combination with timestamp param.limit
- Limit the size of response, Max 50000PolygonAPIRequestException
- the polygon API exceptionpublic HistoricQuotesResponse getHistoricQuotes(java.lang.String ticker, java.time.LocalDate date, java.lang.Long timestamp, java.lang.Long timestampLimit, java.lang.Boolean reverse, java.lang.Integer limit) throws PolygonAPIRequestException
ticker
- Ticker symbol we want ticks fordate
- Date/Day of the historic ticks to retrievetimestamp
- Timestamp offset, used for pagination. This is the offset at which to start the results.
Using the timestamp of the last result as the offset will give you the next page of
results.timestampLimit
- Maximum timestamp allowed in the results.reverse
- Reverse the order of the results. This is useful in combination with timestamp param.limit
- Limit the size of response, Max 50000PolygonAPIRequestException
- the polygon API exceptionpublic LastTradeResponse getLastTrade(java.lang.String symbol) throws PolygonAPIRequestException
symbol
- Symbol of the stock to getPolygonAPIRequestException
- the polygon API exceptionpublic LastQuoteResponse getLastQuote(java.lang.String symbol) throws PolygonAPIRequestException
symbol
- Symbol of the stock to getPolygonAPIRequestException
- the polygon API exceptionpublic DailyOpenCloseResponse getDailyOpenClose(java.lang.String symbol, java.time.LocalDate date) throws PolygonAPIRequestException
symbol
- Symbol of the stock to getdate
- Date of the requested open/closePolygonAPIRequestException
- the polygon API exceptionpublic ConditionsMapping getConditionsMapping(ConditionMappingsType conditionMappingsType) throws PolygonAPIRequestException
conditionMappingsType
- Ticker type we want mappings forPolygonAPIRequestException
- the polygon api request exceptionpublic SnapshotAllTickersResponse getSnapshotAllTickers() throws PolygonAPIRequestException
PolygonAPIRequestException
- the polygon API exceptionpublic SnapshotSingleTickerResponse getSnapshotSingleTicker(java.lang.String ticker) throws PolygonAPIRequestException
ticker
- Ticker of the snapshotPolygonAPIRequestException
- the polygon API exceptionpublic SnapshotGainersLosersResponse getSnapshotsGainersLosers(GainersLosersDirection gainersLosersDirection) throws PolygonAPIRequestException
gainersLosersDirection
- the gainers losers directionPolygonAPIRequestException
- the polygon API exceptionpublic SnapshotTickerBook getSnapshotTickerBook(java.lang.String locale, Market market, java.lang.String ticker) throws PolygonAPIRequestException
locale
- the localemarket
- the marketticker
- the tickerPolygonAPIRequestException
- the polygon API exceptionpublic PreviousCloseResponse getPreviousClose(java.lang.String ticker, java.lang.Boolean unadjusted) throws PolygonAPIRequestException
ticker
- Ticker symbol of the requestunadjusted
- Set to true if the results should NOT be adjusted for splits.PolygonAPIRequestException
- the polygon API exceptionpublic AggregatesResponse getAggregates(java.lang.String ticker, java.lang.Integer multiplier, Timespan timeSpan, java.time.LocalDate fromDate, java.time.LocalDate toDate, java.lang.Boolean unadjusted) throws PolygonAPIRequestException
ticker
- Ticker symbol of the requestmultiplier
- Size of the timespan multipliertimeSpan
- Size of the time windowfromDate
- From datetoDate
- To dateunadjusted
- Set to true if the results should NOT be adjusted for splitsPolygonAPIRequestException
- the polygon API exceptionpublic GroupedDailyResponse getGroupedDaily(java.lang.String locale, Market market, java.time.LocalDate date, java.lang.Boolean unadjusted) throws PolygonAPIRequestException
locale
- Locale of the aggregates ( See 'Locales' API )market
- Market of the aggregates ( See 'Markets' API )date
- To dateunadjusted
- Set to true if the results should NOT be adjusted for splits.PolygonAPIRequestException
- the polygon API exceptionpublic void addPolygonStreamListener(PolygonStreamListener streamListener)
streamListener
- the stream listenerpublic void removePolygonStreamListener(PolygonStreamListener streamListener)
streamListener
- the stream listenerpublic java.lang.String toString()
toString
in class java.lang.Object