# Python API: Close asyncio loop

**URL:** <https://forum.alpaca.markets/t/python-api-close-asyncio-loop/3459>\
**Category:** Getting Started with Alpaca\
**Created:** [November 29, 2020, 1:40am UTC](https://forum.alpaca.markets/t/python-api-close-asyncio-loop/3459 "2020-11-29T01:40:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alanc](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@alanc](https://forum.alpaca.markets/u/alanc)\
**Post date:** [November 29, 2020, 1:40am UTC](https://forum.alpaca.markets/t/python-api-close-asyncio-loop/3459/1 "2020-11-29T01:40:20Z")

</div>

How can I close the loop created by tradeapi.stream2.StreamConn? When I call StreamConn.close(), it stops for a moment and then re-starts, looks like the run() function has a built-in restarting mechanism.

---

<div class="post-metadata">

**Author:** ![FrankZhao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/frankzhao/32/1922_2.png) [@FrankZhao](https://forum.alpaca.markets/u/FrankZhao)\
**Post date:** [January 27, 2021, 9:09pm UTC](https://forum.alpaca.markets/t/python-api-close-asyncio-loop/3459/2 "2021-01-27T21:09:51Z")

</div>

You have to pass renew=False to the close() function.
