Dear Everyone,

I would like to request help from more experienced people on actually what I believe should be a very common issue. I want to deploy my portfolio balancing model to QuantConnect, which takes log-returns during the past 256 hours of different assets as input and returns a vector of which the absolute value sums to 1.0 (This vector basically represents the long-short positions of the assets). I would like the portfolio to be re-balanced accordingly via Immediate Execution.

Since that I am very new to QuantConnect, I have investigated the framework algorithms for this purpose. As far as I understand, what I need is to basically modify a portfolio construction model in framework algorithms. However, since that I was also unable to use Python debugging functionalities that are provided by Visual Studio. I could not figure out how or where I can retrieve such numpy array or pandas dataframe consisting of hourly returns of assets, and then basically use them to compute the portfolio targets while relying the existing modules for the rest of the execution.

Consequently, I would be more than glad if an example source code or a portfolio construction template can be provided, which demonstrates how portfolio optimization (allocation) can be done for periodically rebalancing weights of a long-short portfolio by employing the historical log-returns. Thank you for your time and consideration. Have a nice weekend.

Sincerely,
Kamer

 

 

Author