# Historical Trades for stock

**URL:** <https://forum.alpaca.markets/t/historical-trades-for-stock/7732>\
**Category:** Getting Started with Alpaca\
**Created:** [December 15, 2021, 4:55pm UTC](https://forum.alpaca.markets/t/historical-trades-for-stock/7732 "2021-12-15T16:55:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![turbo1618](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@turbo1618](https://forum.alpaca.markets/u/turbo1618)\
**Post date:** [December 15, 2021, 4:55pm UTC](https://forum.alpaca.markets/t/historical-trades-for-stock/7732/1 "2021-12-15T16:55:59Z")

</div>

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](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’)  
’
