Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Long-Short code throws an error #578

Open
1 task done
Dylan-86 opened this issue Feb 24, 2022 · 1 comment
Open
1 task done

[Bug]: Long-Short code throws an error #578

Dylan-86 opened this issue Feb 24, 2022 · 1 comment
Labels
question Further information is requested

Comments

@Dylan-86
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When launching the long-short bot, this error is thrown:

RemoteDisconnected                        Traceback (most recent call last)
File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:699, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    698 # Make the request on the httplib connection object.
--> 699 httplib_response = self._make_request(
    700     conn,
    701     method,
    702     url,
    703     timeout=timeout_obj,
    704     body=body,
    705     headers=headers,
    706     chunked=chunked,
    707 )
    709 # If we're going to release the connection in ``finally:``, then
    710 # the response doesn't need to know about the connection. Otherwise
    711 # it will also try to release it and we'll have a double-release
    712 # mess.

File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:445, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    441         except BaseException as e:
    442             # Remove the TypeError from the exception chain in
    443             # Python 3 (including for exceptions like SystemExit).
    444             # Otherwise it looks like a bug in the code.
--> 445             six.raise_from(e, None)
    446 except (SocketTimeout, BaseSSLError, SocketError) as e:

File <string>:3, in raise_from(value, from_value)

File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:440, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    439 try:
--> 440     httplib_response = conn.getresponse()
    441 except BaseException as e:
    442     # Remove the TypeError from the exception chain in
    443     # Python 3 (including for exceptions like SystemExit).
    444     # Otherwise it looks like a bug in the code.

File /usr/lib/python3.9/http/client.py:1371, in HTTPConnection.getresponse(self)
   1370 try:
-> 1371     response.begin()
   1372 except ConnectionError:

File /usr/lib/python3.9/http/client.py:319, in HTTPResponse.begin(self)
    318 while True:
--> 319     version, status, reason = self._read_status()
    320     if status != CONTINUE:

File /usr/lib/python3.9/http/client.py:288, in HTTPResponse._read_status(self)
    285 if not line:
    286     # Presumably, the server closed the connection before
    287     # sending a valid response.
--> 288     raise RemoteDisconnected("Remote end closed connection without"
    289                              " response")
    290 try:

RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

ProtocolError                             Traceback (most recent call last)
File /usr/lib/python3/dist-packages/requests/adapters.py:439, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
    438 if not chunked:
--> 439     resp = conn.urlopen(
    440         method=request.method,
    441         url=url,
    442         body=request.body,
    443         headers=request.headers,
    444         redirect=False,
    445         assert_same_host=False,
    446         preload_content=False,
    447         decode_content=False,
    448         retries=self.max_retries,
    449         timeout=timeout
    450     )
    452 # Send the request.
    453 else:

File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:755, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    753     e = ProtocolError("Connection aborted.", e)
--> 755 retries = retries.increment(
    756     method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    757 )
    758 retries.sleep()

File /usr/lib/python3/dist-packages/urllib3/util/retry.py:532, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
    531 if read is False or not self._is_method_retryable(method):
--> 532     raise six.reraise(type(error), error, _stacktrace)
    533 elif read is not None:

File ~/.local/lib/python3.9/site-packages/six.py:718, in reraise(tp, value, tb)
    717 if value.__traceback__ is not tb:
--> 718     raise value.with_traceback(tb)
    719 raise value

File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:699, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    698 # Make the request on the httplib connection object.
--> 699 httplib_response = self._make_request(
    700     conn,
    701     method,
    702     url,
    703     timeout=timeout_obj,
    704     body=body,
    705     headers=headers,
    706     chunked=chunked,
    707 )
    709 # If we're going to release the connection in ``finally:``, then
    710 # the response doesn't need to know about the connection. Otherwise
    711 # it will also try to release it and we'll have a double-release
    712 # mess.

File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:445, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    441         except BaseException as e:
    442             # Remove the TypeError from the exception chain in
    443             # Python 3 (including for exceptions like SystemExit).
    444             # Otherwise it looks like a bug in the code.
