I am just getting started with Alpaca in python but I am running into a problem of not being able to select certain data points. I get an error of ‘TypeError: ‘Trade’ object is not subscriptable’. Which I know means that it is not a list, directory or any subscriptable version. Just wondering if there is a way to get a subscriptable version on a GET call? Thank you.
Here is my code:
import alpaca_trade_api as tradeapi
api = tradeapi.REST(
'PKAD60KEDGEF4SKHYT3H',
'IwTos8pVQtg8aiwMB7JLyFYyVE17xfpgwfMjAfH9',
'https://paper-api.alpaca.markets'
)
def get_quote(ticker):
quote = api.get_last_trade(ticker)
print(quote['price'])
get_quote("AAPL")