Best Way to Merge Finance Library Holdings

Hi everyone!

When I credit holdings using Holding.Account.Credit I create new Holding in the Account. Alongside with the others that I created before. What is the best way to automatically merge them?
I consider few things:

  1. I want to avoid race conditions. When some process use holding that I’m trying to merge
  2. In the UI I don’t what to show the user the list of similar holdings. So maybe I can merge it on the client side? And that’s it.
  3. Sometimes I have to merge, when I need to transfer the amount that is bigger then each particular holding I have.

What can you suggest here? I’m thinking now about avoiding merging as much as possible. So even if I need to transfer big amount I can make it in several transfers. And split at the end.

Thanks!

1 Like

Hi @VictorShneer,

You make the valid point that, in order to avoid race conditions on single holdings, you should refrain from merging as much as possible. Of course this is not always possible, for instance in the transfer case you mention at point 3.

My recommendation here would be to keep this potential bottleneck in mind when designing your application, especially when a large number of potentially concurrent workflows are expected.

In order to facilitate the design of your workflows, you can use the locking feature of holdings to ear-mark them as “currently being used for a specific workflow”. You should then only allocate “unlocked” holdings to newer workflows.

Matteo

2 Likes