Rate insurance

Instructions for setting up rate insurance

Use of rate insurance

The insurance rate, when properly configured, can be useful in the following cases:

  • When the service that provides exchange rates to the parser is temporarily paused. For example, if the exchange or any other service undergoes technical maintenance and the rates may not update.

  • When using a competition parser. For instance, to specify the maximum exchange rate you are willing to offer to the client, and what action will be taken with the direction if the final exchange rate exceeds your maximum stated rate (i.e., the insurance rate will trigger).

Algorithm of functionality operation

Definition of variables

inAmount - The amount being exchanged for the given currency (the amount you are giving).

outAmount - The amount being received from the exchange (the amount you are receiving).

outFeeAmount - The fee amount being charged for the exchange.

FeePercent - The percentage of the fee charged for the exchange.

discount - The discount applied for the amount in the "Discount for Amount" setting on the "Commissions" step of the direction settings.

discountRate - The "Discount for Amount" divided by 100, to express it as a percentage.

feeRate - The "Fee Percent" divided by 100, to express it as a percentage..

in:out (rate from the main parser or the rate specified manually in the direction setting)

rate - The exchange rate considering the percentage commission, but excluding the commission amounts themselves (i.e., it is the exchange rate before the actual commission fee is applied).

RateFrom:RateTo The exchange rate specified in the insurance setting (for example, 1:39). This rate can either be set manually or come from the parser.

defaultPercent - This is the same as the "Fee Percent" but applies specifically to the insurance rate. It is activated only when the insurance rate is triggered. This value determines how much commission is applied in case the insurance rate becomes active.

maxLimitPercent - The percentage that defines the upper limit of the current exchange rate relative to the exchange rate specified in the insurance setting.

Exchange rate calculation formula

feeRate = FeePercent / 100 
in = in + (in * feeRate) 
discountRate = discount / 100 
in = in - (in * discountRate) 
rate (exchange rate including commission percentage) = out / in

Formula for calculating the insurance rate

Current insurance rate = RateTo / RateFrom - defaultPercent 
Insurance rate = Current insurance rate + maxLimitPercent.

Rate insurance work options

If the Exchange rate including commission percentage ≥ Insurance rate -> rate insurance is triggered and depending on the action:

  1. For “Set default value”, the “Current insurance rate” will be used as the actual rate.

  2. For “Maximum rate”, the “Insurance rate” will be used as the actual rate.

  3. For “Disable direction”, the direction will be deactivated.

In other words, rate insurance is triggered when the final exchange rate (the main parser rate minus the commission percentage) becomes greater than or equal to the insurance rate (current insurance rate minus the commission percentage (defaultPercent)) by the maxLimitPercent value.

Essentially, the "Max limit difference percent" field specifies the allowable deviation of the rate from the insurance rate.

When the rate insurance triggers in the admin panel, the direction is highlighted in red, and the safeguard rate is displayed.

Example 1 - Insurance fails to operate
  • Для направления указан курс обмена "АвтоFor the direction the exchange rate ‘Automatically’ is specified: from whitebit parser (BTC-USDT, USDT-USD), the rate from parser (in:out) is 1:34256.00.

  • FeePercent (FeePercent): 7

  • Value "DISCOUNT FOR AMOUNT (discount): 0

  • Rate insurance has the ‘Automatic’ type: kraken parser (BTC-USD), rate from insurance parser (RateFrom:RateTo) 1:34090.

  • Value "Default percent" (defaultPercent): 7

  • Value "Max limit difference percent" (maxLimitPercent): 1.1

  • Action selected ‘Set default value’

feeRate = FeePercent / 100 = 7/100 = 0.07 in = in + (in * feeRate) = 1 + (1_0.07)=1.07_ discountRate = discount / 100 = 0 _in = in - (in * discountRate) = 1.07 - (1.07_0) = 1.07 RATE (final exchange rate)= out / in = 34256.00/1.07= 32014.9533

IF RATE ≥ Insurance rate -> rate insurance is triggered Current insurance rate = RateTo/RateFrom-defaultPercent = 34090 / 1 - 7% = 31703.7 Insurance rate = Current insurance rate + maxLimitPercent = 31703.7 + 1.1% = 1 : 32052.4407

Rate (32014.9533) < Rate Insurance (32052.4407) -> rate insurance is not triggered and the customer will see the rate including the commission percentage, namely 32014.9533

