UPDATE
For the tick_taker I modified the buy and sell lines from
o = api.submit_order(
symbol=symbol, qty='20', side='sell',
type='market', time_in_force='day',
limit_price=str(quote.bid)
)
to # Everything looks right, so we submit our sell at the bid
try:
o = api.submit_order(symbol=‘TSLA’,
qty=1, side=‘sell’, time_in_force=‘gtc’, type=‘limit’, market_price=str(quote.bid))
I also added this to the top and now it works. (THANK GOD)
api =tradeapi.REST(ALPACA_API_KEY, ALPACA_SECRET_KEY, base_url, api_version=“v2”)
def data_get(self, path, data=None):
base_url = get_data_url()
return self._request(
‘GET’, path, data, base_url=base_url, api_version=‘v2’
)
Now it connects, but there are not other issues + still no buys. Aside from what I mentioned, I have not made any changes to the source code. Does anyone have one that works?
Level change: 0 0 0 404.02 404.03 0.01
WARNING:root:code = 1006 (connection closed abnormally [internal]), no reason
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name=‘Task-14’ coro=<StreamConn._ensure_ws() done, defined at /usr/local/lib/python3.8/site-packages/alpaca_trade_api/polygon/streamconn.py:112> exception=ConnectionError(‘Max Retries Exceeded’)>
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/alpaca_trade_api/polygon/streamconn.py”, line 131, in _ensure_ws
raise ConnectionError(“Max Retries Exceeded”)
ConnectionError: Max Retries Exceeded