For PocketSense users who download Fidelity OFX files

169 views
Skip to first unread message

Cal Learner

unread,
Jan 6, 2024, 12:37:47 PM1/6/24
to Microsoft Money
This post is of limited interest. It will probably only be of interest to those using PocketSense to download Fidelity Investments OFX files for Microsoft Money, and who are into just-in-case planning. I am writing this primarily for myself.

I fear that Fidelity may stop providing the OFX server at some point. We are warned that changes are coming. So I have been working to look at the latest Positions and History CSV files to produce OFX files. In progress. If the ofx server gets to be inaccessible, I expect to become more motivated. Somebody else may be faster or better.

However those files don't contain everything that you want to make an OFX file. For example, no cusip, altho there is a way around that by making a pseudo-cusip derived from the ticker. There are other things.

In my plan, I create a CSV file named fidDB.csv. This can be edited by a spreadsheet program or with a text editor. But I have what seems to be a mostly-working program (FidDBgather.py), for most security types (options next target), to create, or add to, that database by looking at existing Fidelity*.ofx files produced by PocketSense. Pocketsense puts those into the xfr folder after each Getdata.py. But it deletes the existing files first. I suspect that if the server is down, the existing OFX files get deleted, but new ones cannot be had.

FidDBgather.py can be passed either a folder path or a path to a single OFX file. It will look thru the ofx file(s) and if any have a ticker that is not already in fidDB.csv, it adds the new security, including the extra info.

So to plan ahead, you could gather your latest Fidelity*.ofx files, and add them to a folder. I also gather the latest Positions and Transactions History csv files into that folder.

Before doing the batch file, get the two new Fidelity CSV files. No need to delete the older ones.  On both the Activity page (https://digital.fidelity.com/ftgw/digital/portfolio/activity)  and the Positions page (https://digital.fidelity.com/ftgw/digital/portfolio/positions is a download icon. Leave "All Accounts" selected, which is the default. These normally get routed into your Downloads folder.

To use this batch file, you will copy the lines into a file called fset.bat, and you will edit the line that contains %USERPROFILE%\Documents\MN\PS_dev\xfr\Fidelity*.ofx  to match your setup.

Then, to invoke the batch file, type "fset". This will pile files into a folder named "set". Better yet, add a parameter such as in "fset 02". If set02 folder does not already exist, that folder will be created. Into that, the infor that could be used later to generate the database will be copied.


@rem =======begin fset.bat========
@echo off
echo invoke as fset 09 (for example). Makes/uses folders in current folder.
rem if no parameter, just adds all saved files into a folder called set, which would not be so bad

if not exist set%1\ md set%1
rem cd \"Batch Test"

for /f "delims=" %%x in ('dir /od /a-d /b %USERPROFILE%\Downloads\Accounts_History*.csv') do set hist=%%x

echo %hist%
for /f "delims=" %%x in ('dir /od /a-d /b %USERPROFILE%\Downloads\Portfolio_Positions_*.csv') do set positions=%%x
echo %positions%

copy %USERPROFILE%\Downloads\%hist% set%1\
copy %USERPROFILE%\Downloads\%positions% set%1\
rem Adjust the path for the xfr folder to match your setup
copy %USERPROFILE%\Documents\MN\PS_dev\xfr\Fidelity*.ofx  set%1\
@rem =======end fset.bat========

Ameridan (microsoftmoneyoffline.wordpress.com)

unread,
Jan 6, 2024, 9:39:00 PM1/6/24
to Microsoft Money
Cal, thanks for sharing!!

Since I'm in the habit of saving into the import folder, and since my file path has spaces in it, I modified your bat file.  It works great.  Now awaiting your python scripts.

@rem =======begin fidelityset.bat========

@echo off
echo invoke as fset 09 (for example). Makes/uses folders in current folder.
rem if no parameter, just adds all saved files into a folder called set, which would not be so bad

if not exist set%1\ md set%1
rem cd \"Batch Test"
set folder="%USERPROFILE%\Documents\Microsoft Money\Python Scripts"

for /f "delims=" %%x in ('dir /od /a-d /b %Folder%\import\Accounts_History*.csv') do set hist=%%x

echo %hist%
for /f "delims=" %%x in ('dir /od /a-d /b %Folder%\import\Portfolio_Positions_*.csv') do set positions=%%x
echo %positions%

copy %Folder%\import\%hist% set%1\
copy %Folder%\import\%positions% set%1\

rem Adjust the path for the xfr folder to match your setup
copy %Folder%\xfr\Fidelity*.ofx  set%1\
@rem =======end fidelityset.bat========

Message has been deleted

Ameridan (microsoftmoneyoffline.wordpress.com)

unread,
Jan 7, 2024, 12:43:15 PM1/7/24
to Microsoft Money

Ideally, the import folder will be the destination of your newly created ofx file too, so Pocketsense can then scrub (using your existing fidelity scrubber) and process (move to the xfr folder and create combined file with other existing ofx and qfx files, save that in the xfr folder, and later on - purge them all from the xfr folder) it.  That way, your python script only needs to create the ofx file, rather than incorporate everything else that Pocketsense already does.

Ameridan (microsoftmoneyoffline.wordpress.com)

unread,
Jan 7, 2024, 12:51:45 PM1/7/24
to Microsoft Money
I can confirm that Pocketsense will process files in the import folder, even if there are no connections to ofx servers to process.

Ameridan (microsoftmoneyoffline.wordpress.com)

unread,
Jan 7, 2024, 4:11:02 PM1/7/24
to Microsoft Money
Since it is easy to export all positions for all of your Schwab accounts as well, I'm going to try to adapt Cal's project for Schwab as well.  For now, I say we keep that development work in this same thread.  So if that export file is also saved in the Python scripts/import file, here is the script to also bring that into the set folder (for now, all transaction history is ignored [rem] and there are no longer any ofx server files from Schwab).

@rem =======begin schwabset.bat========

@echo off
echo invoke as fset 09 (for example). Makes/uses folders in current folder.
rem if no parameter, just adds all saved files into a folder called set, which would not be so bad

if not exist set%1\ md set%1
rem cd \"Batch Test"
rem Adjust the path for the location of your import and xfr folders to match your setup

set folder="%USERPROFILE%\Documents\Microsoft Money\Python Scripts"

rem for /f "delims=" %%x in ('dir /od /a-d /b %Folder%\import\Accounts_History*.csv') do set hist=%%x
echo %hist%

for /f "delims=" %%x in ('dir /od /a-d /b %Folder%\import\All-Accounts-Positions-*.csv') do set positions=%%x
echo %positions%

rem copy %Folder%\import\%hist% set%1\

copy %Folder%\import\%positions% set%1\
@rem =======end schwabset.bat========

---------------------------------------------------------------------

Whereas cusip and description are in columns C and D in Fidelity's csv file, they are in columns A and B for Schwab's csv file.


Reply all
Reply to author
Forward
0 new messages