Created
September 30, 2008 16:01
-
-
Save bkerley/13858 to your computer and use it in GitHub Desktop.
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
proc stock symbol { | |
set html [unescape_html_entities [wget http://finance.google.com/finance?q=$symbol]]; | |
set cn [html [strip_html [lindex [regexp -all -inline {_companyName = '(.*?)'} $html] 1]]]; | |
set curr [html [strip_html [lindex [regexp -all -inline {<span class="pr".*?>(.*?)<} $html] 1]]]; | |
set chr [regexp -all -inline {<span class="ch[rg]".*?>(.*?)<} $html]; | |
if {[lindex $chr 1] < 0} {set col red} else {set col green}; | |
. "[bold]$curr[bold][color $col on white][html [strip_html [lindex $chr 1]]] [html [strip_html [lindex $chr 3]]][color] [color blue on white]$cn[color]"} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment