In the July contest, we introduced a hedged requirement. To make the top of the leaderboard, you need to be hedged with longs and shorts (or entirely in cash) for every day of your contest backtest.
It is worth double checking your backtest to ensure you are hedged at the end of every day. Sometimes, an open order can leave your portfolio long or short only at the end of a day. These gaps in your algo's hedging can be hard to spot. I thought this code snippet might be useful to anyone trying to make sure they earn the hedging badge. Check out the attached backtest!