Skip to content

Instantly share code, notes, and snippets.

shashank291 /
Last active January 5, 2022 14:42
Export Fidelity Stock Lots to TSV file


I used the below script to export my Fidelity share lot information in one file. By default, Fidelity requires going to each individual stock page to get this info which can be painstaking.


Fair warning that you should understand the code you're running, and I make no guarantees as to the correctness of the script or the data downloaded, and I assume no liabilities if you decide to run this code. Now that that's out of the way, to get your aggregate share lot information:

Go to your Individual account on Fidelity, under Positions tab, and open the console(Ctrl+Shift+J on most browsers). Then you can run the following script that will gather all your stock lot information and download it in a TSV file. I suggest you read through it and verify it as a common precaution. Here's the script:

const domParser = new DOMParser();