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 

BitCoin Market Exchange Rate

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


Joined: 23 Jan 2011
Posts: 10

PostPosted: Fri Jun 10, 2011 8:23 am    Post subject: BitCoin Market Exchange Rate Reply with quote

It would be amazing if there was a script that would take the BitCoin market exchange rate from MtGox and provide a public trigger to display the data.

Their public API can be used here:
https://mtgox.com/support/tradeAPI

Speicifically, ticker JSON results can be attained from :
http://mtgox.com/code/data/ticker.php

Perhaps a public trigger such as: !bc

Information can look like:
BitCoin Last Trade Data -- High: 31.5, Low: 25.626, Vol: 44193, Buy: 26.6, Sell: 26.7899, Last: 26.79

Perhaps have it configurable for single or multi-line.

Also... colors! Very Happy
Back to top
View user's profile Send private message
marx2k
Voice


Joined: 23 Jan 2011
Posts: 10

PostPosted: Fri Jun 24, 2011 7:11 pm    Post subject: Reply with quote

?? nobody?
Back to top
View user's profile Send private message
marx2k
Voice


Joined: 23 Jan 2011
Posts: 10

PostPosted: Fri Jun 24, 2011 10:19 pm    Post subject: Reply with quote

Hm, never mind. I guess mtgox has crapped out and is no longer offering the API I linked to :/
Back to top
View user's profile Send private message
marx2k
Voice


Joined: 23 Jan 2011
Posts: 10

PostPosted: Sat Jul 02, 2011 11:39 am    Post subject: Reply with quote

They're back!

https://mtgox.com/support/tradeAPI

So... anyone? anyone? Would be awesome!
Back to top
View user's profile Send private message
pitbull
Voice


Joined: 12 Aug 2007
Posts: 13

PostPosted: Sat Dec 31, 2011 9:45 pm    Post subject: Reply with quote

Here's something I scratched together to do this in our chan. Thanks to speechless for the http/ssl part (the bulk of the code, really).

Code:
package require http
package require tls
http::register https 443 [list ::tls::socket -require 0 -request 1]

proc s:wget { url } {
   http::config -useragent "Mozilla/EggdropWget"
   catch {set token [http::geturl $url -binary 1 -timeout 10000]} error
   if {![string match -nocase "::http::*" $error]} {
      s:debug "Error: [string totitle [string map {"\n" " | "} $error]] \( $url \)"
      return 0
   }
   if {![string equal -nocase [::http::status $token] "ok"]} {
      s:debug "Http error: [string totitle [::http::status $token]] \( $url \)"
      http::cleanup $token
      return 0
   }
   if {[string match "*[http::ncode $token]*" "303|302|301" ]} {
      upvar #0 $token state
      foreach {name value} $state(meta) {
         if {[regexp -nocase ^location$ $name]} {
            if {![string match "http*" $value]} {
               if {![string match "/" [string index $value 0]]} {
                  set value "[join [lrange [split $url "/"] 0 2] "/"]/$value"
               } else {
                  set value "[join [lrange [split $url "/"] 0 2] "/"]$value"
               }
            }
            s:wget $value
            return
         }
      }
   }
   if {[string match 4* [http::ncode $token]] || [string match 5* [http::ncode $token]]} {
      s:debug "Http resource is not evailable: [http::ncode $token] \( $url \)"
      return 0
   }
    set data [http::data $token]
    http::cleanup $token
    return $data
}

bind pub - !btc get_bitcoin
proc get_bitcoin {nick uhost handle chan arg} {
   set data2 [s:wget https://mtgox.com/api/0/data/ticker.php]
   set btc [regexp {high\":(.*?),\"low\":(.*?),\"avg\":(.*?),\"vwap\":.*?,\"vol\":(.*?),\"last_all\":.*?,\"last_local\":.*?,\"last\":.*?,\"buy\":(.*?),\"sell\":(.*?)\}} $data2 match btchigh btclow btcavg btcvol btcbuy btcsell]
   putserv "PRIVMSG $chan :\002Bitcoin Market Data\002 (MtGox): High: \$$btchigh Low: \$$btclow Volume: $btcvol Buy: \$$btcbuy Sell: \$$btcsell"
 
}

_________________
irc://irc.efnet.net/peakoil
Back to top
View user's profile Send private message
khalidxpert
Voice


Joined: 26 Jan 2008
Posts: 17

PostPosted: Fri Mar 23, 2018 12:24 pm    Post subject: i am unable to install Reply with quote

hi there

i am getting error tls please help me to install bitcoin.tcl how i can fix tls problem
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