lib/Finance/Robinhood/Equity/Earnings.pm

filter: Statementstmt 58.7% 27 / 46 Branchbran 0.0% 0 / 10 Conditioncond 50.0% 4 / 8 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 73.3% 11 / 15 Podpod 100% 4 / 4 totaltotal 50.5% 46 / 91 CC 10 SCAR 14.2
CC
10
Cov
48%
instrument
12.0
call
6.0
eps
6.0
CRAP 4.2
« lib/Finance/Robinhood/Equity/Earnings/Call.pm ↑ Summary lib/Finance/Robinhood/User/BasicInfo.pm »
1 package Finance::Robinhood::Equity::Earnings;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls st nd rd th
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Equity::Earnings - Earnings Call and Report Data
10  
11 =head1 SYNOPSIS
12  
13 use Finance::Robinhood;
14 my $rh = Finance::Robinhood->new;
15
16 my $earnings = $rh->equity_earnings;
17  
18 for my $earnings ( $rh->equity_earnings('7d')->all ) {
19 CORE::say 'Earnings for ' . $earnings->symbol . ' expected ' . $earnings->report->date;
20 }
21  
22 =cut
23  
24 1 our $VERSION = '0.92_003';
25  
26 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=4.9
27 1 my $rh = t::Utility::rh_instance(1);
28 0 my $past = $rh->equity_earnings(range => -7)->current;
29 0 isa_ok($past, __PACKAGE__);
30 0 t::Utility::stash('PAST', $past);
31 0 my $future = $rh->equity_earnings(range => 7)->current;
32 0 isa_ok($future, __PACKAGE__);
33 0 t::Utility::stash('FUTURE', $future);
34 }
35 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 #
38 1 ▶use Finance::Robinhood::Equity::Earnings::Call;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use Finance::Robinhood::Equity::Earnings::EPS;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶use Finance::Robinhood::Equity::Earnings::Report;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶use Finance::Robinhood::Equity::Instrument;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 #
43 1 has _rh => undef => weak => 1;
44  
45 =head1 METHODS
46  
47 =head2 C<call( )>
48  
49 Returns a Finance::Robinhood::Equity::Earnings::Call object if the call is
50 active or has been archived.
51  
52 =cut
53  
54 0 ▶sub call ($s) {
Subroutine call: not called CC=2 SCAR=17.9
Pod documented
55 defined $s->{call}
56 ? Finance::Robinhood::Equity::Earnings::Call->new(_rh => $s->_rh,
57 0 ▶ %{$s->{call}})
Branch: 1 branch
BranchTrueFalseTotal
defined $s->{'call'} ? : 0 0 0
58 : ();
59 }
60  
61 1 ▶sub _test_call {
Subroutine _test_call: called CC=2 SCAR=9.2
62 1 ▶ t::Utility::stash('PAST') // skip_all();
Condition50%1/2
t::Utility::stash("PAST") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("PAST") // skip_all()
t::Utility::stash("PAST") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAST")B= skip_all()
ABresult
1X1
011
000
63 0 isa_ok(t::Utility::stash('PAST')->call(),
64 'Finance::Robinhood::Equity::Earnings::Call');
65 }
66  
67 =head2 C<eps( )>
68  
69 Returns a Finance::Robinhood::Equity::Earnings::EPS object.
70  
71 =cut
72  
73 0 ▶sub eps ($s) {
Subroutine eps: not called CC=2 SCAR=17.9
Pod documented
74 defined $s->{eps}
75 ? Finance::Robinhood::Equity::Earnings::EPS->new(_rh => $s->_rh,
76 0 ▶ %{$s->{eps}})
Branch: 1 branch
BranchTrueFalseTotal
defined $s->{'eps'} ? : 0 0 0
77 : ();
78 }
79  
80 1 ▶sub _test_eps {
Subroutine _test_eps: called CC=2 SCAR=9.2
81 1 ▶ t::Utility::stash('PAST') // skip_all();
Condition50%1/2
t::Utility::stash("PAST") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("PAST") // skip_all()
t::Utility::stash("PAST") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAST")B= skip_all()
ABresult
1X1
011
000
82 0 isa_ok(t::Utility::stash('PAST')->eps(),
83 'Finance::Robinhood::Equity::Earnings::EPS');
84 }
85  
86 =head2 C<quarter( )>
87  
88 C<1>st, C<2>nd, C<3>rd, or C<4>th.
89  
90 =head2 C<report( )>
91  
92 Returns a Fiance::Robinhood::Earnings::Report object.
93  
94 =cut
95  
96 0 ▶sub report ($s) {
Subroutine report: not called CC=2 SCAR=17.9
Pod documented
97 defined $s->{report}
98 ? Finance::Robinhood::Equity::Earnings::Report->new(_rh => $s->_rh,
99 0 ▶ %{$s->{report}})
Branch: 1 branch
BranchTrueFalseTotal
defined $s->{'report'} ? : 0 0 0
100 : ();
101 }
102  
103 1 ▶sub _test_report {
Subroutine _test_report: called CC=2 SCAR=9.2
104 1 ▶ t::Utility::stash('PAST') // skip_all();
Condition50%1/2
t::Utility::stash("PAST") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("PAST") // skip_all()
t::Utility::stash("PAST") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAST")B= skip_all()
ABresult
1X1
011
000
105 0 isa_ok(t::Utility::stash('PAST')->report(),
106 'Finance::Robinhood::Equity::Earnings::Report');
107 }
108  
109 =head2 C<symbol( )>
110  
111 The related ticker symbol.
112  
113 =head2 C<year( )>
114  
115 Four digit year.
116  
117 =cut
118  
119 1 has ['quarter', 'symbol', 'year'];
120  
121 =head2 C<instrument( )>
122  
123 my $instrument = $quote->instrument();
124  
125 Loops back to a Finance::Robinhood::Equity::Instrument object.
126  
127 =cut
128  
129 0 ▶sub instrument ($s) {
Subroutine instrument: not called CC=3 SCAR=24.8
Pod documented
130 0 my $res = $s->_rh->_get($s->{instrument});
131 $res->is_success
132 ? Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh,
133 0 ▶ %{$res->json})
Branch: 2 branches
BranchTrueFalseTotal
$res->is_success ? : 0 0 0
$res->is_server_error ? : 0 0 0
134 : Finance::Robinhood::Error->new(
135 $res->is_server_error ? (details => $res->message) : $res->json);
136 }
137  
138 1 ▶sub _test_instrument {
Subroutine _test_instrument: called CC=2 SCAR=9.2
139 1 ▶ t::Utility::stash('PAST') // skip_all();
Condition50%1/2
t::Utility::stash("PAST") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("PAST") // skip_all()
t::Utility::stash("PAST") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAST")B= skip_all()
ABresult
1X1
011
000
140 0 isa_ok(t::Utility::stash('PAST')->instrument(),
141 'Finance::Robinhood::Equity::Instrument');
142 }
143  
144 =head1 LEGAL
145  
146 This is a simple wrapper around the API used in the official apps. The author
147 provides no investment, legal, or tax advice and is not responsible for any
148 damages incurred while using this software. This software is not affiliated
149 with Robinhood Financial LLC in any way.
150  
151 For Robinhood's terms and disclosures, please see their website at
152 https://robinhood.com/legal/
153  
154 =head1 LICENSE
155  
156 Copyright (C) Sanko Robinson.
157  
158 This library is free software; you can redistribute it and/or modify it under
159 the terms found in the Artistic License 2. Other copyrights, terms, and
160 conditions may apply to data transmitted through this module. Please refer to
161 the L<LEGAL> section.
162  
163 =head1 AUTHOR
164  
165 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
166  
167 =cut
168  
169 1 1;
« lib/Finance/Robinhood/Equity/Earnings/Call.pm ↑ Summary lib/Finance/Robinhood/User/BasicInfo.pm »