Intro
Superior algo returns can be thought of as being the result of two components: a great strategy regarding ‘what stocks to buy’ (the stock selection component, SEL) and a ‘clever timing’ (the in & out component, I/O) regarding when we are ‘in’ the market and hold the stocks versus when we are ‘out’ of the market and hold alternative assets such as bonds. We often focus on optimizing SEL and tend to neglect I/O; thus, for an important discussion of recent I/O tactics, see here.
Focus of this thread: Optimal SEL + I/O combinations
It is worthwhile to separately optimize SEL and I/O. However, the ultimate total return will also be determined by a certain synergy or dissonance between the two components. So, it seems that we won’t get around the arduous task of individually testing (all possible) combinations to identify optimal SEL + I/O pairs, which is the eventual focus of this thread. I reckon a preparatory step can be to dig up all the hidden SEL and I/O treasures from this forum and beyond to see what inputs are available for the combinations.
Ultimate objective
Let's get rich together, why not?
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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.
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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.
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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.
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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.
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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.
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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.
Yuri Lopukhov
I wish the framework would do these calculations for me, it shows really small exposure and drawdowns even for thousands of contracts ;)
Here is a backtest for 60 contracts of SPY options. Not sure how much margin this requires…
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.
Thomas
Very nice code Yuri. Thank you so much for sharing .
A few points
60 contracts mean initial margin of ~50k USD on IBKR. You account size should be at min 60k USD.
Delta 0.01 means that there is 1% chance of assignment when u open your position (if you got assigned at SPY put strike 400, $2.4millon cash will be deducted from your account for 6,000 shares of SPY).
I would argue that 7% annual return is not worth the risk
2. Delta =0.01 is very illiquid. We may not get the trade fill and if it's filled it's not easy to get out. So need paper trade to understand if liquidity is an issue. In my experience it's super hard to fill 60 contracts for delta 0.01 or even 0.02 or 0.03
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.
Thomas
In my opinion , we need to decide when to run the algo. Some days when J.P speaks or CPI data are being released for examples are super volatile. Traders can take market in either up or down direction. We should avoid those days or weeks with those days. I did some analysis for the last 1 year- Days with big drawdown for the strategy are when fed releases the meeting minutes, CPI , jobless claims , JP speaks or days after CPI were release.
Traders need to make some judgement to run or not to run the strategy. For example this week we have FOMC minutes tomorrow, Initial jobless claims on thu. I think we need to avoid running the algo this week
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!