Example 2 - Insurance triggers / Action: Set default value
  • For the direction the exchange rate ‘Automatically’ is specified: from whitebit parser (BTC-USDT, USDT-USD), the rate from parser (in:out) is 1:36256.00.

  • FeePercent (FeePercent): 7

  • Value "DISCOUNT FOR AMOUNT (discount): 0

  • Rate insurance has the ‘Automatic’ type: kraken parser (BTC-USD), rate from insurance parser (RateFrom:RateTo) 1:34090.

  • Value "Default percent" (defaultPercent): 7

  • Value "Max limit difference percent" (maxLimitPercent): 1.1

  • Action selected ‘Set default value’

feeRate = FeePercent / 100 = 7/100 = 0.07 in = in + (in * feeRate) = 1 + (1_0.07)=1.07_ discountRate = discount / 100 = 0 _in = in - (in * discountRate) = 1.07 - (1.07_0) = 1.07 RATE (final exchange rate)= out / in = 36256.00/1.07= 33884.1121

IF RATE ≥ Insurance rate -> rate insurance is triggered

Current Insurance Rate = RateTo/RateFrom-defaultPercent = 34090 / 1 - 7% = 31703.7 // this rate will be set if ‘Set default rate’ is selected. That is the rate will be 1:31703.7 Insurance rate = Current insurance rate + maxLimitPercent = 31703.7 + 1.1% = 1 : 32052.4407

Rate (33884.1121) > Insurance Rate (32052.4407) -> insurance rate is triggered and the customer will see the current insurance rate, namely 31703.7

Example 3 - Insurance triggers / Action: Maximum rate
  • For the direction the exchange rate ‘Automatically’ is specified: from whitebit parser (BTC-USDT, USDT-USD), the rate from parser (in:out) 1:34256.00.

  • FeePercent (FeePercent): 7

  • Value "DISCOUNT FOR AMOUNT (discount): 0

  • In the rate insurance the type ‘Automatic’ is specified: kraken parser (BTC-USD), rate from the insurance parser (RateFrom:RateTo) 1:34090.

  • Value "Default percent" (defaultPercent): 7

  • Value "Max limit difference percent" (maxLimitPercent): 0.35

  • Action selected ‘MaxLimitPercent’

feeRate = FeePercent / 100 = 7/100 = 0.07 in = in + (in * feeRate) = 1 + (1_0.07)=1.07_ discountRate = discount / 100 = 0 _in = in - (in * discountRate) = 1.07 - (1.07_0) = 1.07 RATE (final exchange rate)= out / in = 34256.00/1.07= 32014.9533

IF RATE ≥ Insurance rate -> rate insurance is triggered Current insurance rate = RateTo/RateFrom-defaultPercent = 34090 / 1 - 7% = 31703.7 Insurance rate = Current insurance rate + maxLimitPercent = 31703.7 + 0.35% = 1 : 31814.6629 Rate (32014.9533) > Insurance Rate (31814.6629) -> rate insurance is triggered and the customer will see the Insurance Rate, namely 31814.6629

Example 4 - Insurance triggers/ Action: Switch off direction
  • Manual exchange rate for the direction: (in:out) 1:41.37

  • FeePercent (FeePercent): 4

  • Value "DISCOUNT FOR AMOUNT (discount): 0

  • Rate insurance has the type ‘Manual’: (RateFrom:RateTo) 1:42.08

  • Value "Default percent" (defaultPercent): 8

  • Value "Max limit difference percent" (maxLimitPercent): 1.1

  • Action selected ‘Disable direction’

feeRate - FeePercent / 100 = 4 / 100 = 0.04

in = in + (in * feeRate) = 1 + (1 * 0.04) = 1.04 discountRate = discount / 100 = 0 / 100 = 0 in = in - (in * discountRate) = 1.04 - (1.04*0) = 1.04 RATE = out / in = 41.37 / 1.04 = 39.778

IF RATE ≥ Insurance rate -> rate insurance is triggered

Current insurance rate = manualRateTo/manualRateFrom-defaultPercent = 42.08 / 1 - 8% = 38.7136 Insurance rate = Current insurance rate + maxLimitPercent = 38.7136 + 1.1% = 39.139

RATE (39.778) > Course Insurance (39.139) -> course insurance will be triggered and the direction will be disabled.

Last updated