lib/Finance/Robinhood/Equity/PriceMovement.pm

filter: Statementstmt 75.0% 15 / 20 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 70.0% 21 / 30 CC 2 SCAR 4.9
CC
2
Cov
73%
_test_stringify
2.5
__ANON__
2.0
_test__init
1.4
CRAP 1.6
« lib/Finance/Robinhood/Equity/Ratings.pm ↑ Summary lib/Finance/Robinhood/Equity/Earnings/Report.pm »
1 package Finance::Robinhood::Equity::PriceMovement;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Equity::PriceMovement - Represents How Much a Top Moving
10 Equity Instrument has Moved
11  
12 =head1 SYNOPSIS
13  
14 use Text::Wrap qw[wrap];
15 use Finance::Robinhood;
16 my $rh = Finance::Robinhood->new;
17 my $movers = $rh->top_movers(direction => 'up');
18  
19 for my $mover ($movers->all) {
20 CORE::say $mover->instrument->name . ' has increased by ' . $mover->price_movement->market_hours_last_movement_pct . '%' ;
21 }
22  
23 =head1 METHODS
24  
25 =cut
26  
27 1 our $VERSION = '0.92_003';
28 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=3.5
32 1 my $rh = t::Utility::rh_instance(1);
33 0 my $top = $rh->top_movers(direction => 'up')->current->price_movement;
34 0 isa_ok($top, __PACKAGE__);
35 0 t::Utility::stash('MOVEMENT', $top); # Store it for later
36 }
37 0 ▶use overload '""' => sub ($s, @) { $s->{market_hours_last_movement_pct} },
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 1 fallback => 1;
39  
40 1 ▶sub _test_stringify {
Subroutine _test_stringify: called CC=2 SCAR=9.2
41 1 ▶ t::Utility::stash('MOVEMENT') // skip_all();
Condition50%1/2
t::Utility::stash("MOVEMENT") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("MOVEMENT") // skip_all()
t::Utility::stash("MOVEMENT") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("MOVEMENT")B= skip_all()
ABresult
1X1
011
000
42 0 like(+t::Utility::stash('MOVEMENT'), qr[^\-?\d+\.\d+$],);
43 }
44 #
45 1 has _rh => undef => weak => 1;
46  
47 =head2 C<market_hours_last_movement_pct( )>
48  
49 Returns a number of positive of negative percentage points.
50  
51 =head2 C<market_hours_last_price( )>
52  
53 Returns the actual price.
54  
55 =cut
56  
57 1 has ['market_hours_last_movement_pct', 'market_hours_last_price'];
58  
59 =head1 LEGAL
60  
61 This is a simple wrapper around the API used in the official apps. The author
62 provides no investment, legal, or tax advice and is not responsible for any
63 damages incurred while using this software. This software is not affiliated
64 with Robinhood Financial LLC in any way.
65  
66 For Robinhood's terms and disclosures, please see their website at
67 https://robinhood.com/legal/
68  
69 =head1 LICENSE
70  
71 Copyright (C) Sanko Robinson.
72  
73 This library is free software; you can redistribute it and/or modify it under
74 the terms found in the Artistic License 2. Other copyrights, terms, and
75 conditions may apply to data transmitted through this module. Please refer to
76 the L<LEGAL> section.
77  
78 =head1 AUTHOR
79  
80 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
81  
82 =cut
83  
84 1 1;
« lib/Finance/Robinhood/Equity/Ratings.pm ↑ Summary lib/Finance/Robinhood/Equity/Earnings/Report.pm »