Explore Knowledge Base

Commission for currency exchange

23. 03. 2023

Commission for currency exchange

The commission for currency exchange operation will be added for sell or deducted for buy from the system exchange rate.

Sell and buy are from the system point-of-view:

  • sell – system sells currency to a customer, so the commission will be added to the system exchange rate
  • buy – system buys currency from a customer, so the commission will be deducted from the system exchange rate

Currency scale calculation for currency exchange

Sell

  1. System scales amount to sell according to the “from account currency”
  2. System compares the “from account” balance and the “amount to sell”
  3. System calculates:
  • topup amount -> “to account currency” scale
  • withdraw amount -> “from account currency” scale
{
 "topUpAmount" : 0.9180990000,
 "withdrawAmount" : 60000.0000,
 "exchangeRate" : {
   "inCurrency" : {
     "id" : "4a72ea60-f994-44bd-9d2b-64ec15e14d1d",
     "sn" : "USD",
     "code" : "USD",
     "symbol" : "$"
   },
   "outCurrency" : {
     "id" : "4a4917e4-7134-470f-9f89-9d1e26217acd",
     "sn" : "BTC",
     "code" : "BTC",
     "symbol" : "₿"
   },
   "rate" : 0.00001530165000000000,
   "organisationId" : "64fdc325-11de-42ef-b490-5c4f31303711"
 }
}

Buy

  1. System scales “amount to buy” to the “to account currency”
  2. System compares the withdrawAmount (with “from account currency” scale, “buy amount” * “rate”) with the “from account” balance
  3. System calculates:
  • topup amount -> to account currency scale
  • withdraw amount -> from account currency scale
{
 "topUpAmount" : 1.0000000000,
 "withdrawAmount" : 65352.4293,
 "exchangeRate" : {
   "inCurrency" : {
     "id" : "4a72ea60-f994-44bd-9d2b-64ec15e14d1d",
     "sn" : "USD",
     "code" : "USD",
     "symbol" : "$"
   },
   "outCurrency" : {
     "id" : "4a4917e4-7134-470f-9f89-9d1e26217acd",
     "sn" : "BTC",
     "code" : "BTC",
     "symbol" : "₿"
   },
   "rate" : 0.00001530165000000000,
   "organisationId" : "64fdc325-11de-42ef-b490-5c4f31303711"
 }
}

APIs related to Currency Exchange