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.

BitCoin Market Exchange Rate

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
m
marx2k
Voice
Posts: 10
Joined: Sun Jan 23, 2011 10:34 am

BitCoin Market Exchange Rate

Post by marx2k »

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! :D
m
marx2k
Voice
Posts: 10
Joined: Sun Jan 23, 2011 10:34 am

Post by marx2k »

?? nobody?
m
marx2k
Voice
Posts: 10
Joined: Sun Jan 23, 2011 10:34 am

Post by marx2k »

Hm, never mind. I guess mtgox has crapped out and is no longer offering the API I linked to :/
m
marx2k
Voice
Posts: 10
Joined: Sun Jan 23, 2011 10:34 am

Post by marx2k »

They're back!

https://mtgox.com/support/tradeAPI

So... anyone? anyone? Would be awesome!
p
pitbull
Voice
Posts: 13
Joined: Sun Aug 12, 2007 12:12 pm

Post by pitbull »

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: Select all

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"
 
}
k
khalidxpert
Voice
Posts: 18
Joined: Sat Jan 26, 2008 2:03 am

i am unable to install

Post by khalidxpert »

hi there

i am getting error tls please help me to install bitcoin.tcl how i can fix tls problem
k
khalidxpert
Voice
Posts: 18
Joined: Sat Jan 26, 2008 2:03 am

Re: i am unable to install

Post by khalidxpert »

khalidxpert wrote:hi there

i am getting error tls please help me to install bitcoin.tcl how i can fix tls problem
i am also getting tls error any one will help ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

There's nothing that can be fixed at this moment since mtgox.com is down. Find another website that offers this service and we can take it from there.
Once the game is over, the king and the pawn go back in the same box.
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

hmm check out blackshadow's new currency.tcl
Last edited by ComputerTech on Mon Aug 10, 2020 11:22 pm, edited 1 time in total.
ComputerTech
User avatar
Dominatez
Halfop
Posts: 50
Joined: Mon Jan 14, 2019 5:08 pm
Location: United Kingdom

Post by Dominatez »

caesar wrote:There's nothing that can be fixed at this moment since mtgox.com is down. Find another website that offers this service and we can take it from there.
https://www.coingecko.com

They don't even use an api because they say all info should be free.
Post Reply