Back

Semi-Constant Rebalanced Portfolio (SCRP)

It would be great to have SCRP as an option in Algorithm Framework with given constant weights (instead of equal weighting) and divergence threshold (ratio). In this case, the rebalancing would simply be done in real-time to given weights (using the specified execution) whenever the absolute sum of current portfolio weights diverges from the absolute sum of given portfolio weights (at initialization) more than the pre-defined treshold e.g. 10%. If there is already an existing way of doing this, I would be glad for your help.

 

 

Update Backtest







0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


I have successfully implemented most of this but still have a feature request. It would be great if we coul specify the order execution e.g. VWAP to the SetHoldings function rather than Immediate market order execution by default.

0

Thanks Kamer, we're considering a similar parameter to the Immediate Execution Model (minimumOrderSize) but a percentage of the portfolio is a better idea.

If a similar concept was implemented at the portfolio construction model level; how do you specify the weights of the assets?

It sounds like the "InsightWeightedPortfolioConstructionModel". We're reviewing all these models now to standardize the parameters and reduce the churn. Your input is appreciated.

0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks Jared!

I simply specify the weights of the assets just as an array, it is not that much different than assigning equal weights. A constant rebalanced portfolio basically tries to maintain those weights. My current implementation also includes a divergence treshold that prevents rebalancing if the portfolio is not diverged enough from the target weights defined.

Intelligently managing the order execution for SetHoldings function would make my life much easier. I have also done a basic implemenation of that previously by checking the standard deviation of the price on given time frame but I believe that we should just declare one of the execution models that are already present within your framework.

I think that the API documentation can be better or you can preferably have Autocompletition functionality in your IDE. I am having hard time sometimes finding out which functions or properties are supported by a class. Some Google searches results in such properties which are not supported anymore. New debugging functionality is very cool.

1

I am not also sure if SetHolding work correctly for multiple assets upon setLeverage. It would be great if we could multiply the size of all positions with a single command, without changing any other piece of the code.

In other words, I should still set the asset to the same portfolio ratio value but the size of the whole portfolio should grow or shrink with a single command. Can maybe automatically find such parameter with Kelly Criterion.

Does the platform in the future will have any functionality for parameter-optimization by the way? It would be great if I can select certain variables and then optimize them automatically. You can maybe integrate Ray Tune.

1

Hi Kamer,

I'm not sure if this is exactly what you are looking for but here is my own size-filtered execution model - it executes trades when the delta of the targets relative to the portfolio is over given percentage:

It can be used like any other execution model ie:

        self.SetExecution(SizeFilteredExecutionModel(0.1))

class SizeFilteredExecutionModel(ExecutionModel):

def __init__(self, minimum_change_delta):
self.targetsCollection = PortfolioTargetCollection()
self.minimum_change_delta = minimum_change_delta

def Execute(self, algo, targets):
self.targetsCollection.AddRange(targets)
if self.targetsCollection.Count > 0:

trades = []
delta = 0

for target in self.targetsCollection.OrderByMarginImpact(algo):
open_quantity = sum([x.Quantity - x.QuantityFilled for x in algo.Transactions.GetOpenOrderTickets(target.Symbol)])
existing = algo.Securities[target.Symbol].Holdings.Quantity + open_quantity
current_price = algo.Securities[target.Symbol].Price # last_price(algo, target.Symbol)
target_quantity = round(target.Quantity)
quantity = target_quantity - existing
if quantity != 0:
trades.append((target.Symbol, quantity))
delta += abs(quantity) * current_price / algo.Portfolio.TotalPortfolioValue

if delta > self.minimum_change_delta:
algo.Debug(f"*** {algo.Time} Change delta {delta} > {self.minimum_change_delta} -- REBALANCING")
for (eq, size) in trades:
algo.MarketOrder(eq, size)

self.targetsCollection.ClearFulfilled(algo)

 

2

Update Backtest





0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed