egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dow not showing in Stock_v1.1 [SOLVED]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
shadrach
Halfop


Joined: 14 Dec 2007
Posts: 74

PostPosted: Tue Aug 11, 2009 3:41 pm    Post subject: dow not showing in Stock_v1.1 [SOLVED] Reply with quote

Every other call works. Can someone see the problem?

UPDATE: error message: [20:04:52] [?????] [15:05] Tcl error [pub:dow]: Illegal characters in URL path

Code:
####################################################################################
# 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)                            :
# ._______________________________________________________________________________.
#
#####################################################################################

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.."


Last edited by shadrach on Thu Aug 20, 2009 2:18 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
shadrach
Halfop


Joined: 14 Dec 2007
Posts: 74

PostPosted: Thu Aug 20, 2009 2:16 am    Post subject: Reply with quote

I managed to fix this myself. Replace the line (157)
Code:
set query "http://download.finance.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=^DJI"
with
Code:
set query "http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv"
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber