line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Equity::Split; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Equity::Split - Represents a Single Equity Instrument Split |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Finance::Robinhood; |
14
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
15
|
|
|
|
|
|
|
my $msft = $rh->equity_instrument_by_symbol('JNUG'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# TODO |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.92_003'; |
22
|
1
|
|
|
1
|
|
10
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
12
|
|
23
|
1
|
|
|
1
|
|
311
|
use Mojo::URL; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
24
|
1
|
|
|
1
|
|
32
|
use Time::Moment; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
25
|
1
|
|
|
1
|
|
6
|
use Finance::Robinhood::Equity::Market::Hours; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _test__init { |
28
|
1
|
|
|
1
|
|
12420
|
my $rh = t::Utility::rh_instance(0); |
29
|
1
|
|
|
|
|
14
|
my $split = $rh->equity_instrument_by_symbol('JNUG')->splits->current; |
30
|
1
|
|
|
|
|
46
|
isa_ok($split, __PACKAGE__); |
31
|
1
|
|
|
|
|
419
|
t::Utility::stash('SPLIT', $split); # Store it for later |
32
|
|
|
|
|
|
|
} |
33
|
1
|
|
|
1
|
|
160
|
use overload '""' => sub ($s, @) { $s->{url} }, fallback => 1; |
|
1
|
|
|
4
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
26
|
|
|
4
|
|
|
|
|
451
|
|
|
4
|
|
|
|
|
8
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _test_stringify { |
36
|
1
|
|
50
|
1
|
|
2515
|
t::Utility::stash('SPLIT') // skip_all(); |
37
|
1
|
|
|
|
|
5
|
like(+t::Utility::stash('SPLIT'), |
38
|
|
|
|
|
|
|
qr'^https://api.robinhood.com/instruments/66ec1551-e033-4f9a-a46f-2b73aa529977/splits/.+/$' |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 C |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 C |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has ['divisor', 'multiplier']; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 C |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns a Time::Moment object. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
1
|
1
|
10
|
sub execution_date ($s) { |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
64
|
1
|
|
|
|
|
20
|
Time::Moment->from_string($s->{execution_date} . 'T00:00:00Z'); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _test_website { |
68
|
1
|
|
50
|
1
|
|
2149
|
t::Utility::stash('SPLIT') // skip_all(); |
69
|
1
|
|
|
|
|
6
|
isa_ok(t::Utility::stash('SPLIT')->execution_date, 'Time::Moment'); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 C |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $jnug = $split->instrument( ); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns the related Finance::Robinhood::Equity::Instrument object. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
1
|
12
|
sub instrument ( $s ) { |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
81
|
1
|
|
|
|
|
4
|
my $res = $s->_rh->_get($s->{instrument}); |
82
|
|
|
|
|
|
|
$res->is_success |
83
|
|
|
|
|
|
|
? Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh, |
84
|
1
|
0
|
|
|
|
31
|
%{$res->json}) |
|
1
|
50
|
|
|
|
30
|
|
85
|
|
|
|
|
|
|
: Finance::Robinhood::Error->new( |
86
|
|
|
|
|
|
|
$res->is_server_error ? (details => $res->message) : $res->json); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _test_instrument { |
90
|
1
|
|
50
|
1
|
|
2193
|
t::Utility::stash('SPLIT') // skip_all(); |
91
|
1
|
|
|
|
|
4
|
my $inst = t::Utility::stash('SPLIT')->instrument(); |
92
|
1
|
|
|
|
|
1147
|
isa_ok($inst, 'Finance::Robinhood::Equity::Instrument'); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 LEGAL |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
98
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
99
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
100
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
103
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
110
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
111
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
112
|
|
|
|
|
|
|
the L section. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |