Question about Debit & Credit in Finance Library

G-d willing

I would like to know why the Credit & Debit for the Account interface receives different arguments.
While the Credit expects the amount, the Debit expects a Holding.
Let’s say I have my account a Holding contract with the amount of 100. How can I debit my account with only 50?
Is my only way for it, is first to split the holdings?

That is indeed the case. In the library we generally consider the “right-sizing” of holdings to be a user concern, and always expect exact holdings to be passed in. This allows us to validate eg. when allocating to a settlement instruction that the right amount is passed in.

Furthermore, it is straight-forward to write a template to expose eg. a SplitAndDebit choice, but the reverse isn’t true. That is, if we were to split in the debit choice, but one wants the behaviour to only accept exact amounts.

In general the strategy by which holdings should be split, merged, and used is application-specific, so the library takes the least restrictive approach and leaves higher-level APIs to user implementations.

Hope this helps.

1 Like