Bitcoin Forum

Economy => Service Discussion => Topic started by: mndrix on February 09, 2011, 10:44:19 PM



Title: MtGox API Perl module
Post by: mndrix on February 09, 2011, 10:44:19 PM
I've released Finance::MtGox (http://search.cpan.org/perldoc?Finance::MtGox) which is a Perl interface for the MtGox API.  It's available from the CPAN (http://search.cpan.org/perldoc?Finance::MtGox) and on GitHub (https://github.com/mndrix/Finance-MtGox).  It's basically the code I use in CoinPal (http://coinpal.ndrix.com) factored out to a module so that I can reuse it in some upcoming projects.

One of my favorite features is a method for finding the market clearing rate.  A couple examples:

$rate = $mtgox->clearing_rate( 'asks', 20, 'BTC' );  # rate to buy 20 BTC
$rate = $mtgox->clearing_rate( 'bids', 42, 'USD' );  # rate to sell 42 USD worth of BTC

The code is licensed under the MIT license.


Title: Re: MtGox API Perl module
Post by: Cryptoman on February 09, 2011, 10:58:16 PM
Excellent.  Thanks for releasing this.  Are you going to put a mention in the wiki?


Title: Re: MtGox API Perl module
Post by: mndrix on February 09, 2011, 11:31:09 PM
Excellent.  Thanks for releasing this.  Are you going to put a mention in the wiki?

Good idea.  I've mentioned it on the MtGox page on the wiki (https://en.bitcoin.it/wiki/MtGox).


Title: Re: MtGox API Perl module
Post by: BioMike on April 18, 2011, 05:30:32 AM
I'm building a similar lib in python (hope to release that soon), but I have a question about placing an order and seeing if it got filled when I have multiple orders in my order list. Do I need to iterate through the whole list to see which orders got filled and which didn't?

Wouldn't it be more nice to have a transaction history with timestamps?


Title: Re: MtGox API Perl module
Post by: seanadams on May 17, 2011, 10:05:13 PM
I got this error:
Code:
Error GETing https://mtgox.com/code/data/getDepth.php: read failed:  at /usr/local/share/perl/5.10.0/Finance/MtGox.pm line 74

Fixed by changing both URLs to https://www.mtgox.com/.....

I think the problem with using just mtgox.com is the certificate won't match the hostname.


Title: Re: MtGox API Perl module
Post by: beppu on May 30, 2011, 06:53:44 AM
Damn, I should have searched the forum (and CPAN) before I made WebService::MtGox.

http://forum.bitcoin.org/index.php?topic=10125.0

I actually did search for 'bitcoin' at http://search.cpan.org/ and nothing MtGox-related showed up, so that's why I coded WebService::MtGox.  Had I known you already had this covered, I wouldn't have done my version.

You really need to have the word "bitcoin" somewhere in your documentation.


Title: Re: MtGox API Perl module
Post by: mndrix on October 07, 2011, 08:28:43 PM
I've updated Finance::MtGox (http://search.cpan.org/perldoc?Finance::MtGox) to version 0.02.  This version supports MtGox's new authenticated API requests (the API known as "v0").  It doesn't yet support multiple currencies.

beppu, I've made a note for the next release to include the word "bitcoin" in the CPAN docs.

seanadams, I'm not able to reproduce the certificate problem you saw.  That might have been related to some DNS issues MtGox had around the time you posted.


Title: Re: MtGox API Perl module
Post by: mndrix on November 11, 2011, 04:48:34 PM
I've released Finance::MtGox (http://search.cpan.org/perldoc?Finance::MtGox) version 0.03.  The biggest change is a patch from shockdiode to reduce memory usage when using the module in a long-running process.  There are also some minor cosmetic clean ups.

It should hit your favorite CPAN mirror shortly.