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_003';
26 1     1   7 use Mojo::Base-base, -signatures;
  1         2  
  1         6  
27 1     1   168 use Finance::Robinhood::Equity::Instrument;
  1         2  
  1         16  
28              
29             sub _test__init {
30 1     1   11327 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 ['average_volume', 'average_volume_2_weeks',
125             'ceo', 'description',
126             'dividend_yield', 'headquarters_city',
127             'headquarters_state', 'high',
128             'high_52_weeks', 'industry',
129             'low', 'low_52_weeks',
130             'market_cap', 'num_employees',
131             'open', 'pe_ratio',
132             'sector', 'shares_outstanding',
133             'volume', 'year_founded',
134             ];
135              
136             =head2 C
137              
138             Loop back to the equity instrument.
139              
140             =cut
141              
142 0     0 1 0 sub instrument($s) {
  0         0  
  0         0  
143 0         0 my $res = $s->_rh->_get($s->{instrument});
144             $res->is_success
145             ? Finance::Robinhood::Equity::Instrument->new(_rh => $s->_rh,
146 0 0       0 %{$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   1925 t::Utility::stash('TSLA') // skip_all();
153 0           isa_ok(t::Utility::stash('TSLA')->instrument,
154             'Finance::Robinhood::Equity::Instrument');
155             }
156              
157             =head1 LEGAL
158              
159             This is a simple wrapper around the API used in the official apps. The author
160             provides no investment, legal, or tax advice and is not responsible for any
161             damages incurred while using this software. This software is not affiliated
162             with Robinhood Financial LLC in any way.
163              
164             For Robinhood's terms and disclosures, please see their website at
165             https://robinhood.com/legal/
166              
167             =head1 LICENSE
168              
169             Copyright (C) Sanko Robinson.
170              
171             This library is free software; you can redistribute it and/or modify it under
172             the terms found in the Artistic License 2. Other copyrights, terms, and
173             conditions may apply to data transmitted through this module. Please refer to
174             the L section.
175              
176             =head1 AUTHOR
177              
178             Sanko Robinson Esanko@cpan.orgE
179              
180             =cut
181              
182             1;