-
Notifications
You must be signed in to change notification settings - Fork 40
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
Handling Fidelity (and other) accounts with banking features #41
Comments
Thanks for the report and suggestion! I'll take your word for it, since I don't have an ofx file to test against. Fix committed. |
for investment accounts with banking features
Actually, I added |
I did find that Fidelity's ofx file generated |
👍🏻 I'll add it in a minute. |
for investment accounts with banking features
@thehilll Would you be willing to provide your import configs for your Fidelity CMA/"banking"-like accounts? I'm currently using the I have a "checking" account which acts as the overdraft for my CMA account which has the following config: # The `fidelity_banking` importer class
class Importer(banking.Importer, ofxreader.Importer):
IMPORTER_NAME = "Fidelity Banking Accounts"
def custom_init(self):
if not self.custom_init_run:
self.max_rounding_error = 0.04
self.filename_pattern_def = "fidelity_checking*"
self.custom_init_run = True # How it's applied in import configs.
apply_hooks(
fidelity_banking.Importer(
{
"account_number": "X90787461",
"main_account": "Assets:Fidelity:Checking",
"filename_pattern": "fidelity_checking.ofx",
}
),
[PredictPostings()],
), |
@chase-dwelle, FYI, I've only run some very basic cases myself, but the Fidelity ofx importer (which uses the At some point, beancount_reds_importers should address the issue of the right transaction builder to use for checking-like accounts, which straddle investments and banking. I don't have enough experience, or a sense of requirements for these accounts, or test cases for these, but am happy to follow along and hear from folks about what works best. Possibilities include:
|
@chase-dwelle I went down the path of trying to use the banking transaction builder, but I gave up pretty quickly. Fidelity seems to report the OFX file of CMA accounts as something very close to a standard investment account. I'm using this configuration:
With a version of
The issue I ran into was that
That last line was the one that returned, and it would classify even CG distributions as dividends. This seems like it is a variation on the OFX file that wasn't considered, and I thought about opening another issue here. However, With these changes (those noted in the first post here, and the custom I have not had full success getting the smart importers to work. I did succeed with all of the CMA accounts (where it really matters), but most of the investment accounts did not work. The error is always:
This isn't really true. I've triple checked the account strings match. I think it has something to do with the setting for For the investment accounts I use something like |
Very cool, and very helpful, thank you for sharing in detail, @thehilll ! Based on your message, it seems like the investment transaction builder is the right one to use for cash management accounts, which is good to know. Opened #42 to guess income type better in the main code where possible, despite inconsistencies. Reg smart importer, the investment transaction builder outputs all target accounts needed. Wouldn't this leave smart importer with nothing to guess? I'm trying to figure out what you're using smart importer for in this scenario. |
On the smart importer...you are right. It really isn't needed on a true investment account. Across many accounts like this I only ran into two types of transactions that weren't classified:
Where I do need the smart importer is for the two accounts I treat as a banking account as those have a lot of bill payment transactions. In this case I did get the smart importer to work, and it worked well. I believe the issue I was having was when I included the Really I was just trying to have a single importer config for simplicity (this is my first pass of imports after converting to beancount). |
Thanks @thehilll , this worked and seems to have fixed some odd errors I was getting with my Fidelity "banking" accounts, like some transactions missing date attributes. |
Makes sense, thanks again for sharing @thehilll. BTW, your setup might be helpful to others to post on the Beancount mailing list, if you feel up to it. CMA accounts seem to be getting more common. |
@redstreet I will post something, but I was trying to iron out a couple of nagging issues that made the success here seem a bit fragile. First, a trivial item I came across was an additional cash transaction type of The second thing that was bothering me was that I have two different investment accounts that function as bank accounts, and I needed (through trial and error) to have slightly different configs to get the smart importer to work for them (and these benefit from the smart importer). This config worked for the first account:
Bit for the second account I needed to make the first two settings:
(the other settings were similar to the first account). If I did not hard code Digging into things I found that your importer is properly using
In particular, The reason these two would never match for this account is because
and in your
This explains the difference between my two accounts. In In this case I run into an edge case where if I use the config from the first account where I'm only looking at this as an outsider, so it's tough to say if there is a way to address this generally. My first reaction is that maybe it is just a point to make in explanation... The one issue with that is I think it might make for a bit of a mess if you have an account that gets both banking transactions and trade transactions. I don't have any of those now, but maybe you know? Alternatively, is there a way to define |
Yes, adding an overridable For this line, perhaps there is a better way of deciding upon using Response to your other part soon. |
Trying to understand this better before I respond:
|
I believe this is very specific to my setup and history with these accounts (really my question is how would you explain this to people in the generic case, and only secondarily if there is anything to change).
Yes, they are today.
account_1 has never had anything other than money market funds...it has only ever been effectively a cash account. account_2 used to have investments (non-money market funds) many years ago and so has that history. Because of this I set the two accounts up slightly differently. I personally consider them both banking accounts (I am closely following your account structure), but the second account does need to handle its history of holding shares. The account openings for these two look like this:
Yes. These both have frequent bill pay activity for which the smart importer really helps. With the current configs smart importer works with both.
Yes, and this works. The deterministic transactions are correctly constructed by the importer, and the
It was really two things:
I think 1 is really answered...it's explainable and a consequence of my setup. On 2 I think the short answer is that whatever someone sets as the value for
That is possible for me. I think it would be possible for most people. I don't really know if it would be possible to make the setup simpler, but my guess is maybe no? Thanks a lot for this. It has saved me dozens of hours. |
Thanks a bunch for the response including the You raise good points. I'd love to straighten and simplify these if needed. First: with my own accounts, I realized this structure had way too many problems to work out well:
and thus, I myself use this structure instead (leaf-accounts only):
So
|
That's understandable. I did it because I really view this as a banking account, but even writing this up it seemed odd. However, I don't think just eliminating this case solves the issue.
This is very close to my setup for
Note that first line never really comes into play...no postings are booked to it, and it only exists because I didn't understand that you could have a The only difference from your setup is that I used
I modified my accounts to match your structures:
And then use this setting in
However, when I run
The problem comes from this line in
Each transaction goes through that filter individually, and it is kept in the training set if the function returns That test is a comparison of
So
That function in
And so in the case where the config is as you suggest, the
I got lucky trying different configs (and account setups) and didn't use the tokens in the config. In that case the replacement above won't match my hard coded The limitation is that as of now I don't think you can do these four things together:
That isn't a very big limitation. I think people could get around it just by hard coding the currency in the config (though obviously that has some multi-currency limitations, but I haven't really thought that through). To avoid having to do that, I think Also, I've only done a few imports since setting up beancount. I could well be missing some complications here. |
I agree, something doesn't seem right with |
Ah, |
Sorry to not reply. I should be able to get something later today, assuming I can figure out the ofx part of it. |
OK, I believe the six attached files are a useful example that corresponds to the above. They are:
Using these accounts gives:
where that transaction date and amount match what is in However, when I use:
and
The smart importer is unable to match any transactions:
Thanks for digging into this. |
Awesome, that helps a lot, @thehilll! I took a look, and have filed the issue linked above with |
Until it's fixed upstream, I just committed a pretty convenient hack. To use it, add this to your importer config:
That account will be sent to Let me know how this works out for you. |
Yes, this seems to give all the flexibility needed. Thanks a lot. |
I also ran into this issue as I use my Fidelity brokerage account for bill payments, check writing and debit card transactions. One other detail I wanted to mention was parsing of the check numbers. Here is an example of one in the OFX file:
I'm a little confused as to what the intent is in the Importer-related classes, with regards to checks. I see that the sample in
|
@davraamides, since there is so much variance between institutions on if and how they include the check number in their data (csv or ofx), there is no general approach to handling them in the importers currently. I've seen check numbers appear in That said, your code to add check number as metadata above is general enough that I'm happy to include it in the default |
I have about 10 Fidelity Investment, NetBenefits, and CMA accounts. I am currently using OFXClient to download and red's fidelity OFX importer to handle all of them. Unfortunately one of them started to give me a download error and I think we are quickly approaching the end of simple CLI download of OFX data. It seems we will all have to manually login and download unless you are Intuit. Fortunately, Fidelity will allow me to download all of the account data in one file. The bad news is that they only offer CSV. I'd love to have a single all-in-one Fidelity CSV importer that can handle such a file. I tried using the Fidelity CSA importer against it, but it didn't recognize it (I assume it doesn't support multiple accounts). Given the comments above, it seems like basing something off of the investment builder makes the most sense. Has anyone given any thought to such an importer. I have another project I am currently working, on, but I have a feeling I am going to have to deal with this sooner than later. EDIT: I'm looking at the schwab importer now. Maybe we need somethings similar like fidelity_{csv, ofx}_{balances, checking, brokerage}.py |
@patbakdev, I too have most types of of account Fidelity has (a ton of them), and regularly use CSV is of course, the ultimate fall back solution, but for many reasons, it is a huge downgrade over With Fidelity, I'm wondering if there is a solvable issue with your |
@redstreet Interesting. I took a look at bean-download and it gave me a few ideas. I was able to fix-up the NetBenefits account I was having trouble with. I think I was just irritated because that account had escaped my purview (either didn't download or appeared to download correctly, but without data) and I was making portfolio decisions with 6 months of missing data and not knowing it. I completely agree with OFX > CSV. This process can be a bit fragile and every time it breaks my search comes across new info like these (including one from you 😄) so maybe I am just a little big jumpy:
I cannot find any QFX/OFX download option from the Fidelity website for either a single accounts or all-accounts. Statements can be downloaded as either CSV or PDF, but activity and positions appear to only be CSV. Then again, they change the interface sometimes so its possible I am on a newer/beta version. Maybe if I enroll in Full View it as an options, but that is not something I want to do. I also have Chase accounts and they stopped allowing direct download. Fidelity is the only reason I continue to maintain my automated download scripts for. But alas, for now, I am back in a working state and can avoid the webscrape and csv hell I fear in the future. |
Going back to the original issue of this thread: the importers work fine for CMA now, with the hack. I'm not seeing enthusiasm at smart importer to fix this issue, so the hack in this thread may be the way going forward for now. This thread has otherwise become unwieldy and a bit of a catch-all. Instead, I invite anyone with an issue to open a focused thread on that topic. As an example, I've opened #66 for the latest issue posted here. |
Hello,
I ran into an issue trying to parse downloads from Fidelity accounts that have banking features enabled (in particular accounts that receive paper checks and use bill payment...I could see there being similar issues with writing checks, but I don't have any examples to try).
The OFX file looks something like this for the transactions that are failing:
and the exceptions are e.g.
However, the fix is quite simple, extending the cash transaction lists on line 257 and 318 to include:
Allows these to be processed like other cash transactions.
The text was updated successfully, but these errors were encountered: