eclipse-tradista / tradista

Tradista: the first open source Financial Risk Management Solution
Apache License 2.0
9 stars 2 forks source link

Block substitutions when there is no substitution right on a Repo #135

Closed oasuncion closed 2 months ago

oasuncion commented 2 months ago

It is possible to substitute securities for all Repos, even when there is no substitution right declared in the Repo trade definition. Substitutions should be allowed only when a Repo is declared with substitution rights.

To Reproduce Steps to reproduce the behavior:

  1. Go to the GC or Specific Repo trading dashboard
  2. Create a Repo, ensure to have the "Right of substitution" checkbox unticked
  3. Apply action PRICE then ALLOCATE on the Repo. The aim here is to have the Repo in the "ALLOCATED" status.
  4. Once in the ALLOCATED status, try to apply the "SUBSTITUTE" action.

Expected behavior A message indicating that substitutions are not possible because there is no substitution right on the trade.

Environment:

oasuncion commented 2 months ago

The solution was to add a guard on the 'SUBSTITUTE' action of both GC and Specific Repo workflows. This guard is named 'IsSubstitutionAllowed' and checks if there is a substitution right defined for the Repo trade. This ticket uses a new version of Tradista Flow (v5.0.1) where it is possible to define several guards on a given action. Indeed, there are now 2 guards defined for this 'SUBSTITUTE' action: 'CollateralSubstituted' and 'IsSubstitutionAllowed'.

oasuncion commented 2 months ago

Will be delivered with v2.2.0