I feel somewhat sorry for asking as I'm a true novice at this and yet I'm attempting something difficult here.

I am trying to build an algo that does the following:
- Determine the current price of 2 equities (SPXL en SPXS)
- Use these prices to determine the needed amount of options of both to buy for the portfolio (in a 2:1 ratio)
- Buy Put options on both and sell calls on both

This should end up with a portfolio with a 67% synthetic short in SPXS and 33% in SPXL.

It should rebalance the options whenever the total weigth in the synthetic short positions surpasses 10% from the weight (so <23 or >43% in position 1). 

I keep getting errors with my code. I'm trying to use the code from the tutorial on getting equity prices (in order to determine # of contracts), but this uses the onData (self data) instead of the onData (self slice) used by the sample option algorithms. 

Could you please help me? 

Much appreciated!


However, I keep hitting roadblocks.