PolygonIO

Documentation for PolygonIO.

PolygonIO.jl is a client accessing the WebSocket and RESTful APIs of Polygon.io in native Julia.

Installation

To install PolygonIO either do

using Pkg
Pkg.add("PolygonIO")

or switch to Pkg mode with ] and issue

pkg> add PolygonIO

Usage

using PolygonIO
opts = PolyOpts(API_KEY, Table.jl Supported Tabular Interface As Sink or nothing)
data = API_FUNC(opts, [args...]; [kwargs...])

Example

using PolygonIO
using DataFrames

opts = PolyOpts(API_KEY, DataFrame)
ticker_search_info = tickers(opts, "bitcoin")
julia> ticker_search_info = tickers(opts, "bitcoin")
10×10 DataFrame
 Row │ ticker       name                               market  locale  active  currency_symbol  currency_name         base_curre ⋯
     │ String       String                             String  String  Bool    String           String                String     ⋯
─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1 │ X:BSVUSD     Bitcoin SV - United States Dollar  crypto  global    true  USD              United States Dollar  BSV        ⋯
   2 │ X:BTCJPY     Bitcoin - Japanese Yen             crypto  global    true  JPY              Japanese Yen          BTC
   3 │ X:BCHGBP     Bitcoin Cash - Great Britian Pou…  crypto  global    true  GBP              Great Britian Pound   BCH
   4 │ X:BTCGBP     Bitcoin Cash - Great Britain Pou…  crypto  global    true  GBP              Great Britain Pound   BTC
   5 │ X:BCHCZK     Bitcoin Cash - Czech Koruna        crypto  global    true  CZK              Czech Koruna          BCH        ⋯
   6 │ X:ETHBTC     Ethereum - Bitcoin                 crypto  global    true  BTC              Bitcoin               ETH
   7 │ X:BTCEUR     Bitcoin - Euro                     crypto  global    true  EUR              Euro                  BTC
   8 │ X:BCHABCUSD  Bitcoin Cash ABC - United States…  crypto  global    true  USD              United States Dollar  BCHABC
   9 │ X:ATMUSD     Bitcoin ATM - United States Doll…  crypto  global    true  USD              United States Dollar  ATM        ⋯
  10 │ X:BCHUSD     Bitcoin Cash - United States Dol…  crypto  global    true  USD              United States Dollar  BCH
                                                                                                                 3 columns omitted

Features

  • [X] Full coverage of Stock API
  • [X] Full coverage of Forex API
  • [X] Full coverage of Crypto API
  • [X] Full coverage of Reference Data API
  • [ ] Full coverage of WebSocket API

User API Functions & Associated Upstream Endpoints

PolygonIO.PolyOptsType
PolyOpts <: AbstractPolyOptions

User options for the PolygonIO.

Options

  • api_key: String representing the API key from a registered polygon.io account.
  • table: Whether to covnert extracted results as a table or not. Compatible Table.jl or nothing for raw JSONs.

Examples

julia> using PolygonIO, DataFrames
julia> opts = PolyOpts(API_KEY, DataFrame)  # if user wants tabularised output
julia> opts = PolyOpts(API_KEY, nothing)    # if user wants raw JSON output
source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkNoResults, x, sink)

Internal function to apply a choice for no sink and no results scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkYesData, x, sink)

Internal function to apply a choice for no sink and yes data scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkYesLast, x, sink)

Internal function to apply a choice for no sink and yes last scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkYesResults, x, sink)

Internal function to apply a choice for no sink and yes results scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkYesTicker, x, sink)

Internal function to apply a choice for no sink and yes tickers scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkYesTickers, x, sink)

Internal function to apply a choice for no sink and yes tickers scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::NoSinkYesTicks, x, sink)

Internal function to apply a choice for no sink and yes ticks scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkNoResults, x, sink)

Internal function to apply a choice for yes sink and no results scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkNoResults, x, sink)

