| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Finance::GDAX::API::Fill; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
3
|
1
|
|
|
1
|
|
17826
|
use 5.20.0; |
|
|
1
|
|
|
|
|
2
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
5
|
1
|
|
|
1
|
|
391
|
use Moose; |
|
|
1
|
|
|
|
|
421376
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
1
|
|
|
1
|
|
9120
|
use Finance::GDAX::API; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
41
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Finance::GDAX::API'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'order_id' => (is => 'rw', |
|
12
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
has 'product_id' => (is => 'rw', |
|
15
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get { |
|
19
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
20
|
0
|
|
|
|
|
|
my @qparams; |
|
21
|
0
|
|
|
|
|
|
my $path = '/fills'; |
|
22
|
0
|
0
|
|
|
|
|
push @qparams, 'order_id=' . $self->order_id if $self->order_id; |
|
23
|
0
|
0
|
|
|
|
|
push @qparams, 'product_id=' . $self->product_id if $self->product_id; |
|
24
|
0
|
0
|
|
|
|
|
if (scalar @qparams) { |
|
25
|
0
|
|
|
|
|
|
$path .= '?' . join('&', @qparams); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
0
|
|
|
|
|
|
$self->method('GET'); |
|
28
|
0
|
|
|
|
|
|
$self->path($path); |
|
29
|
0
|
|
|
|
|
|
return $self->send; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
33
|
|
|
|
|
|
|
1; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Finance::GDAX::API::Fill - Retrieve GDAX fill orders |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use Finance::GDAX::API::Fill; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Get all fills for a given $orderid |
|
45
|
|
|
|
|
|
|
$fills = Finance::GDAX::API::Fill->new(order_id => $orderid)->get; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Get all fills for a given $productid |
|
48
|
|
|
|
|
|
|
$gdax_fills = Finance::GDAX::API::Fill->new; |
|
49
|
|
|
|
|
|
|
$gdax_fills->product_id($productid); |
|
50
|
|
|
|
|
|
|
$fills = $gdax_fills->get; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Or get all of them |
|
53
|
|
|
|
|
|
|
$gdax_fills = Finance::GDAX::API::Fill->new; |
|
54
|
|
|
|
|
|
|
$fills = $gdax_fills->get; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 DESCRIPTION |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Returns an array of recent fills to orders. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The ATTRIBUTES may be set to limit what is returned. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The returned array according to current API docs should look like |
|
63
|
|
|
|
|
|
|
this: |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
[ |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
|
|
|
|
|
|
"trade_id": 74, |
|
68
|
|
|
|
|
|
|
"product_id": "BTC-USD", |
|
69
|
|
|
|
|
|
|
"price": "10.00", |
|
70
|
|
|
|
|
|
|
"size": "0.01", |
|
71
|
|
|
|
|
|
|
"order_id": "d50ec984-77a8-460a-b958-66f114b0de9b", |
|
72
|
|
|
|
|
|
|
"created_at": "2014-11-07T22:19:28.578544Z", |
|
73
|
|
|
|
|
|
|
"liquidity": "T", |
|
74
|
|
|
|
|
|
|
"fee": "0.00025", |
|
75
|
|
|
|
|
|
|
"settled": true, |
|
76
|
|
|
|
|
|
|
"side": "buy" |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
] |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Also from the API docs: |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head3 Settlement and Fees |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Fees are recorded in two stages. Immediately after the matching engine |
|
87
|
|
|
|
|
|
|
completes a match, the fill is inserted into our datastore. Once the |
|
88
|
|
|
|
|
|
|
fill is recorded, a settlement process will settle the fill and credit |
|
89
|
|
|
|
|
|
|
both trading counterparties. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The fee field indicates the fees charged for this individual fill. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head3 Liquidity |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
The liquidity field indicates if the fill was the result of a |
|
100
|
|
|
|
|
|
|
liquidity provider or liquidity taker. M indicates Maker and T |
|
101
|
|
|
|
|
|
|
indicates Taker. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 C<order_id> |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
An order ID as generated by the GDAX exchange. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 C<product_id> |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
A GDAX exchange product id. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 METHODS |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 C<get> |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Returns an array of "recent" fills. This array can be limited by |
|
120
|
|
|
|
|
|
|
specifying an order_id attribute or a product_id attribute. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See the DESCRIPTION for an example return structure. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Although the API supports pagination, this API currently does not |
|
125
|
|
|
|
|
|
|
support it, and only the first page of the results will be returned |
|
126
|
|
|
|
|
|
|
(as sorted by largest trade_id) |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Mark Rushing <mark@orbislumen.net> |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Home Grown Systems, SPC. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
139
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
|
142
|
|
|
|
|
|
|
|