Finance-MtGox
view release on metacpan or search on metacpan
lib/Finance/MtGox.pm view on Meta::CPAN
# 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' );
=head1 BASIC METHODS
=head2 new
Create a new C<Finance::MtGox> object with your MtGox credentials provided
in the C<key> and C<secret> arguments.
=cut
sub new {
my ( $class, $args ) = @_;
$args->{key} && $args->{secret}
or croak "You must provide 'key' and 'secret' credentials.";
$args->{json} = JSON::Any->new;
$args->{mech} = WWW::Mechanize->new(stack_depth => 0);
return bless $args, $class;
}
=head2 call( $name )
Run the API call named C<$name>. Returns a Perl data structure
( run in 0.252 second using v1.01-cache-2.11-cpan-4d50c553e7e )