| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Finance::Crypto::Exchange::Kraken::REST::Private; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
3
|
1
|
|
|
1
|
|
679
|
use Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6597
|
use Digest::SHA qw(hmac_sha512_base64 sha256); |
|
|
1
|
|
|
|
|
3336
|
|
|
|
1
|
|
|
|
|
101
|
|
|
6
|
1
|
|
|
1
|
|
9
|
use HTTP::Request::Common qw(POST); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
300
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Role for Kraken "private" API calls |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires qw(call nonce has_key has_secret key secret); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _private { |
|
13
|
31
|
|
|
31
|
|
116
|
my ($self, $call, %payload) = @_; |
|
14
|
|
|
|
|
|
|
|
|
15
|
31
|
50
|
|
|
|
1507
|
die "Unable to progress, no key set!" unless $self->has_key; |
|
16
|
31
|
50
|
|
|
|
1266
|
die "Unable to progress, no secret set!" unless $self->has_secret; |
|
17
|
|
|
|
|
|
|
|
|
18
|
31
|
|
|
|
|
1055
|
my $uri = $self->_uri->clone; |
|
19
|
31
|
|
|
|
|
360
|
$uri->path_segments(0, 'private', $call); |
|
20
|
|
|
|
|
|
|
|
|
21
|
31
|
|
|
|
|
2447
|
my $nonce = $payload{nonce} = $self->nonce; |
|
22
|
|
|
|
|
|
|
|
|
23
|
31
|
|
|
|
|
1236
|
my $req = POST($uri, |
|
24
|
|
|
|
|
|
|
Accept => 'application/json', |
|
25
|
|
|
|
|
|
|
Content => [ %payload ], |
|
26
|
|
|
|
|
|
|
'API-Key' => $self->key, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
31
|
|
|
|
|
15940
|
$req->header('API-Sign' => $self->_hmac($uri->path, $nonce, $req->content)); |
|
30
|
|
|
|
|
|
|
|
|
31
|
31
|
|
|
|
|
2091
|
return $req; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _hmac { |
|
35
|
31
|
|
|
31
|
|
769
|
my ($self, $path, $nonce, $content) = @_; |
|
36
|
|
|
|
|
|
|
|
|
37
|
31
|
|
|
|
|
1451
|
return hmac_sha512_base64( |
|
38
|
|
|
|
|
|
|
join("", $path, sha256($nonce, $content), $self->secret)); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
with qw( |
|
42
|
|
|
|
|
|
|
Finance::Crypto::Exchange::Kraken::REST::Private::User::Data |
|
43
|
|
|
|
|
|
|
Finance::Crypto::Exchange::Kraken::REST::Private::User::Trading |
|
44
|
|
|
|
|
|
|
Finance::Crypto::Exchange::Kraken::REST::Private::User::Funding |
|
45
|
|
|
|
|
|
|
Finance::Crypto::Exchange::Kraken::REST::Private::Websockets |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=encoding UTF-8 |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Finance::Crypto::Exchange::Kraken::REST::Private - Role for Kraken "private" API calls |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
version 0.001 |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
package Foo; |
|
67
|
|
|
|
|
|
|
with qw(Finance::Crypto::Exchange::Kraken::REST::Private); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This role introduces all the private API calls Kraken supports. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * L<Finance::Crypto::Exchange::Kraken::REST::Private::User::Data> |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * L<Finance::Crypto::Exchange::Kraken::REST::Private::User::Trading> |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * L<Finance::Crypto::Exchange::Kraken::REST::Private::User::Funding> |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * L<Finance::Crypto::Exchange::Kraken::REST::Private::Websockets> |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Wesley Schwengle. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software, licensed under: |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
The (three-clause) BSD License |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |