bars_complete: Query the API as many times as necessary to fill a...

bars_completeR Documentation

Query the API as many times as necessary to fill a market_data query

Description

This function uses the output from bars_missing and fills the missing data. It's arguments are represented in the first object .vn.

Usage

bars_complete(
  bars,
  ...,
  evar = get0("evar", mode = "environment", envir = rlang::caller_env())
)

Arguments

...

Arguments passed on to market_data

symbol

(character) The stock or stocks (in vector format) for which data will be retrieved. Non case-sensitive.

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.

bars

Returned by bars_get

Details

The arguments for all bars_\* functions will be called from the environment from which the function is called if not specified explicitly. If params need to be specified explicitly, all params must be named.


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