Hello everyone. I wanted to post a backtest, and see if anyone can give me any feedback. Its within the contest constraints, but I'd like to try and get it higher returns. If you have any feedback I would love to hear your thoughts.
Hello everyone. I wanted to post a backtest, and see if anyone can give me any feedback. Its within the contest constraints, but I'd like to try and get it higher returns. If you have any feedback I would love to hear your thoughts.
Hi Dane,
Looks pretty good to me. Have you tried a longer backtest to see if your strategy holds up reasonably well during longer periods? The contest requires at least a 2 year backtest to qualify.
Also, personally I would look to decrease position concentration a bit (hold more positions) to again see if your model holds up well. I would also try to understand why the daily mean turnover (>21%) is relatively high (in my opinion anyway).
Joakim,
Thanks for the input! I’ll tweak the constraints a bit to see if I can get it to hold up. That backtest was at $100M, so I’m curious if my constraint of 300 total positions is far too small. I have it split evenly 50/50 shorts and longs as I am using the long short equity template as my base.
How would you suggest tweaking the constraints to test this better? I believe I have my position concentration set to be equal bounded via the max position size for both shorts and longs. I should note that I’m using the risk loading pipeline and the Q Risk Framework to manage constraints and dynamically selecting all stocks in the pipeline, so any guidance from there to manage this a bit better would be super helpful!
Also, I can only run up to 2017 as of right now. I submitted it to the contest to let it run out of sample and see how it holds up to the competition, but I am constrained to the free datasets so I’m only expecting so much IC mean on my Alpha factors.
That backtest was at $100M, so I’m curious if my constraint of 300
total positions is far too small. I have it split evenly 50/50 shorts
and longs as I am using the long short equity template as my base.
As far as I see it, this is an issue with the (otherwise excellent) Long/Short template. If you specify 300 positions, it will actually only hold half of that (i.e. 150 total or about 75 each side, as your tearsheet shows). I've highlighted this to Q previously but didn't get a response, and as you've shown it still appears to be the case.
So, if you want your strategy to hold 300 positions, you have to either specify 600 positions, or change the below from 2.0 to 1.0 / TOTAL_POSITIONS
# Constraint Parameters
MAX_GROSS_LEVERAGE = 1.0
TOTAL_POSITIONS = 600
# Here we define the maximum position size that can be held for any
# given stock. If you have a different idea of what these maximum
# sizes should be, feel free to change them. Keep in mind that the
# optimizer needs some leeway in order to operate. Namely, if your
# maximum is too small, the optimizer may be overly-constrained.
MAX_SHORT_POSITION_SIZE = 2.0 / TOTAL_POSITIONS
MAX_LONG_POSITION_SIZE = 2.0 / TOTAL_POSITIONS
Just to prove this point, I'll attach the Long/Short template, without having made any changes, along with the Pyfolio tearsheet showing that it's only holding half of the intended positions.
Regarding the backtest length, why not start the backtest earlier, say from 2015 or earlier? Perhaps 'train' your strategy from Jan 1 2015 - Jan 1 2017, and then when you're done with it, test it OOS starting earlier and ending latest (e.g. today's date a year ago)?
The rest sounds fine to me. :)
And here's the Pyfolio tear-sheet of above algo. As you can see, it's only holding about 300 positions (about 150 each side), and not the 600 (300 each side) as was specified in the code...
Joakim,
Thats helpful, i've adjusted it a little to use more positions, but i'm not necessarily getting higher returns, the 50 alpha factors im combining are working out of sample. I am going to keep trying higher numbers, but once my 2 year runs i'll post up the backtest and see what comes up. I ran one last night but for some reason it violated 2 of the risk constraints. The size style, and the volatility. The size barely jumped past 40% , and the volatility went a percent past -20%... I am going to rerun using the
opt.Newest
for the risk loading pipeline to see if that helps, but it appears that i need to constrain it a bit more after some reading. I don't exactly know how to constrain the volatility, and size style constraints specifically without using the risk loading pipleline. You wouldn't happen to know any better ways to constrain these would you?
Hi Dane, you may adjust the risk limits to constrain your factors:
opt.experimental.RiskModelExposure(
risk_model_loadings = context.risk_loading_pipeline,
version = opt.Newest,
max_size = mySizeLimit, # Say 0.35
min_size = -mySizeLimit,
max_volatility = myVolatilityLimit, # Say 0.15
min_volatility = -myVolatilityLimit,
)
There are also discussion threads and post by Abhijeet Kalyan on the subject for more information.