Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read closing, opening and available balances #107

Open
gmyrianthous opened this issue Feb 27, 2024 · 3 comments
Open

How to read closing, opening and available balances #107

gmyrianthous opened this issue Feb 27, 2024 · 3 comments

Comments

@gmyrianthous
Copy link

gmyrianthous commented Feb 27, 2024

I am struggling to find an example of how to infer closing, opening and available balances from a MT940.
As far as I can see, these details are included on transaction-level but in reality, I do have some documents with no transactions at all and thus I am looking into inferring the balances outside of the context of a "transaction".

Can someone help here? Is this possible?

Thanks!

@wolph
Copy link
Owner

wolph commented Mar 5, 2024

I'm not entirely sure I understand the question to be honest. But I'll try to explain the working of the library a bit.

The scope decides whether a tag is part of the Tranasaction or Transactions (plural). If it's a transaction scoped item it will be different for each transaction, if it's a transactions scoped item it will stay the same between transactions.

scope = models.Transactions

If needed, you can override this attribute: some_tag.scope = models.Transaction

@gmyrianthous
Copy link
Author

gmyrianthous commented Mar 5, 2024

Thanks for your reply @wolph.

What if a MT940 doesn't have any transactions, but just statement/account/balance information?

Here's an example document (I have kept only the tags in the sequence they show up)

:20:
:25:
:28:
:60F:
:62F:
:64:
-

@aGitForEveryone
Copy link

If your data does not contain any transactions, then no transactions will be created during parsing. New transactions are only created when encountering tag :61: (which your data does not have). So if you set the scope to models.Transaction, the data cannot be recorded as there is not Transaction object to hold the data.

You could leave the scope to the default (models.Transactions) and then the Transactions object that the parse() function returns will contain the last value found in the balance tags. Which will work if you only have 1 block. But if you have more blocks, you will only keep the last block info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants