There is one other script just like this but it's very old and doesn't work anymore, so I took the liberty of writing my own. The usage is very simple:
Note: The output is in yellow because I use a black background and I think it works best, but it can easily be changed. Just change the 8 to whatever color you want.
That's about it, let me know if there are any features I should add.
I was considering adding something that would automatically search for a symbol if none was found..but that could add a few more seconds onto the script.
/*
Stock Information Script by tv3636
Use: /stock [ticker symbol]
Example: /stock GOOG
That's it, let me know if there's any more info I should add or any info I should remove.
*/
alias stock {
if ($sock(stock.socket)) .sockclose stock.socket
set %stock.name $1
sockopen stock.socket finance.yahoo.com 80
}
on *:SOCKOPEN:stock.socket: {
sockwrite -nt $sockname GET /q?s= $+ %stock.name HTTP/1.1
sockwrite -nt $sockname Host: finance.yahoo.com
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:stock.socket: {
if ($sockerr) {
echo $active Sockread error, try again!
}
else {
sockread %stockread
if (<span id="yfs_l91 isin %stockread || The document has moved isin %stockread || <span id="yfs_l90 isin %stockread ) {
if (<span id="yfs_l91 isin %stockread) {
set %stock.realprice $between(%stockread,<span id="yfs_l91_ $+ %stock.name $+ ">,</span>,1)
echo $active 8Real Time Price of $upper(%stock.name) $+ : $ $+ %stock.realprice
}
elseif (The document has moved isin %stockread) {
echo $active 8Sorry, no price found for $upper(%stock.name) $+ .
}
else {
set %stock.realprice $between(%stockread,<span id="yfs_l90_ $+ %stock.name $+ ">,</span>,1)
echo $active 8Real Time Price of $upper(%stock.name) $+ : $ $+ %stock.realprice
}
sockclose stock.socket
}
}
}
alias between {
noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi)
return $regml($4)
}