public class PolygonAPI
extends java.lang.Object
Constructor | Description |
---|---|
PolygonAPI() |
Instantiates a new polygon API.
|
PolygonAPI(java.lang.String keyId) |
Instantiates a new polygon API.
|
PolygonAPI(java.lang.String keyId,
java.lang.String... polygonNatsServers) |
Instantiates a new polygon API.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addPolygonStreamListener(PolygonStreamListener streamListener) |
Adds the polygon stream listener.
|
Aggregates |
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
|
DailyOpenClose |
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.List<Exchange> |
getExchanges() |
List of stock exchanges which are supported by Polygon.io
|
Aggregates |
getGroupedDaily(Locale locale,
Market market,
java.time.LocalDate date,
java.lang.Boolean unadjusted) |
Get the daily OHLC for entire markets.
|
Quotes |
getHistoricQuotes(java.lang.String symbol,
java.time.LocalDate date,
java.lang.Integer offset,
java.lang.Integer limit) |
Get historic quotes for a symbol.
|
Trades |
getHistoricTrades(java.lang.String symbol,
java.time.LocalDate date,
java.lang.Integer offset,
java.lang.Integer limit) |
Get historic trades for a symbol.
|
Quote |
getLastQuote(java.lang.String symbol) |
Get the last quote tick for a given stock.
|
Trade |
getLastTrade(java.lang.String symbol) |
Get the last trade for a given stock.
|
java.util.List<Locale> |
getLocales() |
Get the list of currently supported locales
|
java.util.List<Market> |
getMarkets() |
Get the list of currently supported markets
|
Aggregates |
getPreviousClose(java.lang.String ticker,
java.lang.Boolean unadjusted) |
Get the previous day close for the specified ticker
|
Snapshot |
getSnapshot(java.lang.String symbol) |
See the current snapshot of a single ticker
|
java.util.List<Snapshot> |
getSnapshotAllTickers() |
Snapshot allows you to see all tickers current minute aggregate, daily aggregate and last
trade.
|
java.util.List<Snapshot> |
getSnapshotsGainers() |
See the current snapshot of the top 20 gainers of the day at the moment.
|
java.util.List<Snapshot> |
getSnapshotsLosers() |
See the current snapshot of the top 20 losers of the day at the moment.
|
java.util.List<Split> |
getSplits(java.lang.String symbol) |
Get the historical splits for this symbol
|
SymbolAnalystRatings |
getSymbolAnalystRatings(java.lang.String symbol) |
Get the analyst ratings of the symbol company/entity.
|
SymbolDetails |
getSymbolDetails(java.lang.String symbol) |
Get the details of the symbol company/entity.
|
java.util.List<SymbolDividend> |
getSymbolDividends(java.lang.String symbol) |
Get the historical dividends for this symbol.
|
java.util.List<SymbolEarning> |
getSymbolEarnings(java.lang.String symbol) |
Get the historical earnings for a company
|
SymbolEndpoints |
getSymbolEndpoints(java.lang.String symbol) |
Get gets the endpoints that are supported for a symbol.
|
java.util.List<SymbolFinancial> |
getSymbolFinancials(java.lang.String symbol) |
Get the historical financials for a company
|
java.util.List<SymbolNews> |
getSymbolNews(java.lang.String symbol) |
Get news articles for this symbol.
|
java.util.List<SymbolNews> |
getSymbolNews(java.lang.String symbol,
java.lang.Integer perpage,
java.lang.Integer page) |
Get news articles for this symbol.
|
Tickers |
getTickers(Sort sort,
Type type,
Market market,
Locale 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.
|
TypesMapping |
getTypesMapping() |
Get the mapping of ticker types to descriptions / long names
|
void |
removePolygonStreamListener(PolygonStreamListener streamListener) |
Removes the polygon stream listener.
|
public PolygonAPI()
public PolygonAPI(java.lang.String keyId)
keyId
- the key idpublic PolygonAPI(java.lang.String keyId, java.lang.String... polygonNatsServers)
keyId
- the key idpolygonNatsServers
- the polygon nats serverspublic SymbolEndpoints getSymbolEndpoints(java.lang.String symbol) throws PolygonAPIException
symbol
- we want the endpoint list for.PolygonAPIException
- the polygon API exceptionpublic SymbolDetails getSymbolDetails(java.lang.String symbol) throws PolygonAPIException
symbol
- we want details forPolygonAPIException
- the polygon API exceptionpublic SymbolAnalystRatings getSymbolAnalystRatings(java.lang.String symbol) throws PolygonAPIException
symbol
- we want analyst ratings forPolygonAPIException
- the polygon API exceptionpublic java.util.List<SymbolDividend> getSymbolDividends(java.lang.String symbol) throws PolygonAPIException
symbol
- we want details forPolygonAPIException
- the polygon API exceptionpublic java.util.List<SymbolEarning> getSymbolEarnings(java.lang.String symbol) throws PolygonAPIException
symbol
- we want details forPolygonAPIException
- the polygon API exceptionpublic java.util.List<SymbolFinancial> getSymbolFinancials(java.lang.String symbol) throws PolygonAPIException
symbol
- we want details forPolygonAPIException
- the polygon API exceptionpublic java.util.List<SymbolNews> getSymbolNews(java.lang.String symbol) throws PolygonAPIException
symbol
- the symbol we want details forPolygonAPIException
- the polygon API exceptionpublic java.util.List<SymbolNews> getSymbolNews(java.lang.String symbol, java.lang.Integer perpage, java.lang.Integer page) throws PolygonAPIException
symbol
- the symbol we want details forperpage
- How many items to be on each page during pagination. Max 50page
- Which page of results to returnPolygonAPIException
- the polygon API exceptionpublic Tickers getTickers(Sort sort, Type type, Market market, Locale locale, java.lang.String search, java.lang.Integer perpage, java.lang.Integer page, java.lang.Boolean active) throws PolygonAPIException
sort
- Which field to sort by.type
- 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 symbolsPolygonAPIException
- the polygon API exceptionpublic java.util.List<Market> getMarkets() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic java.util.List<Locale> getLocales() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic TypesMapping getTypesMapping() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic java.util.List<Split> getSplits(java.lang.String symbol) throws PolygonAPIException
symbol
- we want details forPolygonAPIException
- the polygon API exceptionpublic java.util.List<Exchange> getExchanges() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic Trades getHistoricTrades(java.lang.String symbol, java.time.LocalDate date, java.lang.Integer offset, java.lang.Integer limit) throws PolygonAPIException
symbol
- the symbol of the company to retrievedate
- Date/Day of the historic ticks to retreiveoffset
- 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.limit
- Limit the size of response, Max 50000PolygonAPIException
- the polygon API exceptionpublic Quotes getHistoricQuotes(java.lang.String symbol, java.time.LocalDate date, java.lang.Integer offset, java.lang.Integer limit) throws PolygonAPIException
symbol
- the symbol of the company to retrievedate
- Date/Day of the historic ticks to retreiveoffset
- 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.limit
- Limit the size of response, Max 50000PolygonAPIException
- the polygon API exceptionpublic Trade getLastTrade(java.lang.String symbol) throws PolygonAPIException
symbol
- Symbol of the stock to getPolygonAPIException
- the polygon API exceptionpublic Quote getLastQuote(java.lang.String symbol) throws PolygonAPIException
symbol
- Symbol of the quote to getPolygonAPIException
- the polygon API exceptionpublic DailyOpenClose getDailyOpenClose(java.lang.String symbol, java.time.LocalDate date) throws PolygonAPIException
symbol
- Symbol of the stock to getdate
- Date of the requested open/closePolygonAPIException
- the polygon API exceptionpublic java.util.List<Snapshot> getSnapshotAllTickers() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic Snapshot getSnapshot(java.lang.String symbol) throws PolygonAPIException
symbol
- Ticker of the snapshotPolygonAPIException
- the polygon API exceptionpublic java.util.List<Snapshot> getSnapshotsGainers() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic java.util.List<Snapshot> getSnapshotsLosers() throws PolygonAPIException
PolygonAPIException
- the polygon API exceptionpublic Aggregates getPreviousClose(java.lang.String ticker, java.lang.Boolean unadjusted) throws PolygonAPIException
ticker
- Ticker symbol of the requestunadjusted
- Set to true if the results should NOT be adjusted for splits.PolygonAPIException
- the polygon API exceptionpublic Aggregates getAggregates(java.lang.String ticker, java.lang.Integer multiplier, Timespan timeSpan, java.time.LocalDate fromDate, java.time.LocalDate toDate, java.lang.Boolean unadjusted) throws PolygonAPIException
ticker
- Ticker symbol of the requestmultiplier
- Size of the timespan multipliertimeSpan
- Size of the time windowfromDate
- the from datetoDate
- the to dateunadjusted
- Set to true if the results should NOT be adjusted for splitsPolygonAPIException
- the polygon API exceptionpublic Aggregates getGroupedDaily(Locale locale, Market market, java.time.LocalDate date, java.lang.Boolean unadjusted) throws PolygonAPIException
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.PolygonAPIException
- the polygon API exceptionpublic void addPolygonStreamListener(PolygonStreamListener streamListener)
streamListener
- the stream listenerpublic void removePolygonStreamListener(PolygonStreamListener streamListener)
streamListener
- the stream listener