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 

stock exchange script help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
iRoc
Guest





PostPosted: Sun Jan 16, 2011 1:49 pm    Post subject: stock exchange script help Reply with quote

hi
i need a !trigger script of stock exchange .. for example !dse ucbl
after the trigger it will show

Code:
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


Quote:
website : http://www.dsebd.org/displayCompany.php?name=UCBL
Back to top
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Mon Jan 17, 2011 5:34 am    Post subject: Reply with quote

Test this:
Quote:
<@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:
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 -- {&nbsp;} $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..."

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/


Last edited by username on Tue Jan 18, 2011 5:50 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
iRoc
Guest





PostPosted: Tue Jan 18, 2011 4:50 am    Post subject: Reply with quote

thx You So Much Brother

add new line pls
Code:

Trading Code: UCBL    
Company No: 11108
Business Segment    Bank
Back to top
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Tue Jan 18, 2011 5:52 am    Post subject: Reply with quote

Updated.
Now you need to use !trigger <Trading Code> to look statistics for any company.
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
iRoc
Guest





PostPosted: Tue Jan 18, 2011 6:46 am    Post subject: Reply with quote

woww thx again bro )) very nice work
Back to top
iRoc
Guest





PostPosted: Tue Jan 18, 2011 2:44 pm    Post subject: Reply with quote

username bro..

i want a tcl which will instantly show the Live Stock Quote updates of the rise and fall of a share

Code:
website : http://m.dsemonitor.com
Back to top
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Sun Jan 23, 2011 10:40 am    Post subject: Reply with quote

You need all this lines?
Quote:
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%)
...

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
iRoc
Guest





PostPosted: Sun Jan 23, 2011 10:51 am    Post subject: Reply with quote

yes brother
Back to top
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Sun Jan 23, 2011 1:28 pm    Post subject: Reply with quote

Test this:
Quote:
<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:
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..."

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
iRoc
Guest





PostPosted: Sun Jan 23, 2011 3:22 pm    Post subject: Reply with quote

[01:21:44] Tcl error [stock2_pub]: invalid command name "isnumber"
Back to top
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Sun Jan 23, 2011 3:26 pm    Post subject: Reply with quote

You need to load alltools.tcl and compat.tcl before all other scripts.
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
iRoc
Guest





PostPosted: Wed Feb 02, 2011 5:08 pm    Post subject: Reply with quote

Thanks
Back to top
marx2k
Voice


Joined: 23 Jan 2011
Posts: 10

PostPosted: Tue Apr 26, 2011 10:13 am    Post subject: Reply with quote

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:
Back to top
View user's profile Send private message
marx2k
Voice


Joined: 23 Jan 2011
Posts: 10

PostPosted: Tue Apr 26, 2011 10:19 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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