Why I am doing this:
- Improve my business (learn about different business models) - Improve my product sense - Hearing good CEOs talking at their investors is a great lesson.
What I am building:
- Use Azure to automate stuff and set up notifications for events I am interested in.
- Use python to backtest strategies.
I wrote this thing last week https://medium.com/@davinci260/why-only-buy-when-you-can-als...
I have some questions regarding the article: How are you hedging? What instrument are you hedging with? Also, how much leverage are you taking on? If you're not selling out any original shares and shorting an equal amount of some other shares (see my first question), you're taking on 2x leverage. As such, you're not really comparing apples to apples.
Moreover, Puru Saxena is not really doing what your blog is describing. What he's doing (at least according to some Twitter posts I read), is holding a market neutral portfolio where the long side consists of specific stocks he likes and the short side an ETF to hedge the geography exposure. Because he's investing in high beta tech stocks, he can lower his beta and his geography exposure through shorting the appropriate ETF. This is a smart strategy, but is only going to work on high beta companies.
Anyways, in general, we do not want to look at returns when analyzing an investment strategy. Instead, we should look at the Sharpe ratio. While I don't have enough information to say whether your results are correct, honestly, they don't pass the smell test. I feel like the EMA window is overfit, your CAGR is being boosted by the use of 365 instead of 252, and I suspect that you are taking on leverage, which might be also boosting your returns.
Also looking at the code, it's needlessly complex because you're dealing with actual shares and such. A better method is to just deal with returns directly and represent your portfolio as a vector of weights, the sum of the absolute values should add up to zero with no leverage.
The type of hedging you describe in your example is equivalent to just selling the shares, but a little worse. You're paying interest on your shorts, so you're losing 2% annually from holding shares and shorting some other shares. There's literally no reason why you would want to hold both a long and short position on a stock.
I recommend you check out Quantopian (https://www.quantopian.com/). It makes your life so much easier and they have all the data, plus great risk models and alpha factor generation tools.
Also as a fellow software engineer interested in finance, you might like my financial blog, https://cryptm.org/.
> Also, how much leverage are you taking on? Equal to the value of the portfolio since this how much you need to have 1-1 hedge. The hedging instrument is just short selling the stock.
> Puru Saxena has a different portfolio.
I am inspired by the hedging mechanism that he uses and I started with the same technical triggers.
> The type of hedging you describe in your example is equivalent to just selling the shares, but a little worse.
I see what you are saying and I agree with it.
I am not sure if it is actually worse. Avoiding a tax event on your long position (which in the long run is the most profitable) is actually really important as you more capital to compound.
I know of Quantopian but I have never used and the calculation seemed simple enough to do with vanilla python/pandas. I did not think of using vector of weights, that would be a better approach and much more scalable.
360 would probably be a better number. https://www.investopedia.com/terms/c/commercial-year.asp for CAGR calculation. I did that for the interest but forgot about it in the CAGR.
365 makes sense talking interest. But so does 360. And then there's +1/+2. And more fancy stuff. It all depends on currency. So, 365 makes sense from a mentality of opportunity cost and accrual, given an ACT365 currency.
And I wouldn't go with 252 because of OTC.
I also would strongly advise against Sharpe ratios. From the title of the post - which I have my own problems with the post, but - "Why only buy when you can also sell?" really highlights why not to go with Sharpe, or Sortino, ratios: non-normal returns are the normal. Better with Omega, which is a concept already 20 years old but finance oddly sticks to the 80s.