Calculation of the exchange amount / DONE
Last updated
Last updated
General designations:
inAmount - exchange amount is given, with rounding down to the decimal point of the currency specified for the currency is given outAmount - exchange amount is received, rounded down to the decimal point of the currency specified for the currency is received
Rounding example: Currency accuracy 2 sum of 1.234 = 1.23 6.789 = 6.78
rate - bid exchange rate (out / in)
exchange rate can be set manually or by any service, regardless of the source of exchange rates, the commission set in the admin panel is added to the rate. FeePercent - (Commission Percentage)
Also, when calculating the exchange rate, the personalised exchange discount for this client is also taken into account, if any.
The ratio of incoming and outgoing currency exchange rate is further referred to as in and out
Example 1 USD = 80 KZT so in = 1 , out = 80
Example of calculations by formula
Let's take 1 USD = 80 KZT commission 2%
in = 1 , out = 80, FeePercent = 2, discount = 0
outFeeAmount - Commission amount (to be specified in outAmount currency)
outAmount = (inAmount *
rate
) - outFeeAmount
\
inAmount
The amount of exchange we give away
outAmount
The amount of exchange we get
outFeeAmount
Amount of static commission
FeePercent
Percentage of commission
rate
Exchange rate (out/in)