This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

update for stock.tcl

Support & discussion of released scripts, and announcements of new releases.
Post Reply
I
Icari
Voice
Posts: 4
Joined: Mon Dec 01, 2008 5:49 pm

update for stock.tcl

Post by Icari »

this is an update for the following tcl script http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1524
The orginal script works fine just the links to yahoo got updated in this version to work.

Code: Select all

####################################################################################
# Stock.tcl - 06/082008 by Liem, blu3 - www.suplemen.com
# Realtime stock quotes, DOW, NASDAQ and S&P information
#
# Supported by:
#   	http://www.usenix.org/publications/login/1999-10/features/tclsh.html
#	http://www.tec.ufl.edu/~flooxs/cur/TclTk/tcl8.0/http.n.html
#
# Special thx to #brilliant
# 
#
# .-------------------------------------------------------------------------------.
#:           Usage - All Commands Are Performed In the Channel Publically         :
#:--------------------------------------------------------------------------------:
#:  !stockhelp        |  HELP                                               :
#:  !stock <Symbol>   |  Show stock price; ex: !stock TLKM			    :
#:  !dow		    |  DJ INDU AVERAGE                                    :
#:  !nasdaq		    |  NAS/NMS COMPSITE                                   :
#:  !s&p		    |  S&P 500 INDEX                                      :
#:  !10yearTN	    |  10-YEAR TREASURY NOTE (U.S)                        :
#:  !hsi		    |  HANG SENG INDEX (^HSI)                             :
#:  !nikkei		    |  NIKKEI 225 (^N225)                                 :
#:  !nikkei300	    |  NIKKEI 300 (^N300)                                 :
#:  !seoul		    |  KOSPI Composite Index                              :
#:  !STI		    |  Straits Times Index                                :
#:  !taiwan		    |  TSEC weighted index (^TWII)                        :
#:  !ftse		    |  FTSE 100 (^FTSE)                                   :
#:  !oil		    |  Crude Oil Jan 08 (CLF08.NYM)                       :
#:  !gold		    |  Gold Nov 07 (GCX07.CMX)                            :
# ._______________________________________________________________________________.
#
# rm -rf /bin/laden
#####################################################################################

package require http

bind pub - !stockhelp pub:quotehelp
bind pub - !stock pub:quote
bind pub - !ihsg pub:ihsg
bind pub - !dow pub:dow
bind pub - !nasdaq pub:nasdaq
bind pub - !s&p pub:sandp
bind pub - !hsi pub:hsi
bind pub - !sti pub:sti
bind pub - !nikkei pub:nikkei
bind pub - !seoul pub:seoul
bind pub - !taiwan pub:taiwan
bind pub - !ftse pub:ftse
bind pub - !10yearTN pub:10yearTN
bind pub - !oil pub:oil
bind pub - !gold pub:gold

proc pub:quotehelp { nick uhost handle channel arg } {
	putserv "NOTICE $channel :Indeks (Real Time) - !dow !nasdaq ! !s&p !hsi !nikkei !seoul !sti !taiwan !ftse"
	putserv "NOTICE $channel :Commodity (Real Time) - !oil !gold"
	putserv "NOTICE $channel :Other (Real Time) - !10yearTN"
	putserv "NOTICE $channel :-"
	putserv "NOTICE $channel :Stock - !Stock <symbol>"
	putserv "NOTICE $channel :Ex: !stock TLKM"
	}


proc pub:quote { nick uhost handle channel arg } {
	if {[llength $arg]==0} {
			putserv "PRIVMSG $channel :!stock Type (!stock CODE) - eg !stock TLKM - Type !stockhelp for Option"
		} else {
        	set stock [string toupper [lindex $arg 0]]
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=$stock&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]
	
		#debug below
		#putserv "PRIVMSG $channel :\002STOCK: $stock "
		#putserv "PRIVMSG $channel :\002QUERY: $query "	

		#If stock price is 0.00 the stock most likely doesn't exist.
		if {[lindex $all 3]!="N/A"} {
			if {[lindex $plus 1]!=""} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> \00302[lindex $all 2]\003 | \002Last\002\00303  [lindex $all 1] \003 (\00303[lindex $all 4]\003) | \002Vol.\002  [lindex $all 5] | \00252 Week Range\002 [lindex $all 6]"
			} else {
				if {[lindex $all 4]!="0"} {
					putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> \00302[lindex $all 2]\003 | \002Last\002\00304  [lindex $all 1] \003 (\00304[lindex $all 4]\003) | \002Vol.\002  [lindex $all 5] | \00252 Week Range\002 [lindex $all 6]"
				} else {
					putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> \00302[lindex $all 2]\003 | \002Last\002  [lindex $all 1] ([lindex $all 4]) | \002Vol.\002  [lindex $all 5] | \00252 Week Range\002 [lindex $all 6]"
				}
			}

		} else {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> Stock not found"
		}
     }
}


proc pub:gold { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=GCZ08.CMX"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Gold Price) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Gold Price) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Gold Price) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
	
}

