How can I get all the trades for a stock for 1 day? Using the code below I can get 10 trades, but I would like all the trades for a specific day.
If I remove the ‘limit=10’, I get the following error message, “sleep 3 seconds and retrying https://data.alpaca.markets/v2/stocks/AAPL/trades 3 more time(s)…”
Additionally, I would like to get the trade history into a csv file but I am getting an error message for that as well, “AttributeError: ‘TradesV2’ object has no attribute ‘to_csv’”
I just funded an account and Alpaca said I have one month of free data. I am also teaching myself python starting this year.
’
from alpaca_trade_api.rest import REST
import config
api = REST(config.API_KEY, config.SECRET_KEY, base_url=config.BASE_URL)
df = api.get_trades(“AAPL”, “2021-12-13”, “2021-12-13”, limit=10)
print(df)
#df.to_csv(‘AAPL_Trades.csv’)
’