Internal function to apply a choice for no sink and no results scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesData, x, sink)

Internal function to apply a choice for yes sink and yes data scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesData, x, sink::Nothing)

Internal function to apply a choice for no sink and yes data scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesLast, x, sink)

Internal function to apply a choice for yes sink and yes last scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesLast, x, sink::Nothing)

Internal function to apply a choice for no sink and yes last scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesResults, x, sink)

Internal function to apply a choice for yes sink and yes results scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkNoResults, x, sink)

Internal function to apply a choice for no sink and yes results scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesTicker, x, sink)

Internal function to apply a choice for yes sink and yes ticker scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesTicker, x, sink::Nothing)

Internal function to apply a choice for yes sink and yes ticker scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesTickers, x, sink)

Internal function to apply a choice for yes sink and yes tickers scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesTickers, x, sink::Nothing)

Internal function to apply a choice for no sink and yes tickers scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesTicks, x, sink)

Internal function to apply a choice for yes sink and yes ticks scenarios.

source
PolygonIO.apply_choiceMethod
apply_choice(::YesSinkYesTicks, x, sink::Nothing)

Internal function to apply a choice for no sink and yes ticks scenarios.

source
PolygonIO.condition_mappingsFunction
condition_mappings(opts::PolyOpts, tickertype="trades")

Get a unified numerical mapping for conditions on trades and quotes. Each feed/exchange uses its own set of codes to identify conditions, so the same condition may have a different code depending on the originator of the data. Polygon.io defines its own mapping to allow for uniformly identifying a condition across feeds/exchanges.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • tickertype::AbstractString - The type of ticks to return mappings for. Must be one of "trades" or "quotes".

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> condition_mappings(opts, "trades")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1conditionmappingsanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_aggregates_barsFunction
crypto_aggregates_bars(opts::PolyOpts, cryptoTicker="X:BTCUSD", multiplier=1, timespan="day", from="2020-10-14", to="2020-10-14";
                       adjusted=true, sort="asc", limit=120, kwargs...)

