line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Crypto::Exchange::Kraken::REST::Private::User::Data; |
2
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Role for Kraken "Prive user data" API calls |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
768
|
use Moose::Role; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
requires qw( |
8
|
|
|
|
|
|
|
_private |
9
|
|
|
|
|
|
|
call |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5531
|
use Types::Standard qw(Bool Int Str Enum); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
13
|
1
|
|
|
1
|
|
987
|
use Params::ValidationCompiler qw(validation_for); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1158
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_account_balance { |
16
|
1
|
|
|
1
|
1
|
15174
|
my $self = shift; |
17
|
1
|
|
|
|
|
11
|
my $req = $self->_private('Balance', @_); |
18
|
1
|
|
|
|
|
6
|
return $self->call($req); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
{ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $validator = validation_for( |
24
|
|
|
|
|
|
|
name => 'get_trade_balance', |
25
|
|
|
|
|
|
|
params => { |
26
|
|
|
|
|
|
|
aclass => { |
27
|
|
|
|
|
|
|
type => Enum [qw(currency)], |
28
|
|
|
|
|
|
|
optional => 1, |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
asset => { type => Str, optional => 1 }, |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub get_trade_balance { |
35
|
2
|
|
|
2
|
1
|
15321
|
my $self = shift; |
36
|
2
|
|
|
|
|
59
|
my %args = $validator->(@_); |
37
|
2
|
|
|
|
|
87
|
my $req = $self->_private('TradeBalance', %args); |
38
|
2
|
|
|
|
|
11
|
return $self->call($req); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
{ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $validator = validation_for( |
45
|
|
|
|
|
|
|
name => 'get_open_orders', |
46
|
|
|
|
|
|
|
params => { |
47
|
|
|
|
|
|
|
trades => { |
48
|
|
|
|
|
|
|
type => Bool, |
49
|
|
|
|
|
|
|
optional => 1, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
userref => { |
52
|
|
|
|
|
|
|
type => Str, |
53
|
|
|
|
|
|
|
optional => 1, |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub get_open_orders { |
59
|
2
|
|
|
2
|
1
|
14916
|
my $self = shift; |
60
|
2
|
|
|
|
|
60
|
my %args = $validator->(@_); |
61
|
2
|
|
|
|
|
75
|
my $req = $self->_private('OpenOrders', %args); |
62
|
2
|
|
|
|
|
12
|
return $self->call($req); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
my $validator = validation_for( |
68
|
|
|
|
|
|
|
name => 'get_closed_orders', |
69
|
|
|
|
|
|
|
params => { |
70
|
|
|
|
|
|
|
ofs => { type => Int, }, |
71
|
|
|
|
|
|
|
trades => { |
72
|
|
|
|
|
|
|
type => Bool, |
73
|
|
|
|
|
|
|
optional => 1, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
userref => { |
76
|
|
|
|
|
|
|
type => Str, |
77
|
|
|
|
|
|
|
optional => 1, |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
start => { |
80
|
|
|
|
|
|
|
type => Int, |
81
|
|
|
|
|
|
|
optional => 1, |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
end => { |
84
|
|
|
|
|
|
|
type => Int, |
85
|
|
|
|
|
|
|
optional => 1, |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
closetime => { |
88
|
|
|
|
|
|
|
type => Enum [qw(open close both)], |
89
|
|
|
|
|
|
|
optional => 1, |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
}, |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub get_closed_orders { |
95
|
2
|
|
|
2
|
1
|
15155
|
my $self = shift; |
96
|
2
|
|
|
|
|
60
|
my %args = $validator->(@_); |
97
|
2
|
|
|
|
|
141
|
my $req = $self->_private('ClosedOrders', %args); |
98
|
2
|
|
|
|
|
14
|
return $self->call($req); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
{ |
103
|
|
|
|
|
|
|
my $validator = validation_for( |
104
|
|
|
|
|
|
|
name => 'query_orders_info', |
105
|
|
|
|
|
|
|
params => { |
106
|
|
|
|
|
|
|
trades => { |
107
|
|
|
|
|
|
|
type => Bool, |
108
|
|
|
|
|
|
|
optional => 1, |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
userref => { |
111
|
|
|
|
|
|
|
type => Str, |
112
|
|
|
|
|
|
|
optional => 1, |
113
|
|
|
|
|
|
|
}, |
114
|
|
|
|
|
|
|
txid => { |
115
|
|
|
|
|
|
|
type => Str, |
116
|
|
|
|
|
|
|
optional => 1, |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub query_orders_info { |
122
|
2
|
|
|
2
|
1
|
15306
|
my $self = shift; |
123
|
2
|
|
|
|
|
65
|
my %args = $validator->(@_); |
124
|
2
|
|
|
|
|
91
|
my $req = $self->_private('QueryOrders', %args); |
125
|
2
|
|
|
|
|
12
|
return $self->call($req); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
{ |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my $validator = validation_for( |
132
|
|
|
|
|
|
|
name => 'get_trades_history', |
133
|
|
|
|
|
|
|
params => { |
134
|
|
|
|
|
|
|
ofs => { type => Int, }, |
135
|
|
|
|
|
|
|
types => { |
136
|
|
|
|
|
|
|
type => Enum [ |
137
|
|
|
|
|
|
|
( |
138
|
|
|
|
|
|
|
'all', |
139
|
|
|
|
|
|
|
'any position', |
140
|
|
|
|
|
|
|
'closed position', |
141
|
|
|
|
|
|
|
'closing position', |
142
|
|
|
|
|
|
|
'no position', |
143
|
|
|
|
|
|
|
) |
144
|
|
|
|
|
|
|
], |
145
|
|
|
|
|
|
|
optional => 1, |
146
|
|
|
|
|
|
|
}, |
147
|
|
|
|
|
|
|
trades => { |
148
|
|
|
|
|
|
|
type => Bool, |
149
|
|
|
|
|
|
|
optional => 1, |
150
|
|
|
|
|
|
|
}, |
151
|
|
|
|
|
|
|
start => { |
152
|
|
|
|
|
|
|
type => Int, |
153
|
|
|
|
|
|
|
optional => 1, |
154
|
|
|
|
|
|
|
}, |
155
|
|
|
|
|
|
|
end => { |
156
|
|
|
|
|
|
|
type => Int, |
157
|
|
|
|
|
|
|
optional => 1, |
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
}, |
160
|
|
|
|
|
|
|
); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub get_trades_history { |
163
|
2
|
|
|
2
|
1
|
16291
|
my $self = shift; |
164
|
2
|
|
|
|
|
85
|
my %args = $validator->(@_); |
165
|
2
|
|
|
|
|
134
|
my $req = $self->_private('TradesHistory', %args); |
166
|
2
|
|
|
|
|
14
|
return $self->call($req); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub query_trades_info { |
172
|
1
|
|
|
1
|
1
|
7720
|
my $self = shift; |
173
|
1
|
|
|
|
|
7
|
my $req = $self->_private('QueryTrades', @_); |
174
|
1
|
|
|
|
|
6
|
return $self->call($req); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub get_open_positions { |
178
|
1
|
|
|
1
|
1
|
7504
|
my $self = shift; |
179
|
1
|
|
|
|
|
7
|
my $req = $self->_private('OpenPositions', @_); |
180
|
1
|
|
|
|
|
5
|
return $self->call($req); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub get_ledger_info { |
184
|
1
|
|
|
1
|
1
|
7460
|
my $self = shift; |
185
|
1
|
|
|
|
|
7
|
my $req = $self->_private('Ledgers', @_); |
186
|
1
|
|
|
|
|
6
|
return $self->call($req); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub query_ledgers { |
190
|
1
|
|
|
1
|
1
|
7701
|
my $self = shift; |
191
|
1
|
|
|
|
|
8
|
my $req = $self->_private('QueryLedgers', @_); |
192
|
1
|
|
|
|
|
7
|
return $self->call($req); |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub get_trade_volume { |
196
|
1
|
|
|
1
|
1
|
7500
|
my $self = shift; |
197
|
1
|
|
|
|
|
7
|
my $req = $self->_private('TradeVolume', @_); |
198
|
1
|
|
|
|
|
6
|
return $self->call($req); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub request_export_report { |
202
|
1
|
|
|
1
|
1
|
7651
|
my $self = shift; |
203
|
1
|
|
|
|
|
7
|
my $req = $self->_private('AddExport', @_); |
204
|
1
|
|
|
|
|
6
|
return $self->call($req); |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub get_export_status { |
208
|
1
|
|
|
1
|
1
|
7602
|
my $self = shift; |
209
|
1
|
|
|
|
|
6
|
my $req = $self->_private('ExportStatus', @_); |
210
|
1
|
|
|
|
|
6
|
return $self->call($req); |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub get_export_report { |
214
|
1
|
|
|
1
|
1
|
7706
|
my $self = shift; |
215
|
1
|
|
|
|
|
7
|
my $req = $self->_private('RetrieveExport', @_); |
216
|
1
|
|
|
|
|
8
|
return $self->call($req); |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub remove_export_report { |
220
|
1
|
|
|
1
|
1
|
7637
|
my $self = shift; |
221
|
1
|
|
|
|
|
7
|
my $req = $self->_private('RemoveExport', @_); |
222
|
1
|
|
|
|
|
6
|
return $self->call($req); |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
1; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
__END__ |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=pod |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=encoding UTF-8 |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head1 NAME |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Finance::Crypto::Exchange::Kraken::REST::Private::User::Data - Role for Kraken "Prive user data" API calls |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 VERSION |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
version 0.001 |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head1 SYNOPSIS |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
package Foo; |
244
|
|
|
|
|
|
|
use Moose; |
245
|
|
|
|
|
|
|
with qw(Finance::Crypto::Exchange::Kraken::REST::Private::User::Data); |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head1 DESCRIPTION |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
This role implements the Kraken REST API for I<private user data>. For |
250
|
|
|
|
|
|
|
extensive information please have a look at the L<Kraken API |
251
|
|
|
|
|
|
|
manual|https://www.kraken.com/features/api#private-user-data> |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head1 METHODS |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 get_account_balance |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/Balance> |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head2 get_trade_balance |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/TradeBalance> |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 get_open_orders |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/OpenOrders> |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 get_closed_orders |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/ClosedOrders> |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 query_orders_info |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/QueryOrders> |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head2 get_trades_history |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/TradesHistory> |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head2 query_trades_info |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/QueryTrades> |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head2 get_open_positions |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/OpenPositions> |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head2 get_ledger_info |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/Ledgers> |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head2 query_ledgers |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/QueryLedgers> |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head2 get_trade_volume |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/TradeVolume> |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head2 request_export_report |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/AddExport> |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head2 get_export_status |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/ExportStatus> |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head2 get_export_report |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/RetrieveExport> |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head2 remove_export_report |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
L<https://api.kraken.com/0/private/RemoveExport> |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head1 AUTHOR |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Wesley Schwengle. |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
This is free software, licensed under: |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
The (three-clause) BSD License |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=cut |