Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 1.03 KB

README.md

File metadata and controls

15 lines (12 loc) · 1.03 KB

Bond Value Scraper

I wish there was a way to bulk upload a spreadsheet of bond serial numbers to https://www.treasurydirect.gov/BC/SBCPrice. There isn't. So I wrote a python script with Selenium Webdriver to parse a CSV containing the info needed to fill out the form and run it automatically.

Then, you just need to click save and copy and paste the table back into a spreadsheet for fiddling.

Run

  1. Use Python 3.2+
  2. pip install -r requirements.txt
  3. Install geckodriver on your PATH for Firefox support
  4. copy your bonds.csv file to the root. don't add it to git, please. I don't want to know
  5. python bond_scraper.py --value_as_of=<month and year you want to calculate the value for> --bond_csv=<the file with the list of bonds to calculate>
    • --value_as_of=11/2017
    • --bond_csv=sample_bonds.csv (see included sample_bonds.csv for reference format)
  6. Once the script is done, you should be able to go to the Firefox instance that Selenium opened and save the results as a file