# Historic\_agg\_v2() missing 2 required positional arguments: '\_from' and 'to'

**URL:** <https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014>\
**Category:** Alpaca Integration Applications\
**Created:** [March 23, 2020, 1:11am UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014 "2020-03-23T01:11:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhupendra\_subedi](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@bhupendra\_subedi](https://forum.alpaca.markets/u/bhupendra_subedi)\
**Post date:** [March 23, 2020, 1:11am UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/1 "2020-03-23T01:11:39Z")

</div>

I would like to not include \_from and to and just use limit = 6 as argument but removing \_from and to from argument geives me erros.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/alp/original/1X/daa40006905760dcff3618ff369705e422a3cb2d.png)

However looking at the documentation i should be just able to avoid \_from and to without any consequences and just get last 6 datapoints without the hassle of defining \_from and to .

 ![image](https://us1.discourse-cdn.com/flex020/uploads/alp/original/1X/329b4550013b9682cfdd5abfc3ed88100ae72978.png)

Please help what I am doing wrong. Looks like from documentation i should not have to put \_from and to argument. .

---

<div class="post-metadata">

**Author:** ![bhupendra\_subedi](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@bhupendra\_subedi](https://forum.alpaca.markets/u/bhupendra_subedi)\
**Post date:** [March 23, 2020, 5:09pm UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/2 "2020-03-23T17:09:41Z")

</div>

Has anybody seen this issue or know how to fix this?

---

<div class="post-metadata">

**Author:** ![hitoshi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/hitoshi/32/69_2.png) [@hitoshi](https://forum.alpaca.markets/u/hitoshi)\
**Post date:** [March 23, 2020, 7:24pm UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/3 "2020-03-23T19:24:47Z")

</div>

The documentation probably needs to be fixed, as this parameter is mandatory.

---

<div class="post-metadata">

**Author:** ![bhupendra\_subedi](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@bhupendra\_subedi](https://forum.alpaca.markets/u/bhupendra_subedi)\
**Post date:** [March 24, 2020, 3:26pm UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/4 "2020-03-24T15:26:33Z")

</div>

Thanks for confirmation @hitoshi. I was able to do this with historic\_agg(  
without having to put in \_from and to but recently it stopped working so i was looking to make it work with historic\_agg\_v2. Which seems to have more computing cost and pain.

---

<div class="post-metadata">

**Author:** ![bhupendra\_subedi](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@bhupendra\_subedi](https://forum.alpaca.markets/u/bhupendra_subedi)\
**Post date:** [March 25, 2020, 2:36am UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/5 "2020-03-25T02:36:05Z")

</div>

Hi @hitoshi ,  
I was able to get the v2 working as the older historic\_agg() seems to be deprecated. But it is giving me the first 6 data instead of last 6. How do i get the last 6 data with limit=6? can you please help?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/alp/original/1X/a9a88a845e2b1db8fe081925822995939e6b4e4d.png)

---

<div class="post-metadata">

**Author:** ![bhupendra\_subedi](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@bhupendra\_subedi](https://forum.alpaca.markets/u/bhupendra_subedi)\
**Post date:** [March 26, 2020, 1:37am UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/6 "2020-03-26T01:37:31Z")

</div>

Can anybody help me please, I am almost there just need a little bit of help here.

---

<div class="post-metadata">

**Author:** ![bhupendra\_subedi](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@bhupendra\_subedi](https://forum.alpaca.markets/u/bhupendra_subedi)\
**Post date:** [March 31, 2020, 11:33pm UTC](https://forum.alpaca.markets/t/historic-agg-v2-missing-2-required-positional-arguments-from-and-to/1014/7 "2020-03-31T23:33:06Z")

</div>

All I figured out using df.tail() although i was looking to implement it within the historic\_agg\_v2(limit=n). Seems kind of inefficient. Thank you though.
