line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Robinhood::Equity::Mover; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=for stopwords watchlist watchlists untradable urls |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Finance::Robinhood::Equity::Mover - Represents a Top Moving Equity Instrument |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Text::Wrap qw[wrap]; |
14
|
|
|
|
|
|
|
use Finance::Robinhood; |
15
|
|
|
|
|
|
|
my $rh = Finance::Robinhood->new; |
16
|
|
|
|
|
|
|
my $movers = $rh->top_movers(direction => 'up'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
for my $mover ($movers->all) { |
19
|
|
|
|
|
|
|
CORE::say $mover->instrument->name; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.92_003'; |
27
|
1
|
|
|
1
|
|
9
|
use Mojo::Base-base, -signatures; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
28
|
1
|
|
|
1
|
|
328
|
use Mojo::URL; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
29
|
1
|
|
|
1
|
|
33
|
use Time::Moment; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
30
|
1
|
|
|
1
|
|
6
|
use Finance::Robinhood::Equity::PriceMovement; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _test__init { |
33
|
1
|
|
|
1
|
|
14291
|
my $rh = t::Utility::rh_instance(1); |
34
|
0
|
|
|
|
|
0
|
my $top = $rh->top_movers(direction => 'up')->current; |
35
|
0
|
|
|
|
|
0
|
isa_ok($top, __PACKAGE__); |
36
|
0
|
|
|
|
|
0
|
t::Utility::stash('MOVER', $top); # Store it for later |
37
|
|
|
|
|
|
|
} |
38
|
1
|
|
|
1
|
|
169
|
use overload '""' => sub ($s, @) { $s->{instrument_url} }, fallback => 1; |
|
1
|
|
|
0
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _test_stringify { |
41
|
1
|
|
50
|
1
|
|
1925
|
t::Utility::stash('MOVER') // skip_all(); |
42
|
0
|
|
|
|
|
0
|
like(+t::Utility::stash('MOVER'), |
43
|
|
|
|
|
|
|
qr'https://api.robinhood.com/instruments/.+/',); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
has _rh => undef => weak => 1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 C |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Returns a full text description suited for display. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 C |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Returns the ticker symbol of the instrument. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has ['description', 'symbol']; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 C |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$article->updated_at->to_string; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Returns the time the article was published or last updated as a Time::Moment |
65
|
|
|
|
|
|
|
object. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
1
|
0
|
sub updated_at($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
70
|
0
|
|
|
|
|
0
|
Time::Moment->from_string($s->{updated_at}); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _test_updated_at { |
74
|
1
|
|
50
|
1
|
|
1858
|
t::Utility::stash('MOVER') // skip_all(); |
75
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('MOVER')->updated_at, 'Time::Moment'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 C |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $instrument = $mover->instrument(); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Builds a Finance::Robinhood::Equity::Instrument object. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
0
|
1
|
0
|
sub instrument ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
87
|
0
|
|
|
|
|
0
|
my $res = $s->_rh->_get($s->{instrument_url}); |
88
|
|
|
|
|
|
|
$res->is_success |
89
|
|
|
|
|
|
|
? Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh, |
90
|
0
|
0
|
|
|
|
0
|
%{$res->json}) |
|
0
|
0
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
: Finance::Robinhood::Error->new( |
92
|
|
|
|
|
|
|
$res->is_server_error ? (details => $res->message) : $res->json); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _test_instrument { |
96
|
1
|
|
50
|
1
|
|
2069
|
t::Utility::stash('MOVER') // skip_all(); |
97
|
0
|
|
|
|
|
0
|
isa_ok(t::Utility::stash('MOVER')->instrument(), |
98
|
|
|
|
|
|
|
'Finance::Robinhood::Equity::Instrument'); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 C |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $price_movement = $mover->price_movement(); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Builds a Finance::Robinhood::Equity::PriceMovement object. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
0
|
1
|
0
|
sub price_movement ($s) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
110
|
|
|
|
|
|
|
Finance::Robinhood::Equity::PriceMovement->new(_rh => $s->_rh, |
111
|
0
|
|
|
|
|
0
|
%{$s->{price_movement}}); |
|
0
|
|
|
|
|
0
|
|
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _test_price_movement { |
115
|
1
|
|
50
|
1
|
|
1878
|
t::Utility::stash('MOVER') // skip_all(); |
116
|
0
|
|
|
|
|
|
isa_ok(t::Utility::stash('MOVER')->price_movement(), |
117
|
|
|
|
|
|
|
'Finance::Robinhood::Equity::PriceMovement'); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 LEGAL |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This is a simple wrapper around the API used in the official apps. The author |
123
|
|
|
|
|
|
|
provides no investment, legal, or tax advice and is not responsible for any |
124
|
|
|
|
|
|
|
damages incurred while using this software. This software is not affiliated |
125
|
|
|
|
|
|
|
with Robinhood Financial LLC in any way. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
For Robinhood's terms and disclosures, please see their website at |
128
|
|
|
|
|
|
|
https://robinhood.com/legal/ |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 LICENSE |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
135
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
136
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. Please refer to |
137
|
|
|
|
|
|
|
the L section. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; |