polygon: Access all Polygon.io Endpoints

View source: R/Polygon.R

polygonR Documentation

Access all Polygon.io Endpoints

Description

This function calls all Endpoints from the Polygon API docs.

Usage

polygon(ep = NULL, ..., params = NULL)

Arguments

ep

(character) Non-case-sensitive reference to the endpoint to be called as an abbreviation or by name. See Details for full endpoint details. Use the following keywords to quick-view abbreviations and full names for endpoints while programming (add a '+' to any keyword to return a list with full details: abbv, name, url, description, parameters etc):

  • 'all' View all endpoints that Alpaca users have access to.

  • 'ref'/'reference' View all reference endpoints.

  • 'sto'/'stocks' View all stock endpoints

Alternatively, if you know how to call the endpoint but would like a list of it's details, add '+' to the end of it (ie 'tt+' or 'ticker types+'.

...

Named arguments specific to the endpoint parameters. These can also be specified in a list via the params argument.

params

(list) A named list of parameters specific to the endpoint.

Details

Optional query parameters are mentioned if present. See the Polygon API docs for details on parameters and response data. Required path parameters are in bold. The first option for each required parameter is used as a default if none are specified. Endpoints are:

  • t Tickers: Query all ticker symbols which are supported by Polygon.io. This API includes Indices, Crypto, FX, and Stocks/Equities. Arguments:

    • "sort" (character) ticker, -ticker, type

    • "type" (character) Optional NULL, etp, cs

    • "market" (character) Optional NULL, stocks, indices

    • "locale" (character) Optional NULL, us, g

    • "search" (character) Optional NULL, microsoft

    • "perpage" (numeric) 50

    • "page" (numeric) 1

    • "active" (logical) Optional NULL, TRUE, FALSE

  • tt Ticker Types: Get the mapping of ticker types to descriptions / long names

  • td Ticker Details: Get the details of the symbol company/entity. These are important details which offer an overview of the entity. Things like name, sector, description, logo and similar companies. Arguments:

    • symbol (character) AAPL

  • tn Ticker News: Get news articles for this ticker. Arguments:

    • symbol (character) AAPL

    • "perpage" (numeric) 50

    • "page" (numeric) 1

  • m Markets: Get the list of currently supported markets

  • l Locales: Get the list of currently supported locales

  • ss Stock Splits: Get the historical splits for this symbol. Arguments:

    • symbol (character) AAPL

  • sd Stock Dividends: Get the historical dividends for this ticker. Arguments:

    • symbol (character) AAPL

  • sf Stock Financials: Current status of each market Arguments:

    • symbol (character) AAPL

    • "limit" (numeric) 5

    • "type" (character) Optional NULL, Y, YA, Q, QA, T, TA

    • "sort" (character) Optional NULL, reportPeriod, -reportPeriod, calendarDate, -calendarDate

  • ms Market Status: Current status of each market

  • mh Market Holidays: Get upcoming market holidays and their open/close times

  • e Exchanges: List of stock exchanges which are supported by Polygon.io

  • ht Historic Trades: Get historic NBBO quotes for a ticker. Arguments:

    • ticker (character) AAPL

    • date (Date) 2018-02-02

    • "timestamp" (numeric) Optional NULL, 1

    • "timestampLimit" (numeric) Optional NULL, 1

    • "reverse" (logical) Optional NULL, TRUE, FALSE

    • "limit" (numeric) 10, 50000

  • hq Historic Quotes (NBBO): Get historic NBBO quotes for a ticker. Arguments:

    • ticker (character) AAPL

    • date (Date) 2018-02-02

    • "timestamp" (numeric) Optional NULL, 1

    • "timestampLimit" (numeric) Optional NULL, 1

    • "reverse" (logical) Optional NULL, TRUE, FALSE

    • "limit" (numeric) 10, 50000

  • lt Last Trade for a Symbol: Get the last trade for a given stock. Arguments:

    • symbol (character) AAPL

  • lq Last Quote for a Symbol: Get the last quote tick for a given stock. Arguments:

    • symbol (character) AAPL

  • do Daily Open/Close: Get the open, close and afterhours prices of a symbol on a certain date. Arguments:

    • symbol (character) AAPL

    • date (Date) 2020-05-04

  • cm Condition Mappings: The mappings for conditions on trades and quotes. Arguments:

    • ticktype (character) trades, quotes

  • sa Snapshot - All tickers: Snapshot allows you to see all tickers current minute aggregate, daily aggregate and last trade. As well as previous days aggregate and calculated change for today.

  • st Snapshot - Single Ticker: See the current snapshot of a single ticker Arguments:

    • ticker (character) AAPL

  • sg Snapshot - Gainers/Losers: See the current snapshot of the top 20 gainers or losers of the day at the moment. Arguments:

    • direction (character) gainers, losers

  • pc Previous Close: Get the previous day close for the specified ticker Arguments:

    • ticker (character) AAPL

    • "unadjusted" (logical) Optional NULL, TRUE, FALSE

  • a Aggregates - see market_data

  • gd Grouped Daily (Bars): Get the daily OHLC for entire markets. Arguments:

    • locale (character) US, See Locales Endpoint

    • market (character) STOCKS, See Markets Endpoint

    • date (Date) 2019-02-01

    • "unadjusted" (logical) Optional NULL, TRUE, FALSE

This function is not vectorized. Only a single endpoint may be called at a time. Thus any endpoints with path parameters (parameters denoted in bold) require that a single combination of path parameters be passed for a given call.

Value

Response (tibble/list/data.frame) depending on the endpoint. The core data of the response will be returned as the object. If query data is returned in addition to the core object, it is stored as a "query" attribute and accessed via attr(object, "query"). If a map object is returned with the response, it will be stored as a "map" attribute and accessed via attr(object, "map").


jagg19/AlpacaforR documentation built on July 3, 2023, 12:14 p.m.