Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 2.05 KB

README.md

File metadata and controls

43 lines (30 loc) · 2.05 KB

Cathay United Bank ETF to Excel

GitHub GitHub stars GitHub repo size

Using Selenium to extract ETF data from Cathay United Bank to Excel file with Safari.

Preparation

  • A Mac, so you could use Safari
  • Allow "remote automation" in Safari
  1. Choose Safari > Preferences, and on the Advanced tab, select "Show Develop menu in menu bar."
  2. Choose Develop > Allow Remote Automation.

Flow Chart

try:

  1. Set up web driver:Safari
  2. Open EFT website on Cathay United Bank
  3. New or open a excel file named Cathay-United-Bank-ETF.xlsx
  4. Initial Excel cell format
  5. Wait for website to load completely:until price of the last row not equal to "-"
  6. Extract tabletheadtbody
  7. Write column title to Excel file, and set font to bold
  8. Write table data to Excel file:add new line on EFT name cell and price cell
  9. Save and close Excel file
  10. Quit web driver

except Exception:

  1. If an Excel file have been opened, close it
  2. If a web driver have been created, quit it
  3. Rerun main.py by os.execv(sys.executable, ['python3'] + sys.argv)

License:MIT

This package is MIT licensed.