# Historical data using async

**URL:** <https://forum.alpaca.markets/t/historical-data-using-async/9004>\
**Category:** App-Integration\
**Created:** [March 31, 2022, 5:34am UTC](https://forum.alpaca.markets/t/historical-data-using-async/9004 "2022-03-31T05:34:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sakul](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/sakul/32/3991_2.png) [@sakul](https://forum.alpaca.markets/u/sakul)\
**Post date:** [March 31, 2022, 5:34am UTC](https://forum.alpaca.markets/t/historical-data-using-async/9004/1 "2022-03-31T05:34:08Z")

</div>

Hi, i am trying to fetching 5 years 1 minute data using python rest\_async method but it only return 10000 bar limit and no page\_token to continue from that 10000. Is there a way to fetch all 5 years 1 min data with asyncio ?

---

<div class="post-metadata">

**Author:** ![Gravitas](https://avatars.discourse-cdn.com/v4/letter/g/51bf81/32.png) [@Gravitas](https://forum.alpaca.markets/u/Gravitas)\
**Post date:** [April 9, 2022, 2:13pm UTC](https://forum.alpaca.markets/t/historical-data-using-async/9004/2 "2022-04-09T14:13:07Z")

</div>

For problems like this, you need to split the download into small enough chunks so that each chunk downloads in a few seconds. The algorithm is as follows:

- Iterate through days.
- Iterate through blocks of symbols.
- For each day and symbol block, download data, add to a list.
- Finally, write everything to some database or file (e.g. Arrow/Parquet).
- Can parallelize for speed.
- And to add production-quality reliability, handle any exceptions with some intelligent retry logic.

I’ve already written all of the Python code for a number of data providers (FinnHub, IQfeed, Alpaca, etc.). I have a Docker container that auto-downloads the required data on a schedule and puts into a clean form ready for machine learning and my live trading infrastructure.
