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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
i
iRoc
Post
by iRoc » Sun Jan 16, 2011 1:49 pm
hi
i need a !trigger script of stock exchange .. for example !dse ucbl
after the trigger it will show
Code: Select all
Market Status: Closed
Company Name: UNITED COMMERCIAL BANK LTD.
Last Trade 222.50
Last Update Jan 16, 2011 at 17:25:45
Change -2.4 -1.07%
Open Price 226.0
Yesterday Close 224.9
Day's Range 217.1 - 227.5
Market Lot 50
username
Op
Posts: 196 Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:
Post
by username » Mon Jan 17, 2011 5:34 am
Test this:
<@tvrsh> !trigger ucbl
<+bionic> Market Status: Closed
<+bionic> Company Name: UNITED COMMERCIAL BANK LTD.
<+bionic> Last Trade: 208.70
<+bionic> Last Update: Jan 18, 2011 at 15:48:30
<+bionic> Change: -9.3 -4.27%
<+bionic> Open Price: 218.0
<+bionic> Yesterday Close: 218.0
<+bionic> Day's Range: 208.2 - 219.0
<+bionic> Market Lot: 50
<+bionic> Trading Code: UCBL
<+bionic> Company No: 11108
<+bionic> Business Segment: Bank
Code: Select all
set stock(pref) "!"
set stock(commands) "trigger"
set stock(time) 10
set stock(page) http://www.dsebd.org/displayCompany.php?name=
package require http
foreach bind [split $stock(commands) " "] {
bind pub -|- $stock(pref)$bind stock_pub
bind msg -|- $stock(pref)$bind stock_msg
}
proc stock_msg {nick uhost hand text} {
stock_stock $nick $uhost $hand $nick $text
}
proc stock_pub {nick uhost hand chan text} {
stock_stock $nick $uhost $hand $chan $text
}
proc stock_stock {nick uhost hand chan text} {
global stock lastbind
set text [lindex [split $text] 0]
set agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
set stock_tok [::http::config -useragent $agent]
set stock_tok [::http::geturl "$stock(page)$text" -timeout 30000]
set data [::http::data $stock_tok]
::http::cleanup $stock_tok
regsub -all -- {\n} $data "" data
regsub -all -- { } $data " " data
regsub -all -- {\s+} $data " " data
set mstatus ""; set cname ""; set ltrade ""; set lupddate ""
set change ""; set oprice ""; set yclose ""; set drange ""
set mlot ""; set tcode ""; set cno ""; set bsegment ""
regexp {Market Status:(.*?)</font>} $data "" mstatus
regexp {Company Name</font>:(.*?)</font>} $data "" cname
regsub -all -- {\<[^\>]*\>} $cname "" cname
regexp {Last Trade</font>(.*?)<tr>} $data "" ltrade
regsub -all -- {\<[^\>]*\>} $ltrade "" ltrade
regexp {Last Update</font>(.*?)<tr>} $data "" lupdate
regsub -all -- {\<[^\>]*\>} $lupdate "" lupdate
regexp {Change</font>(.*?)</table>} $data "" change
regsub -all -- {\<[^\>]*\>} $change "" change
regexp {Open Price</font>(.*?)<tr>} $data "" oprice
regsub -all -- {\<[^\>]*\>} $oprice "" oprice
regexp {Yesterday Close</font>(.*?)</table>} $data "" yclose
regsub -all -- {\<[^\>]*\>} $yclose "" yclose
regexp {Day's Range</font>(.*?)<tr>} $data "" drange
regsub -all -- {\<[^\>]*\>} $drange "" drange
regexp {Market Lot</font>(.*?)<tr>} $data "" mlot
regsub -all -- {\<[^\>]*\>} $mlot "" mlot
regexp {Trading Code:(.*?)</font>} $data "" tcode
regexp {Company No:(.*?)</font>} $data "" cno
regexp {Business Segment</font>(.*?)</table>} $data "" bsegment
regsub -all -- {\<[^\>]*\>} $bsegment "" bsegment
putserv "PRIVMSG $chan :Market Status: $mstatus"
putserv "PRIVMSG $chan :Company Name: $cname"
putserv "PRIVMSG $chan :Last Trade: $ltrade"
putserv "PRIVMSG $chan :Last Update: $lupdate"
putserv "PRIVMSG $chan :Change: $change"
putserv "PRIVMSG $chan :Open Price: $oprice"
putserv "PRIVMSG $chan :Yesterday Close: $yclose"
putserv "PRIVMSG $chan :Day's Range: $drange"
putserv "PRIVMSG $chan :Market Lot: $mlot"
putserv "PRIVMSG $chan :Trading Code: $tcode"
putserv "PRIVMSG $chan :Company No: $cno"
putserv "PRIVMSG $chan :Business Segment: $bsegment"
}
putlog "stock.tcl loaded..."
Last edited by
username on Tue Jan 18, 2011 5:50 am, edited 1 time in total.
i
iRoc
Post
by iRoc » Tue Jan 18, 2011 4:50 am
thx You So Much Brother
add new line pls
Code: Select all
Trading Code: UCBL
Company No: 11108
Business Segment Bank
username
Op
Posts: 196 Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:
Post
by username » Tue Jan 18, 2011 5:52 am
Updated.
Now you need to use !trigger <Trading Code> to look statistics for any company.
i
iRoc
Post
by iRoc » Tue Jan 18, 2011 6:46 am
woww thx again bro )) very nice work
i
iRoc
Post
by iRoc » Tue Jan 18, 2011 2:44 pm
username bro..
i want a tcl which will instantly show the Live Stock Quote updates of the rise and fall of a share
username
Op
Posts: 196 Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:
Post
by username » Sun Jan 23, 2011 10:40 am
You need all this lines?
1JANATAMF [DOWN] [10.00] (-0.70) (-6.54%)
1STBSRS [DOWN] [1750.00] (-31.25) (-1.75%)
1STPRIMFMF [DOWN] [29.00] (-3.10) (-9.66%)
ABBANK [DOWN] [1200.00] (-162.75) (-11.94%)
ACI [DOWN] [310.00] (-12.30) (-3.82%)
...
i
iRoc
Post
by iRoc » Sun Jan 23, 2011 10:51 am
yes brother
username
Op
Posts: 196 Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:
Post
by username » Sun Jan 23, 2011 1:28 pm
Test this:
<tvrsh> !trigger
<@bionic> Usage: !trigger <number of lines to show>
<tvrsh> !trigger 7
<@bionic> 1JANATAMF [DOWN] [10.00] (-0.70) (-6.54%)
<@bionic> 1STBSRS [DOWN] [1750.00] (-31.25) (-1.75%)
<@bionic> 1STPRIMFMF [DOWN] [29.00] (-3.10) (-9.66%)
<@bionic> ABBANK [DOWN] [1200.00] (-162.75) (-11.94%)
<@bionic> ACI [DOWN] [310.00] (-12.30) (-3.82%)
<@bionic> ACIFORMULA [DOWN] [111.00] (-8.00) (-6.72%)
<@bionic> ACIZCBOND [DOWN] [762.50] (-36.00) (-4.51%)
Code: Select all
set stock2(pref) "!"
set stock2(commands) "trigger"
set stock2(time) 10
set stock2(page) http://m.dsemonitor.com
package require http
foreach bind [split $stock2(commands) " "] {
bind pub -|- $stock2(pref)$bind stock2_pub
bind msg -|- $stock2(pref)$bind stock2_msg
}
proc stock2_msg {nick uhost hand text} {
stock2_stock2 $nick $uhost $hand $nick $text
}
proc stock2_pub {nick uhost hand chan text} {
stock2_stock2 $nick $uhost $hand $chan $text
}
proc stock2_stock2 {nick uhost hand chan text} {
global stock2 lastbind
set text [lindex [split $text] 0]
if {![isnumber $text]} {
putserv "PRIVMSG $chan :Usage: \002$lastbind\002 <number of lines to show>"
return 0
}
set agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
set stock2_tok [::http::config -useragent $agent]
set stock2_tok [::http::geturl "$stock2(page)" -timeout 30000]
set data [::http::data $stock2_tok]
::http::cleanup $stock2_tok
regexp {<div class='quote'>(.*?)<div id='market_status'>} $data "" data
regsub -all -- {<div class='quote'>} $data "|" data
regsub -all -- {\<[^\>]*\>} $data "" data
set i 0
foreach line [split $data "|"] {
if {$i < $text} {
putserv "PRIVMSG $chan :$line"
incr i
} else { return 0 }
}
}
putlog "stock2.tcl loaded..."
i
iRoc
Post
by iRoc » Sun Jan 23, 2011 3:22 pm
[01:21:44] Tcl error [stock2_pub]: invalid command name "isnumber"
username
Op
Posts: 196 Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:
Post
by username » Sun Jan 23, 2011 3:26 pm
You need to load alltools.tcl and compat.tcl before all other scripts.
i
iRoc
Post
by iRoc » Wed Feb 02, 2011 5:08 pm
Thanks
marx2k
Voice
Posts: 10 Joined: Sun Jan 23, 2011 10:34 am
Post
by marx2k » Tue Apr 26, 2011 10:13 am
username, is this still working?
I tried this today.
[09:11] < me> !squote vforx
[09:11] <@my_bot> Market Status: Closed
[09:11] <@my_bot> Company Name:
[09:11] <@my_bot> Last Trade: Not Traded Today
[09:11] <@my_bot> Last Update: Apr 26, 2011 at 17:22:01
[09:11] <@my_bot> Change: Not Traded Today Not Traded Today
[09:11] <@my_bot> Open Price: Not Traded Today
[09:11] <@my_bot> Yesterday Close: Not Traded Today
[09:11] <@my_bot> Day's Range: 0.0 - 0.0
[09:11] <@my_bot> Market Lot:
[09:11] <@my_bot> Trading Code:
[09:11] <@my_bot> Company No:
[09:11] <@my_bot> Business Segment:
marx2k
Voice
Posts: 10 Joined: Sun Jan 23, 2011 10:34 am
Post
by marx2k » Tue Apr 26, 2011 10:19 am
Disregard. I didn't realize this was not for US stock exchanges. Something like this (with this level of detail) would be great for US stock exchanges.