I cannot seem to find a normal way to rebalance without liquiding all positions and rebuying which is not ideal.

Any sugesstive code would be great

 

C# preferably but python will do too

Author