Skip to main content

Define order validation rules for FA Client Portal

The importLimitedTradeOrder API endpoint validates trade orders entered in FA Client Portal. The validation rules are:

  • Users require permission to import orders into FA Platform.

  • The set of the trade order import fields is limited.

  • Users are only allowed to import orders into portfolios they have access to.

  • Users can import new orders with “Open” or “Closed” status, and update “Open” orders.

  • Users can import only tags with the “apitradeorder” prefix.

  • Orders must contain all mandatory fields.

These validation rules don't prevent users from entering orders with inappropriate transaction types or placing buy orders that exceed available cash. While the standard FA Client Portal's front end validates these, this front-end validations can be bypassed, so back-end validation is also needed. Additionally, checks for tradeable securities and portfolio tags that allow FA Client Portal trading aren't handled by the limited trade order import API.

To ensure portfolios have enough cash or units for an order, use the FA standard order validation extension. This workflow guarantees that even if an invalid order is entered in the FA Platform, the order validation extension rejects it before further processing.

To validate other requirements, like the Tradeable tag on securities or the Client portal:Trade tag on portfolios, use a decision table. You can extend this decision table by adding your own validation rules.

Decision table to validate trade orders in FA Client Portal

The attached decision table contains the following validation rules that you can adjust. You can also add entirely new rules.

  • Only allow entering buy and sell orders if the portfolio has the “Client portal:Trade” tag.

  • Only allow entering trades against securities containing the “Tradeable” tag.

  • If the target portfolio contains any security groups with a “CP_” prefix, the traded security must be linked to one of them.

  • Only allow canceling orders if the portfolio has the “Client portal:Cancel orders” tag.

  • Only allow deposits if the portfolio has the “Client portal:Deposit” tag.

  • Only allow withdrawals if the portfolio has the “Client portal:Withdraw” tag.

  • Only allow B, S, SUB, RED, DEP, and WD transaction types.

  • Minimum amount 0, maximum amount 1000000000.

custom_tradeOrder_client_portal_validation.xlsx

Technical note: most of the security group validation logic is actually in the action section of the decision table, which references a function.

The rules in this decision table apply to orders entered via the importLimitedTradeOrder and importSwitchOrder endpoints. They run against the LimitedTradeOrderDTO object, not the usual Transaction object. This is important, because it allows you to target these validation rules specifically to FA Client Portal users and other potential users of these restrictive endpoints.

If a validation rule fails, the API caller receives an error message from the “ACTION” section of the rule. If multiple validation rules fail, the aller receives multiple error messages. FA Client Portal displays these error messages to the user.

The sample rule file doesn't include back-end validation for the following:

  • Whether the order's trading basis (units or trade amount) is allowed.

  • Whether securities in a switch order are switchable.

  • Whether FA Client Portal user is allowed to enter trades for a portfolio based on representative tags if the portfolio doesn't have the “Client portal:Trade” tag. The sample decision table requires the “Client portal:Trade” portfolio tag for all trades.