oasuncion / tradista

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

Incorrect transfers and product positions when changing the bond of a bond trade #95

Closed oasuncion closed 5 months ago

oasuncion commented 6 months ago

When a bond trade is saved then has its bond modified, there are two issues:

  1. The canceled transfers are linked to the new product id instead of the old one
  2. the position on the new bond is not modified as expected and in the same time the position on the old bond is incorrectly impacted

To reproduce the issue:

  1. Save a Bond trade (direction "Buy") with a Bond A (quantity: 100)
  2. Change the bond A to Bond B and save again the trade
  3. Transfers and positions are now incorrect

Expected behavior: The canceled transfers should be linked to the old product id and not the new one The position on the old product should be impacted by the change : there should be a a decrease of 100 Bond A The position on the new product should be impacted by the change : there should be an increase of 100 Bond B

Environment: Version 2.0.0

oasuncion commented 5 months ago

Tested ok.