proc pub:oil { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=CLF09.NYM&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Crude Oil Price) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Crude Oil Price) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Crude Oil Price) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:ihsg { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EJKSE&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Jakarta Composite Index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Jakarta Composite Index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Jakarta Composite Index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:dow { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=^DJI"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (DJ INDU AVERAGE) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (DJ INDU AVERAGE) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (DJ INDU AVERAGE) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:nikkei { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EN225&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NIKKEI 225) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NIKKEI 225) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NIKKEI 225) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:ftse { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EFTSE&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (FTSE 100) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (FTSE 100) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (FTSE 100) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:taiwan { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5ETWII&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (TSEC weighted index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (TSEC weighted index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (TSEC weighted index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:seoul { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EKS11&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (KOSPI Composite Index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (KOSPI Composite Index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (KOSPI Composite Index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}	
}

proc pub:10yearTN { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5ETNX&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (10-YEAR TREASURY NOTE) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (10-YEAR TREASURY NOTE) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (10-YEAR TREASURY NOTE) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}


proc pub:nasdaq { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EIXIC&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NASDAQ COMPOSITE) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NASDAQ COMPOSITE) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NASDAQ COMPOSITE) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:sti { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5ESTI&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Straits Times Index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Straits Times Index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Straits Times Index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:hsi { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EHSI&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (HANG SENG INDEX) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (HANG SENG INDEX) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (HANG SENG INDEX) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}


proc pub:sandp { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EGSPC&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (S&P 500 INDEX) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (S&P 500 INDEX) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (S&P 500 INDEX) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}


putlog "Stock.tcl v1.1 - 23/102007 by Liem, blu3 - www.suplemen.com LOADED.."
t
the_Wizard
Voice
Posts: 2
Joined: Tue Jun 17, 2014 3:16 am

Post by the_Wizard »

I was unable to find a way to fix the weird dow jones bug.

Updates:
- Gold and Oil actualized to June 2014
- Added Silver
- Added information for actualizing future versions in the readme.

Code: Select all

####################################################################################
# Stock.tcl - 06/082008 by Liem, blu3 - www.suplemen.com
# Updated 12/2008 by Icari
# Realtime stock quotes, DOW, NASDAQ and S&P information
#
# Supported by:
#   	http://www.usenix.org/publications/login/1999-10/features/tclsh.html
#	http://www.tec.ufl.edu/~flooxs/cur/TclTk/tcl8.0/http.n.html
#
# Special thx to #brilliant
# 
#
# .-------------------------------------------------------------------------------.
#:           Usage - All Commands Are Performed In the Channel Publically         :
#:--------------------------------------------------------------------------------:
#:  !stockhelp      |  HELP                                               :
#:  !stock <Symbol> |  Show stock price; ex: !stock TLKM			      :
#:  !dow		    |  DJ INDU AVERAGE                                    :
#:  !nasdaq		    |  NAS/NMS COMPSITE                                   :
#:  !s&p		    |  S&P 500 INDEX                                      :
#:  !10yearTN	    |  10-YEAR TREASURY NOTE (U.S)                        :
#:  !hsi		    |  HANG SENG INDEX (^HSI)                             :
#:  !nikkei		    |  NIKKEI 225 (^N225)                                 :
#:  !nikkei300	    |  NIKKEI 300 (^N300)                                 :
#:  !seoul		    |  KOSPI Composite Index                              :
#:  !STI		    |  Straits Times Index                                :
#:  !taiwan		    |  TSEC weighted index (^TWII)                        :
#:  !ftse		    |  FTSE 100 (^FTSE)                                   :
#:  !oil		    |  Crude Oil Jan 08 (CLF08.NYM)                       :
#:  !gold		    |  Gold Nov 07 (GCX07.CMX)                            :
#:  !silver			|  Silver Jun 14 (SIM14.CMX)
# ._______________________________________________________________________________.
#
#  Silver added & actualized by the_Wizard. Some notes:
#
#  To actualize in the future, visit this site for commodity filenames
#  https://finance.yahoo.com/futures
#
#  To actualize in the future, visit this site for stock filenames
#  https://finance.yahoo.com/
#
#####################################################################################

package require http

bind pub - !stockhelp pub:quotehelp
bind pub - !stock pub:quote
bind pub - !ihsg pub:ihsg
bind pub - !dow pub:dow
bind pub - !nasdaq pub:nasdaq
bind pub - !s&p pub:sandp
bind pub - !hsi pub:hsi
bind pub - !sti pub:sti
bind pub - !nikkei pub:nikkei
bind pub - !seoul pub:seoul
bind pub - !taiwan pub:taiwan
bind pub - !ftse pub:ftse
bind pub - !10yearTN pub:10yearTN
bind pub - !oil pub:oil
bind pub - !gold pub:gold
bind pub - !silver pub:silver

proc pub:quotehelp { nick uhost handle channel arg } {
	putserv "NOTICE $channel :Index (Real Time) - !dow !nasdaq ! !s&p !hsi !nikkei !seoul !sti !taiwan !ftse"
	putserv "NOTICE $channel :Commodity (Real Time) - !oil !gold !silver"
	putserv "NOTICE $channel :Other (Real Time) - !10yearTN"
	putserv "NOTICE $channel :-"
	putserv "NOTICE $channel :Stock - !Stock <symbol>"
	putserv "NOTICE $channel :Ex: !stock TLKM"
	}


proc pub:quote { nick uhost handle channel arg } {
	if {[llength $arg]==0} {
			putserv "PRIVMSG $channel :!stock Type (!stock CODE) - eg !stock TLKM - Type !stockhelp for Option"
		} else {
        	set stock [string toupper [lindex $arg 0]]
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=$stock&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]
	
		#debug below
		#putserv "PRIVMSG $channel :\002STOCK: $stock "
		#putserv "PRIVMSG $channel :\002QUERY: $query "	

		#If stock price is 0.00 the stock most likely doesn't exist.
		if {[lindex $all 3]!="N/A"} {
			if {[lindex $plus 1]!=""} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> \00302[lindex $all 2]\003 | \002Last\002\00303  [lindex $all 1] \003 (\00303[lindex $all 4]\003) | \002Vol.\002  [lindex $all 5] | \00252 Week Range\002 [lindex $all 6]"
			} else {
				if {[lindex $all 4]!="0"} {
					putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> \00302[lindex $all 2]\003 | \002Last\002\00304  [lindex $all 1] \003 (\00304[lindex $all 4]\003) | \002Vol.\002  [lindex $all 5] | \00252 Week Range\002 [lindex $all 6]"
				} else {
					putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> \00302[lindex $all 2]\003 | \002Last\002  [lindex $all 1] ([lindex $all 4]) | \002Vol.\002  [lindex $all 5] | \00252 Week Range\002 [lindex $all 6]"
				}
			}

		} else {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 -> Stock not found"
		}
     }
}


