Hi there.

How to ensure that my code doesn't use margin at all ?

In Initialization I use

 self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage)
 self.securities["symbol".SetLeverage(1)
 self.x =(self.Portfolio.TotalPortfolioValue/10 )

self.x : is just a variable represent 1/10 of my all portfolio's cash value 

in on data method I use 

  current_cash = self.Portfolio.CashBook[self.AccountCurrency].Amount
  self.Portfolio.CashBook.Add(self.AccountCurrency, current_cash + 1, 1)

to add my profits to my portfolio's cash value 

 

I'm not sure is this enough to ensure that  my code doesn't use margin and use only Cash