INNER CODE UNIT · Python
get_lot
Mo-Khalifa96/Forex-Trading-Bot · OrderProcessing.py:6
def get_lot(balance):
'''
This function calculates the lot size for a given trade based on the current account balance.
'''
minimum, maximum = 1000, 2001
while True:
if int(balance) in np.arange(0, 501):
return round((250/20000), 2)
elif int(balance) in np.arange(500, 1001):
return round((np.mean([500, 1000]) / 20000), 2)
elif int(balance) in np.arange(minimum, maximum):
return round((np.mean([minimum, maximum]) / 20000), 2)
else:
minimum += 1000
maximum += 1000
continue