Created
August 28, 2013 13:55
-
-
Save codingjester/6366311 to your computer and use it in GitHub Desktop.
Scraping the totalMarketValue of your E*Trade account. Probably could be better. You pass in your username/password as arguments to the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
a = Mechanize.new | |
a.get('https://us.etrade.com/home') do |page| | |
mypage = page.form_with(:action => '/login.fcc') do |f| | |
f.USER = ARGV[0] | |
f.PASSWORD = ARGV[1] | |
end.click_button | |
end | |
body = a.get("https://us.etrade.com/e/t/stockplan/overview?ploc=c-MainNav").body | |
result = body.split("\n").grep(/summaryWidget\.totalMarketValueRaw/).first | |
value = result.strip!.split(" = ")[1].gsub(/[";]/, '') | |
puts value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment