get_aggregates: get_aggregates

Description Usage Arguments Value Examples

View source: R/stocks.R

Description

Get OHLC aggregates for a date range, in custom time window sizes for a ticker.

Usage

1
2
3
4
5
6
7
get_aggregates(
  ticker,
  multiplier,
  timespan = c("minute", "hour", "day", "week", "month", "quarter", "year"),
  from,
  to
)

Arguments

ticker

(string) Ticker symbol of the request. Some tickers require a prefix, see examples below: Stocks: 'AAPL' Currencies: 'C:EURUSD' Crypto: 'X:BTCUSD'

multiplier

(integer) Size of the timespan multiplier.

timespan

(string) Size of the time window. Options include: 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'.

from

(Date) From date ('YYYY-MM-DD').

to

(Date) To date ('YYYY-MM-DD').

Value

A tibble of financial data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(polygon)
get_aggregates(
ticker = "AAPL",
multiplier = 1,
timespan = "day",
from = Sys.Date() - 20,
to = Sys.Date() - 1
)

## End(Not run)

eokodie/polygon documentation built on June 18, 2021, 10:19 p.m.