-
Notifications
You must be signed in to change notification settings - Fork 103
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
several minor OFX improvements #223
Open
jktomer
wants to merge
6
commits into
jbms:master
Choose a base branch
from
jktomer:ofx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
some banks (notably Vanguard) distinguish between a Roth 401(k) and an after-tax 401(k).
The OFX parser already skips emitting balance checks for securities on dates that had activity on that day because Beancount's ordering constraints might require changing the date of either the transaction or the balance assertion. This commit does the same thing for balance assertions on cash accounts.
For some securities which don't have real CUSIPs or ticker symbols (e.g. institutional share classes of mutual funds), it seems that most providers make up a fake CUSIP to put in their OFX streams. Unfortunately, there is no consistency between the fake CUSIPs used by different providers; for example, Vanguard gives "Trust Select" shares of their Target Retirement 2030 fund the fake CUSIP "92204E605", but Fidelity gives the same share class of the same fund the fake CUSIP "OP1G." This change permits mutliple CUSIPs to be listed for a single currency, separated by commas, and the OFX parser will treat them all as referring to the same currency.
Code in ofx.py includes an assert to check that the amount on an outbound transfer posting is negative. However, sometimes OFX files include (apparently useless) transfers of zero shares of a security. These trigger the assert, killing beancount_import, even if the zero was properly a negative zero. This commit changes the assert in question to handle negative zero amounts correctly.
I have a credit card whose OFX records otherwise come out looking like "STMTTRN - payee's actual name - garble of digits" which is not actually useful. This lets me instead give a format string for the payee, allowing the interpolation of those fields that are relevant for a particular account. Format strings are given in the account metadata, key 'ofx_payee_format', as a regular Python str.format() format string, with supported substitutions trantype, incometype, inv401ksource, name, and memo.
Sometimes an account (e.g. a credit card) changes primary identifiers but maintains a continuous transaction history and OFX series. This change makes it possible to list the old account identifiers for an account in the `old_account_ids` meta field of an open directive; transactions from OFX files matching either the old or new account ids will be associated with the account.
I noticed the ultipro PR also skips balance entries on same day as other transactions. Is there a way to handle this at a higher level for all sources simultaneously, with an optional flag to do this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugs fixed:
New features: