Listing Alpaca Assets

How to list assets available to trade via the Alpaca API using the {alpacar} R package.

First load the {alpacar} library. Then authenticate and you’re ready to delve into the list of available assets.

library(alpacar)

Listing All Assets

The assets_list() function will return the definitive list of assets accessible via the Alpaca API.

assets <- assets_list()

The result is a rather broad data frame with the following fields:

names(assets)
 [1] "asset_id"                       "class"                         
 [3] "exchange"                       "symbol"                        
 [5] "name"                           "status"                        
 [7] "tradable"                       "marginable"                    
 [9] "maintenance_margin_requirement" "margin_requirement_long"       
[11] "margin_requirement_short"       "shortable"                     
[13] "easy_to_borrow"                 "fractionable"                  
[15] "attributes"                     "min_order_size"                
[17] "min_trade_increment"            "price_increment"

Here are selected fields from the first few records:

assets %>% select(asset_id, class, exchange, symbol)
   asset_id                             class     exchange symbol
   <chr>                                <chr>     <chr>    <chr> 
 1 d5f52df3-3f8b-4e39-8ee2-deb2c8f73b34 us_equity OTC      BIGGQ 
 2 b9a9cf08-9a96-4396-b786-0d3215d43e79 us_equity OTC      TGIDW 
 3 ca6a28eb-c7c1-4e56-bb00-d5c28c9c8213 us_equity OTC      IXQWF 
 4 8ef22730-065c-4871-96ad-d04be8d9fafd us_equity OTC      OGZPY 
 5 b64671e3-d25c-47a9-bc11-60906bddf711 us_equity OTC      ELYS  
 6 5ee5e20d-81f3-4af4-8710-66fb844b181c us_equity OTC      GMBLZ 
 7 c8a40c2b-8587-44d3-800b-72e04a7dde10 us_equity OTC      GMBLW 
 8 97d6219f-4756-4448-9319-0fc3e9868615 us_equity OTC      ELOX  
 9 b4c6bf10-da8a-4814-86dc-d83b11bb24a7 us_equity NASDAQ   TGL   
10 29f2771b-fe5d-4087-9dac-f4bf46c7077a us_equity OTC      CFRXQ 

The assets categorised into two classes ("us_equity" and "crypto") and are traded at a selection of exchanges ("OTC", "NASDAQ", "NYSE", "BATS", "ARCA", "AMEX" and "CRYPTO").

Filtering by Attribute

You can use the attributes argument to filter on a selection of attributes:

  • "fractional_eh_enabled" (supports fractionable trading)
  • "has_options"
  • "options_late_close"
  • "ptp_no_exception" and
  • "ptp_with_exception".

For example, here are the first few assets that support options:

assets_list(attributes = "has_options") %>%
  select(symbol, exchange, attributes)
   symbol exchange attributes                        
   <chr>  <chr>    <chr>                             
 1 BIGGQ  OTC      fractional_eh_enabled, has_options
 2 ELYS   OTC      has_options                       
 3 DXYN   OTC      has_options                       
 4 PYRGF  OTC      has_options                       
 5 EGRX   OTC      fractional_eh_enabled, has_options
 6 EVVAQ  OTC      has_options                       
 7 SPWRQ  OTC      has_options                       
 8 MDRX   OTC      fractional_eh_enabled, has_options
 9 AAUAF  OTC      has_options                       
10 BCEL   OTC      has_options 

Asset by ID or Symbol

You can also retrieve individual assets. Either by symbol name or asset ID.

AAPL <- assets_list("AAPL")
AMD <- assets_list("03fb07bb-5db1-4077-8dea-5d711b272625")

The results are data frames with the same columns as before.

bind_rows(AAPL, AMD) %>% select(class, exchange, symbol, name)
  class     exchange symbol name                                     
  <chr>     <chr>    <chr>  <chr>                                    
1 us_equity NASDAQ   AAPL   Apple Inc. Common Stock                  
2 us_equity NASDAQ   AMD    Advanced Micro Devices, Inc. Common Stock