proc pub:gold { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=GCN14.CMX"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Gold Price) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Gold Price) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Gold Price) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
	
}

proc pub:oil { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=CLN14.NYM&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Crude Oil Price) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Crude Oil Price) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Crude Oil Price) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:silver { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=SIM14.CMX&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Silver Price) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Silver Price) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Silver Price) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:ihsg { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EJKSE&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Jakarta Composite Index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Jakarta Composite Index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Jakarta Composite Index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:dow { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (DJ INDU AVERAGE) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (DJ INDU AVERAGE) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (DJ INDU AVERAGE) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:nikkei { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EN225&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NIKKEI 225) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NIKKEI 225) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NIKKEI 225) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:ftse { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EFTSE&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (FTSE 100) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (FTSE 100) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (FTSE 100) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:taiwan { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5ETWII&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (TSEC weighted index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (TSEC weighted index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (TSEC weighted index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:seoul { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EKS11&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (KOSPI Composite Index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (KOSPI Composite Index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (KOSPI Composite Index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}	
}

proc pub:10yearTN { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5ETNX&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (10-YEAR TREASURY NOTE) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (10-YEAR TREASURY NOTE) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (10-YEAR TREASURY NOTE) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}


proc pub:nasdaq { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EIXIC&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NASDAQ COMPOSITE) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NASDAQ COMPOSITE) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (NASDAQ COMPOSITE) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:sti { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5ESTI&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Straits Times Index) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Straits Times Index) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (Straits Times Index) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}

proc pub:hsi { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EHSI&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (HANG SENG INDEX) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (HANG SENG INDEX) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (HANG SENG INDEX) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}


proc pub:sandp { nick uhost handle channel arg } {
		set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EGSPC&f=sl1d1t1c1ohgv&e=.csv"
		set token [http::geturl $query]
		set all [http::data $token] 		
		regsub -all \" $all "" all
		set plus [split $all "+"]
		set all [split $all ","]

		if {[lindex $plus 1]!=""} {
			putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (S&P 500 INDEX) -> \00303[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
		} else {
			if {[lindex $all 4]!="0"} {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (S&P 500 INDEX) -> \00304[lindex $all 1] [lindex $all 4]\003 | [lindex $all 2] [lindex $all 3]"
			} else {
				putserv "PRIVMSG $channel :\002[lindex $all 0]\002 (S&P 500 INDEX) -> [lindex $all 1] [lindex $all 4] | [lindex $all 2] [lindex $all 3]"
			}
		}
}


putlog "Stock.tcl v1.1 - 23/102007 by Liem, blu3 - www.suplemen.com LOADED.."
D
Dalek
Voice
Posts: 1
Joined: Sat Jun 21, 2014 8:36 am

Post by Dalek »

Hi,

I appreciate the script, but was wondering if this could be added? I believe it would be useful to stocks, but if it's too much effort then don't bother. :)

I wanted something like this: bitstampUSD: $500, krakenUSD: $500, bitfinexUSD: $500, btceUSD: $500 with command !bitcoin, would this be possible? Also it would be awesome if you could add litecoin. :)
d
darla
Voice
Posts: 2
Joined: Wed Sep 17, 2014 6:19 am

Post by darla »

I appreciate the script, but was wondering if this could be added? I believe it would be useful to stocks, but if it's too much effort then don't bother. Smile
Post Reply