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 AddReference
AddReference("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 Date
self.SetEndDate(2015, 12, 1) #Set End Date
self.SetCash(5000) #Set Strategy Cash
self.AddForex("EURUSD", Resolution.Minute, Market.Oanda)
self.SetBrokerageModel(BrokerageName.OandaBrokerage);

def OnData(self,data):
portfolioValue = self.Portfolio.TotalHoldingsValue
orderSize = #?
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?