How do I query assets details for a Ticker in Alpaca-Py

This should be simple but the documentation just seems to say that you can query a Ticker but it neglects to say how. I’m using the Python SDK for Alpaca-Py and I just need to check a few symbols to see if they are fractionable or not.

I also tried to access the Discord server but it will never verify me so I’m stuck in limbo on there as well. The lack of available assistance is disheartening especially since the forums seem to be a ghost-town.

@Austin Apologies for the delay. The assets method is documented in the alpaca-py documentation here. So, something like this will fetch all active stocks.

!pip install -q alpaca-py

import pandas as pd

from alpaca.trading.client import TradingClient
from alpaca.trading.requests import GetAssetsRequest
from alpaca.trading.enums import AssetExchange, AssetStatus, AssetClass

ALPACA_KEY = 'xxxxxxx'
ALPACA_SECRET = 'xxxxxxx'

# instantiate the trading client
trading_client = TradingClient(ALPACA_KEY, ALPACA_SECRET, raw_data=True, paper=True)

# get all active equity assets
equity_assets = trading_client.get_all_assets(GetAssetsRequest(
                                       status=AssetStatus.ACTIVE,
                                       asset_class=AssetClass.US_EQUITY ,
                                       ))

# convert the list of assets into a dataframe for easier manipulation
equities_df = pd.DataFrame([asset for asset in equity_assets])

I like using pandas dataframes which is why the last line converts the asset list into a dataframe. Note in order to easily do this, ensure the trading client is instantiated with raw_data=True.

Thanks for responding. I was able to use the provided code and save to csv file for any future lookups.