-
-
02 Jun 2014 11:30:23 UTC
- Distribution: Finance-Bank-Kraken
- Module version: 0.3
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (222 / 0 / 0)
- Kwalitee
Bus factor: 0- % Coverage
- License: unknown
- Activity
24 month- Tools
- Download (5.79KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Finance::Bank::Kraken - api.kraken.com connector
VERSION
0.3
SYNOPSIS
require Finance::Bank::Kraken; $api = new Finance::Bank::Kraken; $api->key($mykrakenkey); $api->secret($mykrakensecret); $result = $api->call(Private, $method, [$arg1, $arg2, ..]);
DESCRIPTION
This module allows to connect to the api of the bitcoin market Kraken.
Please see the Kraken API documentation for a catalog of api methods.
METHODS
- $api = new Finance::Bank::Kraken
-
The constructor. Returns a
Finance::Bank::Kraken
object. - $api->key($key)
-
Sets or gets the API key.
- $api->secret($secret)
-
Sets the API secret to
$secret
or returns the API secret base64 decoded. - $result = $api->call(Public, $method)
- $result = $api->call(Private, $method)
- $result = $api->call(Private, $method, [$param1, $param2, ..])
-
Calls the
Public
orPrivate
API method$method
(with the given$params
, where applicable) and returns either the JSON encoded result string or an error message (code
message
).
DEPENDENCIES
EXAMPLES
get current XLTC market price in EUR
use Finance::Bank::Kraken; use JSON; my $kraken = new Finance::Bank::Kraken; my $res = $kraken->call(Public, 'Ticker', ['pair=XLTCZEUR,XXBTZEUR']); printf "1 XLTC is %f EUR\n", from_json($res)->{'result'}->{'XLTCZEUR'}->{'c'}[0] unless $res =~ /^5/;
get XLTC account balance
use Finance::Bank::Kraken; use JSON; my $kraken = new Finance::Bank::Kraken; $kraken->key("mysupersecretkey"); $kraken->secret("mysupersecretsecret"); my $res = $kraken->call(Private, 'Balance'); printf "balance: %f XLTC\n", from_json($res)->{'result'}->{'XLTC'} unless $res =~ /^5/;
Q&A
- Why does
call
return a 404? -
Probably you misspelled the method. Please check the API documentation and keep in mind the methods are case sensitive.
- Why does
call
return a 500? -
Maybe there's a problem with the ssl chain of trust. Either install Mozilla::CA or set (one of) the following environment variables
PERL_LWP_SSL_CA_FILE
,HTTPS_CA_FILE
,PERL_LWP_SSL_CA_PATH
,HTTPS_CA_DIR
. See LWP::UserAgent for details.
AUTHOR and COPYRIGHT
Copyright Philippe Kueck <projects at unixadm dot org>
Module Install Instructions
To install Finance::Bank::Kraken, copy and paste the appropriate command in to your terminal.
cpanm Finance::Bank::Kraken
perl -MCPAN -e shell install Finance::Bank::Kraken
For more information on module installation, please visit the detailed CPAN module installation guide.