Skip to main content

Calculate fees for transactions

This decision table contains two rules that calculate transaction fee and tax based on the calculated costs.

First rule

The first rule calculates the transaction fee based on the percentage or on a minimum fee in the given currency. If the percentage fee is higher than the minimum fee, the percentage fee is applied, otherwise minimum fee calculated in transaction currency is applied.

Important highlights from the rule sample:

  • Minimum costs can be given in selected currency and the rule uses costInMinFeeCurrency function to convert minimum fee from a given currency to the transaction currency.

  • The rule updates the transaction object with the update($t); method after the fee is calculated for the transaction. This enables the second rule to calculate tax based on the costs set by the first rule.

Alternative 1:

  • Condition 1: Transaction doesn't have the "FeeCalculation-Manual" tag.

  • Condition 2: Security type is "E" (Equity).

  • Condition 3: Transaction type is either "B" or "S".

  • Action 1: Set the transaction fee to 0,5% with a minimum of 200 USD.

  • Action 2: Set the FeeCalculation-Automatic tag on the transaction.

Alternative 2:

  • Condition 1: Transaction doesn't have the "FeeCalculation-Manual" tag.

  • Condition 2: Security type is "C" (Bond).

  • Condition 3: Transaction type is either "B" or "S".

  • Action 1: Set the transaction fee to 1% with a minimum of 200 USD.

  • Action 2: Set the FeeCalculation-Automatic tag on the transaction.

Second rule

The second rule calculates transaction tax based on the given tax percentage and transaction fee calculated in the first rule. It also sets tax type as given in the rule parameters.

  • Condition 1: Transaction doesn't have the FeeCalculation-Manual tag.

  • Condition 2: Portfolio tax country is "AE".

  • Condition 3: Security type is "E", "C" or "D".

  • Condition 4: Transaction type is either "B" or "S".

  • Action 1: Set transaction tax percentage to 5% VAT.

Decision table

custom_transaction_setFeeAndTax.xlsx