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_001'; |
24
|
1
|
|
|
1
|
|
15073
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
25
|
1
|
|
|
1
|
|
194
|
use Mojo::URL; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
26
|
1
|
|
|
1
|
|
453
|
use Finance::Robinhood::ACATS::Transfer::Position; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _test__init { |
29
|
1
|
|
|
1
|
|
8116
|
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
|
|
140
|
use overload '""' => sub ( $s, @ ) { $s->{url} }, fallback => 1; |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _test_stringify { |
38
|
1
|
|
50
|
1
|
|
1906
|
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 [ |
91
|
|
|
|
|
|
|
'cash_value', 'contra_account_number', |
92
|
|
|
|
|
|
|
'contra_brokerage_name', 'failure_reason', |
93
|
|
|
|
|
|
|
'fees_reimbursed', 'id', |
94
|
|
|
|
|
|
|
'replaced_by', 'state', |
95
|
|
|
|
|
|
|
'transfer_type' |
96
|
|
|
|
|
|
|
]; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 C |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
If the transfer can be cancelled, this method will do it. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
0
|
1
|
|
sub cancel($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
105
|
0
|
|
0
|
|
|
|
$s->{cancel} // return !1; |
106
|
0
|
|
|
|
|
|
my $res = $s->_rh->_post( $s->{cancel} ); |
107
|
0
|
0
|
|
|
|
|
return $res->is_success |
|
|
0
|
|
|
|
|
|
108
|
|
|
|
|
|
|
? !0 |
109
|
|
|
|
|
|
|
: Finance::Robinhood::Error->new( |
110
|
|
|
|
|
|
|
$res->is_server_error ? ( details => $res->message ) : $res->json ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 C |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns a Time::Moment object. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
0
|
1
|
|
sub updated_at ($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
Time::Moment->from_string( $s->{updated_at} ); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 C |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Returns a Time::Moment object. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
0
|
1
|
|
sub expected_landing_date ($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
Time::Moment->from_string( $s->{expected_landing_date} . 'T00:00:00Z' ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 C |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
my $positions = $transfer->equity_positions(); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Returns a list of Finance::Robinhood::ACATS::Transfer::Position objects with |
138
|
|
|
|
|
|
|
this transfer's data. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
0
|
1
|
|
sub positions ($s) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
map { Finance::Robinhood::ACATS::Transfer::Position->new( _rh => $s->_rh, %$_ ) } |
144
|
0
|
|
|
|
|
|
%{ $s->{positions} }; |
|
0
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 LEGAL |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
150
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
151
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
152
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
155
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 LICENSE |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
162
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
163
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
164
|
|
|
|
|
|
|
the L section. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
1; |