Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Min Leverage

Hello, I was wondering if you guys could help me figure this one out. My code runs well and I think I found a way to control max leverage well. However, whenever I get a high number of orders cancelled at the end of the day, my leverage drops below 0.7 and my script fails the contest test. Maybe I am way off in my approach and need to redesign my code, but maybe there is something else I am missing here.

Your input is welcome.

Thanks

6 responses

Currently live-trading. Tried some of the suggestions (from other posts) but when I can control my leverage, the returns drop considerably. I'd rather keep the returns up and beta under control, even if I am not leveraged (0.8 - 1.1) all the time.

If leverage is your only issue then try buying a cash equivalent ETF (eg MINT) with any extra cash just before the end of the day. Close any unfilled positions first. Sell it the next day before you make your trades.

Just a thought?

I think if he dumps money in the ETF, he'll have a concentration problem.

Paulo, are you using the QTradableStocksUS? And are you doing your portfolio rebalance more than a few minutes before close? I'm surprised you're having a lot of order cancellations. If you're using a liquid universe, and giving a few minutes to fill, that shouldn't cause leverage problems. If you are, I'd love to learn more and track it down.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

If it is a thinly traded stock it will take huge number of minute bars to fill the order. You will have to adjust order time accordingly.

Leo, I agree that thinly traded stocks could cause this problem. But if he's using the QTradableStocksUS those should already be excluded. That's the question I'm curious about.

@Dan, yeah trading liquid stocks (QTradableStocksUS) and ordering well ahead of market close.