I am currently creating an algorithm that is only in one asset at a time so I am currently manually checking if I'm invested in an asset, if so: liquidate and buy the new one, etc.

In my custom Portfolio Construction Model, I am handling this by only sending 1 PortfolioTarget.Percent object if I am currently invested in nothing and if currently invested in something, sending 2 PortfolioTarget.Percent objects: 1 with a 0% weighting (current asset in which I want to liquidate/get out of) and 1 with a 100% weighting (asset in which I want to switch into)

When handling this in my custom Execution Model class, I understand that self.SetHoldings() can automatically calculate the number of asset units that I would need to buy and it even has a funtion built in to liquidate other assets before starting (such as the example below).


# Allocate 50% of portfolio value to IBM, but liquidate other holdings before starting
self.SetHoldings("IBM", 0.5, True)

My question is: if I was to stop manually handling my orders and only use SetHoldings(), what would happen if SetHoldings is called with an asset in which I already own? Will it liquidate and re-buy the asset? Or would SetHoldings() ignore that call? Because liquidating and re-buying would harm me through fees and could harm me through other ways in which my algorithm can be scored.

Thank you in advance,