--> 445             six.raise_from(e, None)
    446 except (SocketTimeout, BaseSSLError, SocketError) as e:

File <string>:3, in raise_from(value, from_value)

File /usr/lib/python3/dist-packages/urllib3/connectionpool.py:440, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    439 try:
--> 440     httplib_response = conn.getresponse()
    441 except BaseException as e:
    442     # Remove the TypeError from the exception chain in
    443     # Python 3 (including for exceptions like SystemExit).
    444     # Otherwise it looks like a bug in the code.

File /usr/lib/python3.9/http/client.py:1371, in HTTPConnection.getresponse(self)
   1370 try:
-> 1371     response.begin()
   1372 except ConnectionError:

File /usr/lib/python3.9/http/client.py:319, in HTTPResponse.begin(self)
    318 while True:
--> 319     version, status, reason = self._read_status()
    320     if status != CONTINUE:

File /usr/lib/python3.9/http/client.py:288, in HTTPResponse._read_status(self)
    285 if not line:
    286     # Presumably, the server closed the connection before
    287     # sending a valid response.
--> 288     raise RemoteDisconnected("Remote end closed connection without"
    289                              " response")
    290 try:

ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
Input In [3], in <module>
      1 # Run the LongShort class
      2 ls = LongShort()
----> 3 ls.run()

Input In [3], in run(self)

File ~/.local/lib/python3.9/site-packages/alpaca_trade_api/rest.py:960, in REST.get_clock(self)
    959 def get_clock(self) -> Clock:
--> 960     resp = self.get('/clock')
    961     return self.response_wrapper(resp, Clock)

File ~/.local/lib/python3.9/site-packages/alpaca_trade_api/rest.py:239, in REST.get(self, path, data)
    238 def get(self, path, data=None):
--> 239     return self._request('GET', path, data)

File ~/.local/lib/python3.9/site-packages/alpaca_trade_api/rest.py:202, in REST._request(self, method, path, data, base_url, api_version)
    200 while retry >= 0:
    201     try:
--> 202         return self._one_request(method, url, opts, retry)
    203     except RetryException:
    204         retry_wait = self._retry_wait

File ~/.local/lib/python3.9/site-packages/alpaca_trade_api/rest.py:221, in REST._one_request(self, method, url, opts, retry)
    214 """
    215 Perform one request, possibly raising RetryException in the case
    216 the response is 429. Otherwise, if error text contain "code" string,
    217 then it decodes to json object and returns APIError.
    218 Returns the body json in the 200 status.
    219 """
    220 retry_codes = self._retry_codes
--> 221 resp = self._session.request(method, url, **opts)
    222 try:
    223     resp.raise_for_status()

File /usr/lib/python3/dist-packages/requests/sessions.py:542, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    537 send_kwargs = {
    538     'timeout': timeout,
    539     'allow_redirects': allow_redirects,
    540 }
    541 send_kwargs.update(settings)
--> 542 resp = self.send(prep, **send_kwargs)
    544 return resp

File /usr/lib/python3/dist-packages/requests/sessions.py:655, in Session.send(self, request, **kwargs)
    652 start = preferred_clock()
    654 # Send the request
--> 655 r = adapter.send(request, **kwargs)
    657 # Total elapsed time of the request (approximately)
    658 elapsed = preferred_clock() - start

File /usr/lib/python3/dist-packages/requests/adapters.py:498, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
    495             raise
    497 except (ProtocolError, socket.error) as err:
--> 498     raise ConnectionError(err, request=request)
    500 except MaxRetryError as e:
    501     if isinstance(e.reason, ConnectTimeoutError):
    502         # TODO: Remove this in 3.0.0: see #2811

ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

@drew887
Copy link
Contributor

drew887 commented Apr 29, 2022

Remote end closed connection without response
Hmm looks like this might've been an api issue at the time.

Is this issue still happening or am I good to close out this issue?

@drew887 drew887 added the question Further information is requested label Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants