line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::ACATS::Transfer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::ACATS::Transfer - Represents a ACATS Transfer |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Finance::Robinhood; |
14
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
15
|
|
|
|
|
|
|
my $transfers = $rh->acats_transfters(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
for my $transfer ($transferss->all) { |
18
|
|
|
|
|
|
|
CORE::say 'ACATS transfer from ' . $transfer->contra_brokerage_name; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.92_003'; |
24
|
1
|
|
|
1
|
|
16960
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
25
|
1
|
|
|
1
|
|
256
|
use Mojo::URL; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
26
|
1
|
|
|
1
|
|
469
|
use Finance::Robinhood::ACATS::Transfer::Position; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _test__init { |
29
|
1
|
|
|
1
|
|
8664
|
my $rh = t::Utility::rh_instance(1); |
30
|
0
|
|
|
|
|
0
|
my $transfer = $rh->acats_transfers->current; |
31
|
0
|
0
|
|
|
|
0
|
skip_all('No ACATS transfers found') if !defined $transfer; |
32
|
0
|
|
|
|
|
0
|
isa_ok($transfer, __PACKAGE__); |
33
|
0
|
|
|
|
|
0
|
t::Utility::stash('TRANSFER', $transfer); # Store it for later |
34
|
|
|
|
|
|
|
} |
35
|
1
|
|
|
1
|
|
151
|
use overload '""' => sub ($s, @) { $s->{url} }, fallback => 1; |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _test_stringify { |
38
|
1
|
|
50
|
1
|
|
2173
|
t::Utility::stash('TRANSFER') // skip_all(); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#is( |
41
|
|
|
|
|
|
|
# +t::Utility::stash('TRANSFER'), |
42
|
|
|
|
|
|
|
# 'https://api.robinhood.com//', |
43
|
|
|
|
|
|
|
#); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 C |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 C |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 C |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 C |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 C |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 C |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 C |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 C |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
has ['cash_value', 'contra_account_number', |
91
|
|
|
|
|
|
|
'contra_brokerage_name', 'failure_reason', |
92
|
|
|
|
|
|
|
'fees_reimbursed', 'id', |
93
|
|
|
|
|
|
|
'replaced_by', 'state', |
94
|
|
|
|
|
|
|
'transfer_type' |
95
|
|
|
|
|
|
|
]; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 C |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
If the transfer can be cancelled, this method will do it. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
0
|
1
|
|
sub cancel($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
104
|
0
|
|
0
|
|
|
|
$s->{cancel} // return !1; |
105
|
0
|
|
|
|
|
|
my $res = $s->_rh->_post($s->{cancel}); |
106
|
0
|
0
|
|
|
|
|
return $res->is_success |
|
|
0
|
|
|
|
|
|
107
|
|
|
|
|
|
|
? !0 |
108
|
|
|
|
|
|
|
: Finance::Robinhood::Error->new( |
109
|
|
|
|
|
|
|
$res->is_server_error ? (details => $res->message) : $res->json); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 C |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns a Time::Moment object. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
0
|
1
|
|
sub updated_at ($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
Time::Moment->from_string($s->{updated_at}); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 C |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns a Time::Moment object. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
0
|
1
|
|
sub expected_landing_date ($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
Time::Moment->from_string($s->{expected_landing_date} . 'T00:00:00Z'); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 C |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
my $positions = $transfer->equity_positions(); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns a list of Finance::Robinhood::ACATS::Transfer::Position objects with |
137
|
|
|
|
|
|
|
this transfer's data. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
0
|
1
|
|
sub positions ($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
map { |
143
|
0
|
|
|
|
|
|
Finance::Robinhood::ACATS::Transfer::Position->new(_rh => $s->_rh, |
144
|
|
|
|
|
|
|
%$_) |
145
|
0
|
|
|
|
|
|
} %{$s->{positions}}; |
|
0
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 LEGAL |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
151
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
152
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
153
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
156
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 LICENSE |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
163
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
164
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
165
|
|
|
|
|
|
|
the L section. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 AUTHOR |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
1; |