File Coverage

lib/Finance/Robinhood/Equity/Fundamentals.pm
Criterion Covered Total %
statement 8 18 44.4
branch 0 4 0.0
condition 1 2 50.0
subroutine 4 5 80.0
pod 1 1 100.0
total 14 30 46.6


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Equity::Fundamentals;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Equity::Fundamentals - Equity Instrument's Fundamental Data
10              
11             =head1 SYNOPSIS
12              
13             use Finance::Robinhood;
14             my $rh = Finance::Robinhood->new;
15             my $instruments = $rh->instruments();
16              
17             for my $instrument ($instruments->all) {
18             my $fundamentals = $instrument->fundamentals;
19             CORE::say $instrument->symbol;
20             CORE::say $fundamentals->description;
21             }
22              
23             =cut
24              
25             our $VERSION = '0.92_002';
26 1     1   6 use Mojo::Base-base, -signatures;
  1         2  
  1         79  
27 1     1   190 use Finance::Robinhood::Equity::Instrument;
  1         2  
  1         9  
28              
29             sub _test__init {
30 1     1   12030 my $rh = t::Utility::rh_instance(1);
31 0         0 my $tsla = $rh->equity_instrument_by_symbol('TSLA')->fundamentals();
32 0         0 isa_ok( $tsla, __PACKAGE__ );
33 0         0 t::Utility::stash( 'TSLA', $tsla ); # Store it for later
34             }
35             #
36             has _rh => undef => weak => 1;
37              
38             =head1 METHODS
39              
40              
41              
42             =head2 C
43              
44              
45              
46             =head2 C
47              
48              
49              
50             =head2 C
51              
52             If applicable, the name of the chief executive(s) related to this instrument.
53              
54             =head2 C
55              
56             Plain text description suited for display.
57              
58             =head2 C
59              
60              
61              
62             =head2 C
63              
64             If applicable, the city where the main headquarters are located.
65              
66             =head2 C
67              
68             If applicable, the US state where the main headquarters are located.
69              
70             =head2 C
71              
72             Trading day high.
73              
74             =head2 C
75              
76             52-week high.
77              
78             =head2 C
79              
80              
81              
82             =head2 C
83              
84             Trading day low.
85              
86             =head2 C
87              
88             52-week low.
89              
90             =head2 C
91              
92              
93              
94             =head2 C
95              
96             If applicable, the number of employees as reported by the company.
97              
98             =head2 C
99              
100              
101              
102             =head2 C
103              
104              
105              
106             =head2 C
107              
108              
109              
110             =head2 C
111              
112             Number of shares outstanding according to the SEC.
113              
114             =head2 C
115              
116              
117              
118             =head2 C
119              
120             The year the company was founded, if applicable.
121              
122             =cut
123              
124             has [
125             'average_volume', 'average_volume_2_weeks',
126             'ceo', 'description',
127             'dividend_yield', 'headquarters_city',
128             'headquarters_state', 'high',
129             'high_52_weeks', 'industry',
130             'low', 'low_52_weeks',
131             'market_cap', 'num_employees',
132             'open', 'pe_ratio',
133             'sector', 'shares_outstanding',
134             'volume', 'year_founded',
135             ];
136              
137             =head2 C
138              
139             Loop back to the equity instrument.
140              
141             =cut
142              
143 0     0 1 0 sub instrument($s) {
  0         0  
  0         0  
144 0         0 my $res = $s->_rh->_get( $s->{instrument} );
145             $res->is_success
146 0 0       0 ? Finance::Robinhood::Equity::Instrument->new( _rh => $s->_rh, %{ $res->json } )
  0 0       0  
147             : Finance::Robinhood::Error->new(
148             $res->is_server_error ? ( details => $res->message ) : $res->json );
149             }
150              
151             sub _test_instrument {
152 1   50 1   2200 t::Utility::stash('TSLA') // skip_all();
153 0           isa_ok( t::Utility::stash('TSLA')->instrument, 'Finance::Robinhood::Equity::Instrument' );
154             }
155              
156             =head1 LEGAL
157              
158             This is a simple wrapper around the API used in the official apps. The author
159             provides no investment, legal, or tax advice and is not responsible for any
160             damages incurred while using this software. This software is not affiliated
161             with Robinhood Financial LLC in any way.
162              
163             For Robinhood's terms and disclosures, please see their website at
164             https://robinhood.com/legal/
165              
166             =head1 LICENSE
167              
168             Copyright (C) Sanko Robinson.
169              
170             This library is free software; you can redistribute it and/or modify it under
171             the terms found in the Artistic License 2. Other copyrights, terms, and
172             conditions may apply to data transmitted through this module. Please refer to
173             the L section.
174              
175             =head1 AUTHOR
176              
177             Sanko Robinson Esanko@cpan.orgE
178              
179             =cut
180              
181             1;