I'm running LEAN locally, in Docker containers. Data is in local storage. If my internet connection is down, ‘lean backtest <PROJECT>’ does not run. It just hangs. Why is an internet connection required when I do not include ‘--update’ flag? How do I disable LEAN and/or the container from attempting to connect to the internet?
Derek Melchin
Hi Alpha23,
We haven't been able to reproduce the issue. We think it may be caused by the weekly check for the latest docker image.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Alpha23
Has it been tested on a machine that is not connected to the internet? I'm now running a custom lean-cli container. I re-ran under the same conditions above, waited for ~1 minute, then interrupted the process. Below is the output. Please advise on how to disable any connection attempt. There should be no reason that lean-cli requires an internet connection when running locally using local data.
lean backtest testProject1
^CTraceback (most recent call last):
File "/home/user/lean-cli2/bin/lean", line 5, in <module>
from lean.main import main
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/main.py", line 95, in <module>
from lean.commands import lean
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/commands/__init__.py", line 17, in <module>
from lean.commands.backtest import backtest
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/commands/backtest.py", line 20, in <module>
from lean.click import LeanCommand, PathParameter
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/click.py", line 25, in <module>
from lean.container import container
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/container.py", line 17, in <module>
from lean.components.api.api_client import APIClient
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/components/api/api_client.py", line 23, in <module>
from lean.components.api.account_client import AccountClient
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/components/api/account_client.py", line 17, in <module>
from lean.models.api import QCAccount
File "/home/user/lean-cli2/lib/python3.8/site-packages/lean/models/__init__.py", line 27, in <module>
res = requests.get(url)
File "/home/user/lean-cli2/lib/python3.8/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/home/user/lean-cli2/lib/python3.8/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/user/lean-cli2/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/home/user/lean-cli2/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/home/user/lean-cli2/lib/python3.8/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/home/user/lean-cli2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/home/user/lean-cli2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/home/user/lean-cli2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/home/user/lean-cli2/lib/python3.8/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "/home/user/lean-cli2/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/home/user/lean-cli2/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
KeyboardInterrupt
Alexandre Catarino
Hi alpha23 ,
Thank you for the report and stack-trace.
We haven't been able to reproduce the issue. My machine was not connected to the internet.
Lean-CLI fetches the latest list of available modules on initialization. If the request.get fails, it normally continues the execution if our machine has downloaded the file before. It looks like the request.get method is not failing immediately in your case. This method doesn't time out by default.
We have created a GitHub to set a timeout:
Offline Backtest Hangs on Initialization #165
Please subscribe for updates.
Best regards,
Alex
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
Alexandre Catarino
Hi alpha23 ,
The Engineering Team has fixed the issue. It's available on lean, version 1.0.110. Please upgrade it
Best regards,
Alex
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
Alpha23
Thank you.
Alpha23
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!