I am currently trying to understand the calculation of Forex lot sizes based on portfolio value and leverage.

In the following, highly simplified example

from clr import AddReferenceAddReference("System")AddReference("QuantConnect.Algorithm")AddReference("QuantConnect.Indicators")AddReference("QuantConnect.Common")from System import *from QuantConnect import *from QuantConnect.Algorithm import *### <summary>### lot size calculation### </summary>>class LotSizeCalculation(QCAlgorithm):def Initialize(self):'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''self.SetStartDate(2015, 12, 1) #Set Start Dateself.SetEndDate(2015, 12, 1) #Set End Dateself.SetCash(5000) #Set Strategy Cashself.AddForex("EURUSD", Resolution.Minute, Market.Oanda)self.SetBrokerageModel(BrokerageName.OandaBrokerage);def OnData(self,data):portfolioValue = self.Portfolio.TotalHoldingsValueorderSize = #?self.MarketOrder("EURUSD",orderSize)

How would I calculate orderSize such that it is the maximum possible value based on the portfolio value and maximum leverage?