Skip to main content

Calculate transaction fees automatically

Overview

Transaction and/or trade order fees can be calculated automatically when saving the transaction / trade order using FA Back’s Decision tables functionality. A ready-made XLSX template is available to be filled with relevant fee conditions and parameters:

fa-transaction-fees.xlsx

Note

For more information about Decision tables functionality, please refer to the Developer documentation: Business rules.

How to get started

Download the XLSX template to your computer. In the template file there’s a few header rows and from row 13 onwards a table consisting of many transaction / trade order related conditions and actions that can be used to specify the fee schedule.

Note

The XLSX template file contains some hidden rows. Do not alter these or add new columns unless you know what you’re doing.

Transaction fees Decision table

The columns in the XLSX template are categorized as follows:

  • (The green column): Name of the specific fee rule

  • (The light and dark grey columns): Conditions on which to apply the specific rule

    • Conditions related to the transaction itself

    • Conditions related to transaction’s security

    • Conditions related to transaction’s portfolio

  • (The blue columns): Fee calculation parameters for the specific fee rule

Defining the rules for fee calculation

Note

The XLSX template for specifying the fee calculation rules can only be used for specifying the minimum and maximum fees and the absolute fee in transaction’s currency. The template file cannot be used to calculate those fees in portfolio’s or account’s currency.

In general, the process for defining the decision table goes as follows:

  1. Identify the individual rules based on your fee schedule.

    A good starting point is the different sets of fee percentages and minimum/maximum fees you have. In a normal case, there would be one rule per distinct fee percentage / minimum fee / maximum fee combination.

  2. Fill the decision table based on the rules you identified:

    1. Remove the sample row first before proceeding

    2. Decide if you want to calculate the fees for transactions and/or trade orders.

      • If you want to calculate for transactions, specify OK, NF and/or DEL in the column B (“Status of the transaction”) as a comma separated list

      • If you want to calculate for trade orders, specify ORDER in the column B and relevant trade order statuses in column C (“Status of the trade order”)

    3. Decide when you want to calculate the fees.

      • If the fees should be calculated when the trade order / transaction is saved the first time, specify Fee calculation-Done in column E (“Doesn’t have the tag”) and in column AC (“Set tag”).

        This way, when the transaction is saved the first time, the fees are calculated and it get the specified tag. That tag then prevents the fees from being calculated again when the transaction is saved again.

      • If the fees should only be calculated when explicitly saying so, specify Fee calculation-Pending in column D (“Has the tag”) and Fee calculation-Done in the column AC (“Set tag”).

        This way, the fees will only be calculated when the transaction is given the tag Fee calculation-Pending. When the fee is calculated, the tag is changed to Fee calculation-Done, which prevents the fees from being calculated again when re-saving the transaction (unless the tag is changed accordingly)

      • If the fees should be calculated every time the trade order / transaction is saved, you don’t need to consider the tags at all.

    4. The columns are documented with cell comments on row 13. Make sure you read the comments before filling the columns.

    5. Unrelated columns can be left empty.

  3. Save the XLSX file and upload it to FA Back (follow the instructions in Step 2 - Deploy the decision table in FA Back in FA Developer).

  4. Test the rules by creating appropriate trade order(s) / transaction(s).