Get aggregate bars for a cryptocurrency pair over a given date range in custom time window sizes. For example, if timespan = ‘minute’ and multiplier = ‘5’ then 5-minute bars will be returned.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • cryptoTicker: The ticker symbol of the currency pair.
  • multiplier: The size of the timespan multiplier.
  • timespan: The size of the timespan multiplier.
  • from: The start of the aggregate time window.
  • to: The end of the aggregate time window.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.
  • sort: Sort the results by timestamp. asc will return results in ascending order (oldest at the top), desc will return results in descending order (newest at the top).
  • limit: Limits the number of base aggregates queried to create the aggregate results. Max 50000 and Default 120.
  • kwargs: Additional arguments to pass to the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_aggregates_bars(opts, "X:BTCUSD", 5, "minute", "2020-10-14", "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2aggs_tickercryptoTickerrangemultiplier___timespan___from___toanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_daily_open_closeFunction
crypto_daily_open_close(opts::PolyOpts, from="BTC", to="USD", date="2020-10-14"; adjusted=true)

Get the open, close prices of a cryptocurrency symbol on a certain day.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • from: The "from" symbol of the pair.
  • to: The "to" symbol of the pair.
  • date: The date of the requested open/close in the format YYYY-MM-DD.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_daily_open_close(opts, "BTC", "USD", "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1open-close_cryptofrom___to___dateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_exchangesMethod
crypto_exchanges(opts::PolyOpts)

Get a list of cryptocurrency exchanges which are supported by Polygon.io.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_exchanges(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1metacrypto-exchangesanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_grouped_daily_barsFunction
crypto_grouped_daily_bars(opts::PolyOpts, date="2020-10-14"; adjusted=true)

Get the daily open, high, low, and close (OHLC) for the entire cryptocurrency markets.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • date: The beginning date for the aggregate window.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_grouped_daily_bars(opts, "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2aggsgroupedlocaleglobalmarket_cryptodateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_previous_closeFunction
crypto_previous_close(opts::PolyOpts, cryptoTicker="X:BTCUSD"; adjusted=true)

Get the previous day's open, high, low, and close (OHLC) for the specified cryptocurrency pair.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • cryptoTicker: The ticker symbol of the currency pair.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_previous_close(opts, "X:BTCUSD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2aggstickercryptoTickerprevanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_snapshot_all_tickersMethod
crypto_snapshot_all_tickers(opts::PolyOpts; kwargs...)

Get the current minute, day, and previous day’s aggregate, as well as the last trade and quote for all traded cryptocurrency symbols. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges. This can happen as early as 4am EST.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • kwargs: Additional arguments to pass to the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_snapshot_all_tickers(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketscryptotickersanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_snapshot_gainers_losersFunction
crypto_snapshot_gainers_losers(opts::PolyOpts, direction="gainers")

Get the current top 20 gainers or losers of the day in cryptocurrency markets. Top gainers are those tickers whose price has increased by the highest percentage since the previous day's close. Top losers are those tickers whose price has decreased by the highest percentage since the previous day's close. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • direction: The direction of the snapshot results to return. Options are "gainers" or "losers".

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_snapshot_gainers_losers(opts, "losers")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketscryptodirectionanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_snapshot_tickerFunction
crypto_snapshot_ticker(opts::PolyOpts, ticker="X:BTCUSD")

Get the current minute, day, and previous day’s aggregate, as well as the last trade and quote for a single traded cryptocurrency symbol. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • ticker: Ticker of the snapshot.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_snapshot_ticker(opts, "X:BTCUSD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketscrypto_tickerstickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.crypto_snapshot_ticker_full_bookFunction
crypto_snapshot_ticker_full_book(opts::PolyOpts, ticker="X:BTCUSD")

Get the current level 2 book of a single ticker. This is the combined book from all of the exchanges. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • ticker: The cryptocurrency ticker.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> crypto_snapshot_ticker_full_book(opts, "X:BTCUSD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketscryptotickerstickerbookanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.forex_aggregates_barsFunction
forex_aggregates_bars(opts::PolyOpts, forexTicker="C:EURUSD", multiplier=1, timespan="day", from="2020-10-14", to="2020-10-14";
                    adjusted=true, sort="asc", limit=120)

Get aggregate bars for a forex pair over a given date range in custom time window sizes. For example, if timespan = ‘minute’ and multiplier = ‘5’ then 5-minute bars will be returned.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • forexTicker: The ticker symbol of the currency pair.
  • multiplier: The size of the timespan multiplier.
  • timespan: The size of the time window.
  • from: The start of the aggregate time window.
  • to: The end of the aggregate time window.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.
  • sort: Sort the results by timestamp. asc will return results in ascending order (oldest at the top), desc will return results in descending order (newest at the top).
  • limit: Limits the number of base aggregates queried to create the aggregate results. Max 50000 and Default 120.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> forex_aggregates_bars(opts, "C:EURUSD", "5", "minute", "2020-10-14", "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2aggs_tickerforexTickerrangemultiplier___timespan___from___toanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.forex_grouped_daily_barsFunction
forex_grouped_daily_bars(opts::PolyOpts, date="2020-10-14"; adjusted=true)

Get the daily open, high, low, and close (OHLC) for the entire forex markets.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • date: The beginning date for the aggregate window.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> forex_grouped_daily_bars(opts, "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2aggsgroupedlocaleglobalmarket_fxdateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.forex_previous_closeFunction
forex_previous_close(opts::PolyOpts, forexTicker="C:EURUSD"; adjusted=true)

Get the previous day's open, high, low, and close (OHLC) for the specified forex pair.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • forexTicker: The ticker symbol of the currency pair.
  • adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> forex_previous_close(opts, "C:EURUSD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2aggstickerforexTickerprevanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.forex_snapshot_all_tickersMethod
forex_snapshot_all_tickers(opts::PolyOpts; kwargs...)

Get the current minute, day, and previous day’s aggregate, as well as the last trade and quote for all traded forex symbols. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges. This can happen as early as 4am EST.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • kwargs: The keyword arguments to pass to the PolyOpts.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> forex_snapshot_all_tickers(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketsforextickersanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.forex_snapshot_gainers_losersFunction
forex_snapshot_gainers_losers(opts::PolyOpts, direction="gainers")

Get the current top 20 gainers or losers of the day in forex markets. Top gainers are those tickers whose price has increased by the highest percentage since the previous day's close. Top losers are those tickers whose price has decreased by the highest percentage since the previous day's close. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • direction: The direction of the snapshot results to return. "gainers" or "losers".

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> forex_snapshot_gainers_losers(opts, "losers")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketsforexdirectionanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.forex_snapshot_tickerFunction
forex_snapshot_ticker(opts::PolyOpts, forexTicker="C:EURUSD")

Get the current minute, day, and previous day’s aggregate, as well as the last trade and quote for a single traded currency symbol. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • forexTicker: The forex ticker.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> forex_snapshot_ticker(opts, "C:EURUSD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2snapshotlocaleglobalmarketsforex_tickerstickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.generate_output_from_urlMethod
generate_output_from_url(choice::AbstractPolyChoice, url, params, sink)

Internal function to dynamically generate output from a user specified AbstractPolyChoice.

source
PolygonIO.historic_crypto_tradesFunction
historic_crypto_trades(opts::PolyOpts, from="BTC", to="USD", date="2020-10-14"; limit=100, kwargs...)

Get historic trade ticks for a cryptocurrency pair.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • from: The "from" symbol of the crypto pair.
  • to: The "to" symbol of the crypto pair.
  • date: The date/day of the historic ticks to retrieve.
  • limit: Limit the size of the response, max 10000. Defaults to 100.
  • kwargs: Additional arguments to pass to the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> historic_crypto_trades(opts, "BTC", "USD", "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1historic_cryptofrom___to___dateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.historic_forex_ticksFunction
historic_forex_ticks(opts::PolyOpts, from="AUD", to="USD", date="2020-10-14"; limit=100, kwargs...)

Get historic ticks for a forex currency pair.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • from: The "from" symbol of the currency pair. Example: For USD/JPY the from would be USD.
  • to: The "to" symbol of the currency pair. Example: For USD/JPY the to would be JPY.
  • date: The date/day of the historic ticks to retrieve.
  • limit: TLimit the size of the response, max 10000. Defualt 100.
  • kwargs: Additional parameters to pass to the Poly API.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> historic_forex_ticks(opts, "AUD", "AUD", "2020-10-14")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv1historic_forexfrom___to___dateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.last_quote_currency_pairFunction
last_quote_currency_pair(opts::PolyOpts, from="AUD", to="USD")

Get the last quote tick for a forex currency pair.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • from: The "from" symbol of the pair.
  • to: The "to" symbol of the pair.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> last_quote_currency_pair(opts, "AUD", "USD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv1lastquotecurrenciesfrom___toanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.last_trade_crypto_pairFunction
last_trade_crypto_pair(opts::PolyOpts, from="BTC", to="USD")

Get the last trade tick for a cryptocurrency pair.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • from: The "from" symbol of the pair.
  • to: The "to" symbol of the pair.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> last_trade_crypto_pair(opts, "BTC", "USD")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1last_cryptofrom___toanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.localesMethod
locales(opts::PolyOpts)

Get a list of locales currently supported by Polygon.io.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> locales(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2referencelocalesanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.market_holidaysMethod
market_holidays(opts::PolyOpts)

Get upcoming market holidays and their open/close times.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> market_holidays(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1marketstatusupcominganchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.market_statusMethod
market_status(opts::PolyOpts)

Get the current trading status of the exchanges and overall financial markets.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> market_status(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1marketstatusnowanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.marketsMethod
markets(opts::PolyOpts)

Get a list of markets that are currently supported by Polygon.io.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> markets(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2referencemarketsanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.real_time_currency_conversionFunction
real_time_currency_conversion(opts::PolyOpts, from="AUD", to="USD"; amount=100, precision=2)

Get currency conversions using the latest market conversion rates. Note than you can convert in both directions. For example USD to CAD or CAD to USD.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • from: The "from" symbol of the pair.
  • to: The "to" symbol of the pair.
  • amount: The amount to convert.
  • precision: The decimal precision of the conversion. Defaults to 2 which is 2 decimal places accuracy.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> real_time_currency_conversion(opts, "AUD", "USD"; amount=100, precision=2)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv1conversionfrom___toanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stock_dividendsMethod
stock_dividends(opts::PolyOpts, stocksTicker::AbstractString)

Get a list of historical dividends for a stock, including the relevant dates and the amount of the dividend.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString - The ticker symbol of the stock/equity.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stock_dividends(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2reference_dividendsstocksTickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stock_exchangesMethod
stock_exchanges(opts::PolyOpts)

Get a list of stock exchanges which are supported by Polygon.io.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stock_exchanges(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv1metaexchangesanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stock_financialsMethod
stock_financials(opts::PolyOpts, stocksTicker::AbstractString; limit=5, kwargs...)

Get historical financial data for a stock ticker.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString - The ticker symbol of the stock/equity.
  • limit::Integer - Limit the number of results.
  • kwargs::Any: A list of additional arguments to pass to the Polygon IO API.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stock_financials(opts, "AAPL", limit=5)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2referencefinancialsanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stock_splitsMethod
stock_splits(opts::PolyOpts, stocksTicker::AbstractString)

Get a list of historical stock splits for a ticker symbol, including the execution and payment dates of the stock split, and the split ratio.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString - The ticker symbol of the stock/equity.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stock_splits(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2reference_splitsstocksTickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_aggregates_barsMethod
stocks_aggregates_bars(opts::PolyOpts, stocksTicker::AbstractString;
                    multiplier=1, timespan="day", from="2020-10-14", to="2020-10-14",
                    adjusted=true, sort="asc", limit=120, kwargs...)

Get aggregate bars for a stock over a given date range in custom time window sizes. For example, if timespan = ‘minute’ and multiplier = ‘5’ then 5-minute bars will be returned.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString: The ticker symbol of the stock/equity.
  • multiplier::Int: TThe size of the timespan multiplier.
  • timespan::AbstractString: The size of the time window.
  • from::AbstractString: The start of the aggregate time window.
  • to::AbstractString: The end of the aggregate time window.
  • adjusted::Bool: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.
  • sort::AbstractString: Sort the results by timestamp. asc will return results in ascending order (oldest at the top), desc will return results in descending order (newest at the top).
  • limit::Int: Limits the number of base aggregates queried to create the aggregate results. Max 50000 and Default 120.
  • kwargs::AbstractString: Any additional arguments.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_aggregates_bars(opts, "AAPL", multiplier=5, timespan="minute", from="2017-01-01", to="2017-01-01")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2aggs_tickerstocksTickerrangemultiplier___timespan___from___toanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_daily_open_closeMethod
stocks_daily_open_close(opts::PolyOpts, stocksTicker::AbstractString, date::AbstractString; adjusted=true)

Get the open, close and afterhours prices of a stock symbol on a certain date.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString: The ticker symbol of the stock/equity.
  • date::AbstractString: The date of the requested open/close in the format YYYY-MM-DD.
  • adjusted::Bool: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_daily_open_close(opts, "AAPL", "2017-01-01")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv1open-closestocksTicker___dateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_grouped_daily_barsMethod
stocks_grouped_daily_bars(opts::PolyOpts, date::AbstractString; adjusted=true)

Get the daily open, high, low, and close (OHLC) for the entire stocks/equities markets.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • date::AbstractString: The beginning date for the aggregate window.
  • adjusted::Bool: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_grouped_daily_bars(opts, "2017-01-01")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2aggsgroupedlocaleusmarket_stocksdateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_last_quote_symbolMethod
stocks_last_quote_symbol(opts::PolyOpts, stocksTicker::AbstractString)

Get the most recent NBBO (Quote) tick for a given stock.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString: The ticker symbol of the stock/equity.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_last_quote_symbol(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2last_nbbostocksTickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_last_trade_symbolMethod
stocks_last_trade_symbol(opts::PolyOpts, stocksTicker::AbstractString)

Get the most recent trade for a given stock.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString: The ticker symbol of the stock/equity.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_last_trade_symbol(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2last_tradestocksTickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_previous_closeMethod
stocks_previous_close(opts::PolyOpts, stocksTicker::AbstractString; adjusted=true)

Get the previous day's open, high, low, and close (OHLC) for the specified stock ticker.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString: The ticker symbol of the stock/equity.
  • adjusted::Bool: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_previous_close(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2aggstickerstocksTickerprevanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_quotes_nbboMethod
stocks_quotes_nbbo(opts::PolyOpts, ticker::AbstractString, date::AbstractString; limit=10, reverse=true, kwargs...)

Get NBBO quotes for a given ticker symbol on a specified date.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • ticker::AbstractString: The ticker symbol we want quotes for.
  • date::AbstractString: The date/day of the quotes to retrieve in the format YYYY-MM-DD.
  • limit::Int: Limit the size of the response, max 50000 and default 10.
  • reverse::Bool: Reverse the order of the results.
  • kwargs::Any: A list of additional arguments to pass to the Polygon IO API.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_quotes_nbbo(opts, "AAPL", "2017-01-01")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2ticksstocksnbboticker___dateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_snapshot_all_tickersMethod
stocks_snapshot_all_tickers(opts::PolyOpts, tickers::AbstractString)

Get the current minute, day, and previous day’s aggregate, as well as the last trade and quote for all traded stock symbols. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges. This can happen as early as 4am EST.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • tickers::AbstractString: A comma separated list of tickers to get snapshots for.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_snapshot(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2snapshotlocaleusmarketsstockstickersanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_snapshot_gainers_losersFunction
stocks_snapshot_gainers_losers(opts::PolyOpts, direction="losers")

Get the current top 20 gainers or losers of the day in stocks/equities markets. Top gainers are those tickers whose price has increased by the highest percentage since the previous day's close. Top losers are those tickers whose price has decreased by the highest percentage since the previous day's close. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • direction::AbstractString: The direction of the snapshot results to return. The direction can be "gainers" or "losers".

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_snapshot_gainers_losers(opts, "losers")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2snapshotlocaleusmarketsstocksdirectionanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_snapshot_tickerMethod
stocks_snapshot_ticker(opts::PolyOpts, stocksTicker::AbstractString)

Get the current minute, day, and previous day’s aggregate, as well as the last trade and quote for a single traded stock ticker. Note: Snapshot data is cleared at 12am EST and gets populated as data is received from the exchanges. This can happen as early as 4am EST.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString: The ticker symbol of the stock/equity.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_snapshot_ticker(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array
  • See https://polygon.io/docs/getv2snapshotlocaleusmarketsstocks_tickersstocksTickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.stocks_tradesMethod
stocks_trades(opts::PolyOpts, ticker::AbstractString, date::AbstractString; limit=10, reverse=true, kwargs...)

Get stock trades for a given ticker symbol on a specified date.

Arguments

  • opts::PolyOpts: The PolyOpts object used to configure the request.
  • ticker::AbstractString: The ticker symbol we want trades for.
  • date::AbstractString: The date/day of the trades to retrieve in the format YYYY-MM-DD.
  • limit::Int: Limit the size of the response, max 50000 and default 10.
  • reverse::Boolean: Reverse the order of the results.
  • kwargs::Any: A list of additional arguments to pass to the Polygon IO API.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> stocks_trades(opts, "AAPL", "2017-01-01")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2ticksstockstradesticker___dateanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.ticker_detailsMethod
ticker_details(opts::PolyOpts, stocksTicker::AbstractString)

Get details for a ticker symbol's company/entity. This provides a general overview of the entity with information such as name, sector, exchange, logo and similar companies.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • stocksTicker::AbstractString - The ticker symbol of the stock/equity.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> ticker_details(opts, "AAPL")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2referencetickerdetails_anchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.ticker_details_vXMethod
ticker_details_vX(opts::PolyOpts, ticker::AbstractString, date::AbstractString)

Get a single ticker supported by Polygon.io. This response will have detailed information about the ticker and the company behind it.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • ticker::AbstractString - The ticker symbol of the asset.
  • date::AbstractString - Specify a point in time to get information about the ticker available on that date. When retrieving information from SEC filings, we compare this date with the period of report date on the SEC filing.

For example, consider an SEC filing submitted by AAPL on 2019-07-31, with a period of report date ending on 2019-06-29. That means that the filing was submitted on 2019-07-31, but the filing was created based on information from 2019-06-29. If you were to query for AAPL details on 2019-06-29, the ticker details would include information from the SEC filing. Defaults to the most recent available date.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> ticker_details_vX(opts, "AAPL", "2017-01-01")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getvXreference_tickerstickeranchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.ticker_newsMethod
ticker_news(opts::PolyOpts, ticker::AbstractString;
            published_utc_gte="2021-04-26", limit=10,
            order="descending", sort="published_utc",kwargs...)

Get the most recent news articles relating to a stock ticker symbol, including a summary of the article and a link to the original source.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • ticker::AbstractString - Ticker symbol. Return results where this field equals the value.
  • publishedutcgte::AbstractString - Return results where this field is greater than or equal to the value.
  • limit::Integer - Limit the size of the response, default is 100 and max is 1000. If your query returns more than the max limit and you want to retrieve the next page of results, see the next_url response attribute.
  • order::String - Order the results in ascending or descending order.
  • sort::String - The field key to sort the results on.
  • kwargs::Dict - Additional query parameters

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> ticker_news(opts, "AAPL", limit=5)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2referencenewsanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.ticker_typesMethod
ticker_types(opts::PolyOpts)

Get a mapping of ticker types to their descriptive names.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> ticker_types(opts)

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv2referencetypesanchor for documentation on response attributes and supported keyword arguments.
source
PolygonIO.tickersMethod

tickers(opts::PolyOpts, search::AbstractString; active=true, sort="ticker", order="asc", limit=10, kwargs...)

Query all ticker symbols which are supported by Polygon.io. This API currently includes Stocks/Equities, Crypto, and Forex.

Arguments

  • opts::PolyOpts - The PolyOpts object used to configure the request.
  • search::AbstractString - Search for terms within the ticker and/or company name.
  • active::Boolean - Specify if the tickers returned should be actively traded on the queried date. Default is true.
  • sort::String - The field to sort the results on. Default is ticker. If the search query parameter is present, sort is ignored and results are ordered by relevance.
  • order::String - The order to sort the results on. Default is asc (ascending).
  • limit::Integer - Limit the size of the response, default is 100 and max is 1000. If your query returns more than the max limit and you want to retrieve the next page of results, see the next_url response attribute.
  • kwargs::Dict - Additional query parameters.

Example

julia> opts = PolyOpts(API_KEY, nothing)
julia> tickers(opts, "bitcoin")

Returns

  • A JSON3.Array or specified tabular representation of the JSON3.Array.
  • See https://polygon.io/docs/getv3referencetickersanchor for documentation on response attributes and supported keyword arguments.
source