Finance::MtGox - trade Bitcoin with the MtGox API
Version 0.50
use Finance::MtGox; my $mtgox = Finance::MtGox->new({ key => 'api key', secret => 'api secret' }); # unauthenticated API calls my $depth = $mtgox->call('getDepth'); # authenticated API calls my $funds = $mtgox->call_auth('generic/info'); # convenience methods built on the core API my ( $btcs, $usds ) = $mtgox->balances; my $rate = $mtgox->clearing_rate( 'asks', 200, 'BTC' ); $rate = $mtgox->clearing_rate( 'bids', 42, 'USD' );
Create a new Finance::MtGox object with your MtGox credentials provided in the key and secret arguments.
Finance::MtGox
key
secret
Run the API call named $name. Returns a Perl data structure representing the JSON returned from MtGox.
$name
Run the API call named $name with arguments provided by the hashref $args. Returns a Perl data structure representing the JSON returned from MtGox
$args
Returns a list with current BTC and $currency account balances, respectively. If $currency is not specified it defaults to USD.
$currency
Traverse the current "asks" or "bids" ($side) on the order book until the given amount of currency has been consumed. Returns the resulting market clearing rate. This method is useful when trying to determine how much you'd have to pay to purchase $40 worth of BTC:
$side
my $rate = $mtgox->clearing_rate( 'asks', 40, 'USD' );
Similar code for determining the rate to sell 40 BTC:
my $rate = $mtgox->clearing_rate( 'bids', 40, 'BTC' );
Dark pool orders are not considered since they're not visible on the order book.
Returns a volume-weighted USD price per BTC based on MtGox trades within the last 24 hours. Returns undef if there have been no trades in the last 24 hours.
undef
Michael Hendricks, <michael@ndrix.org>
<michael@ndrix.org>
Please report any bugs or feature requests through the web interface at https://github.com/mndrix/Finance-MtGox/issues.
You can find documentation for this module with the perldoc command.
perldoc Finance::MtGox
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Finance-MtGox
CPAN Ratings
http://cpanratings.perl.org/d/Finance-MtGox
Search CPAN
http://search.cpan.org/dist/Finance-MtGox/
Copyright 2011 Michael Hendricks.
This program is distributed under the MIT (X11) License: http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
To install Finance::MtGox, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::MtGox
CPAN shell
perl -MCPAN -e shell install Finance::MtGox
For more information on module installation, please visit the detailed CPAN module installation guide.