assets: Get Assets

View source: R/Assets.R

assetsR Documentation

Get Assets

Description

The assets API serves as the master list of assets available for trade and data consumption from Alpaca. Assets are sorted by asset class, exchange and symbol. Some assets are only available for data consumption via Polygon, and are not tradable with Alpaca. These assets will be marked with the flag tradable = FALSE. See Assets: GET for details.

Usage

assets(...)

Arguments

...

(character) asset symbols or IDs. If NULL (the default), a tibble of all assets is returned.

Details

This function is vectorized over all arguments.

Value

Asset (tibble) Asset Object or array of Asset objects with the following parameters:

  • id (character) Asset ID as a string.

  • class (character) us_equity as a string.

  • exchange (character) AMEX, ARCA, BATS, NYSE, NASDAQ or NYSEARCA as a string.

  • symbol (character) Stock symbol as a string.

  • name (character) Full company name

  • status (character) active or inactive as a string.

  • tradable (logical) Asset is tradable on Alpaca or not.

  • marginable (logical) Asset is marginable on Alpaca or not.

  • shortable (logical) Asset is shortable on Alpaca or not.

  • easy_to_borrow (logical) Asset is easy-to-borrow or not (filtering for easy_to_borrow = TRUE is the best way to check whether the name is currently available to short at Alpaca).

@details Errors will be caught and surfaced but the function will always return a (tibble) to prevent error breaks when retrieving a large vector of assets.

Examples

## Not run: 
# Get a tibble of all active assets: 
assets()
# Get a specific asset by symbol:
(AAPL <- assets("AAPL"))
# or by id:
(AAPL <- assets(AAPL$id))

## End(Not run)

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