Momentum-Trading-Example

When I run the momentum trading example from: code in github: https://github.com/alpacahq/Momentum-Trading-Example/blob/master/algo.py#L118 i get “336: RuntimeWarning: coroutine ‘StreamConn.close’ was never awaited” error.

I am using Python 3.7.5 version. What could be the reason. I get the above mentioned error and the kernel dies. Please help.

How do i enable trace memory allocation or is it something else that is wrong?

Same issue with python 3.6 and 3.8

Is the issuee seen when you stop the program? The error is general and it sounds more like a co-routine was created but never used. Meaning, something like await conn.close() is necessary but missing somewhere

I wonder if you are running the code in ipykernel or jupyter or something? When I ran the code with debugging enabled I got the error code:

alpaca/lib/python3.7/site-packages/ipykernel_launcher.py:7: RuntimeWarning: coroutine ‘StreamConn.close’ was never awaited
import sys
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

I looked at stream2.py and there is a “await self.close()”.

But when I do a “nbconvert {filename.ipynb --to python” Then run the .py file outside jupyter it seems to work.
Please try it and holler back! :slight_smile: