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

Hello,

*This is my first post and I am new to Quantopian

I have been trying to find a way to add leverage to individual positions? Let's say, I want to invest 1% of a portfolio into a stock that requires 50% margin.

It seems to me that using order_target_percent(stock, 2) does not fully mimic what I am trying to do, especially when I want to invest in multiple stocks.

Google searches didn't help.

One way I thought of solving this problem is by calculating dollar value of 1% of the portfolio and multiplying this by 2, then order_value(stock, value). But this is an equivalent of investing 2%.

I would like to know what you guys think. Any ideas?

Thank you

4 responses

order_target_percent(stock, 2) would invest 200% of your portfolio into that position, if you want to invest 1% or similar do order_target_percent(stock, 0.01). I may not have understood your question though.

Hi Quant,
I'd like to invest 1% of my portfolio on margin. Normally I trade CFDs, which have leverage 1:10. The problem with order_target_percent(stock, 2) is that it invests 200% of my portfolio. Let's say I have 1000$ in my portfolio and I want to buy a stock trading at 10$, in this case I can buy 100 stocks. order_target_percent(stock, 2) will allocate 200% of my portfolio, giving me 200 stocks or 50% margin. The problem is that in reality I will buy 100 stocks with 50% margin. Is there a way to do it?

I'm not entirely sure that you can do margin trading on Quantopian, (we're operating on equities not CFD's) so I don't know if what you're asking is possible

Ok, but is it possible to backtest it? Also, IB provides margin on some stocks, so I'd say it should be possible.