Hi,
First off, thank you for building the platform you have. It is very impressive. I have been searching for a solution like yours that offers live quant trading capabilities and historical data for equities, futures, and cryptocurrencies at a reasonable cost for an individual investor.
I have written a python-based algorithm that I would like to adapt for use within the platform but am concerned I may run into an optimization roadblock. My algorithm has a handful of parameters that can be combined into thousands of different configurations which I would like to backtest. I would really appreciate it if someone could confirm that I properly understand the platform’s capabilities and limitations.
If I want to run backtests on historical data for equities, futures, and cryptocurrencies, they can only be done so in the terminal, as opposed to on a local version of LEAN. Assuming I chose your prime plan, I will have access to 4 cores which I presume limits me to backtesting 4 parameter combinations in parallel. Is that the case or are there ways to structure my script so I can backtest many more parameter configurations in parallel within the terminal (in order to access the historical data)?
Regards,
Aaron
Adam W
The community, prime, and pro plans offer 1, 2, and 4 parallel backtests respectively.
What sort of parameters are these? If possible, I'd suggest you try to do the optimization in isolation either within a single backtest or in Research (Jupyter notebook). Alternatively, if you have the time to set up a local LEAN clone with maybe a small sample of the data you need that is representative of the whole - try this.
Jared Broad
Hi Aaron! We're about to launch new scalable versions of the plans where you can add compute nodes and eventually we'll allow enqueuing backtests to run them, and finally making a GUI for bulk analysis of backtests. It'll be a few months but it's on the road map. Starting Monday-Tuesday next week we'll have the scalable cloud up and running for the whole community.
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.
AARON FOX
Thank you both for your replies. To answer Adam's question, the parameters are as follows:
entry trigger: high of x previous candles
exit trigger: low of y previous candles
stop loss multiple: multiple of average true range
pyramid multiple: multiple of average true range; determines next entry trigger price for pyramid order
unit size: % of current capital at risk per order (determines order size)
max # of orders: limits # of pyramid orders per security
I was hoping there may a way to code the strategy to do the optimization within a single backtest. Can I access historical data within Research (Jupiter notebook)? From my understanding, that is not possible in a local LEAN clone. I don't have another source of intraday trade data for futures. Would you be able to point me in the right direction of some literature or examples on how to script an optimization in this manner?
Many thanks,
Aaron
Adam W
Historical data can be accessed by self.History or QuantBook.History (in Research). You can try doing a simple vectorized random search over the parameter space first, i.e.:
import random # Parameter space entryTriggers = [1,2,3,] exitTriggers = [1,2,3,] stopLossMultiple = [1,2,3,] iterations = 50 for iteration in range(iterations): # Randomly choose a set of parameters parameterChoice = [random.choice(param) for param in (entryTriggers, exitTriggers, stopLossMultiple)] # Compute returns, Sharpe, metrics, etc
where the "trading logic" can be coded up as some simple functions that track portfolio value. Once you have a set of reasonable candidate parameters, that will filter down the parameter space to something more managable. You can then do some full backtests with LEAN for fine-tuning.
Alternatively, if you can write down a mathematical expression for returns/portfolio value (or whatever metric) based on these parameters, you can try using some optimization packages such as scipy.optimize to also filter down the parameter space.
AARON FOX
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!