def apy(apr):
return 2.718 ** (apr) - 1
if borrowAPY < apy(slope_1):
lendAPY = optimal/slpoe_1 * borrowAPY**2 * (1 - reserve)
else:
lendAPY = (1/slope_2 * (borrowAPY - slope_1) * (1 - optimal) + optimal) * borrowAPY * (1 - reserve)
optimal = 0.8
slope_1 = 0.04
slope_2 = 0.75
reserve = 0.1
optimal = 0.9
slope_1 = 0.04
slope_2 = 0.6
reserve = 0.1
optimal = 0.9
slope_1 = 0.04
slope_2 = 0.6
reserve = 0.1