bars_url: Create URLs for market_data endpoints

bars_urlR Documentation

Create URLs for market_data endpoints

Description

Internal function for generating query urls. The function is intended for use in an environment where its parameters already exist. See notes on specifying arguments in the Details section for bars_complete.

Usage

bars_url(
  symbol,
  ...,
  evar = get0("evar", mode = "environment", envir = rlang::caller_env())
)

Arguments

symbol

(character) Ticker symbol

...

Arguments passed on to market_data

v

(integer) The API version number.

timeframe

(character) For the v1 API, one of

  • 'tr'/'lt'/'trade'/'last_trade' For the last trade price. See Last Trade

  • 'qu'/'lq'/'quote'/'last_quote' For the last quote price. See Last Quote

  • 'm'/'min'`/`'minute' (multiplier can be 1/5/15)

  • 'd'/'day' (multiplier will be 1)

For the v2 IEX/SIP API the following timeframes are supported:

For the "p"/"polygon" API, multiplier can be any positive integer for any one of the following timeframe's:

  • 'm'/'min'/'minute'

  • 'h'/'hour'

  • 'd'/'day'

  • 'w'/'week'

  • 'M'/'mo'/'month' (Note capitalize M for month)

  • 'q'/'quarter'

  • 'y'/'year'

multiplier

For the v1 API, with 'minute' timeframe one of 1/5/15. Otherwise, defaults to 1. For the v2 API, multiplier can only be 1. For the "polygon" API, this can be any positive integer. Default 1.

from

(equivalent to start in v1) (Date/POSIXlt/Datetime(POSIXct)/character) See Details for formatting guidelines. Return data equal to or after this time. Default is 7 days ago.

to

(equivalent to end in v1) (Date/POSIXlt/Datetime(POSIXct)/character) See Details for formatting guidelines. Return data equal to or before this time. Default is today's date.

after

v1 only (Date/POSIXlt/Datetime(POSIXct)/character) See Details for formatting guidelines. Return data after this time. Default is 7 days ago. Cannot be used with to

until

v1 only (Date/POSIXlt/Datetime(POSIXct)/character) See Details for formatting guidelines. Return data before this time. Default is today's date. Cannot be used with from

limit

v1 & v2 (integer) The amount of bars to return per symbol. This can range from 1 to 1000 for v1 and 1 to 10000 for v2. Default 1000 (v1), 10000 (v2), 50000 (p).

full

(logical) If TRUE, the function will attempt to return the entire expected dataset based on the range of dates provided and perform a data completeness check. If the requested from, to dates/times exceed that which can be returned in a single call, the API will be called repeatedly to return the full dataset. If FALSE, the request will be submitted to the API as is. Note on rate limits: The v1 API has a call limit of 1000 bars and a rate limit of 200 requests per minute. If the rate limit is reached, queries will pause for 1 minute. The polygon API free tier has a call limit of 5 requests per minute, if the rate limit is reached, queries will pause for 1 minute. Default FALSE.

unadjusted

polygon only (logical) Set to TRUE if the results should NOT be adjusted for splits. Default FALSE.


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