File Coverage

lib/Finance/Robinhood/Equity/PriceMovement.pm
Criterion Covered Total %
statement 11 19 57.8
branch n/a
condition 1 2 50.0
subroutine 5 6 83.3
pod n/a
total 17 27 62.9


line stmt bran cond sub pod time code
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             our $VERSION = '0.92_003';
28 1     1   6 use Mojo::Base-base, -signatures;
  1         2  
  1         6  
29 1     1   161 use Mojo::URL;
  1         2  
  1         4  
30              
31             sub _test__init {
32 1     1   11930 my $rh = t::Utility::rh_instance(1);
33 0         0 my $top = $rh->top_movers(direction => 'up')->current->price_movement;
34 0         0 isa_ok($top, __PACKAGE__);
35 0         0 t::Utility::stash('MOVEMENT', $top); # Store it for later
36             }
37 0     0   0 use overload '""' => sub ($s, @) { $s->{market_hours_last_movement_pct} },
  0         0  
  0         0  
  0         0  
38 1     1   166 fallback => 1;
  1         2  
  1         20  
39              
40             sub _test_stringify {
41 1   50 1   1993 t::Utility::stash('MOVEMENT') // skip_all();
42 0           like(+t::Utility::stash('MOVEMENT'), qr[^\-?\d+\.\d+$],);
43             }
44             #
45             has _rh => undef => weak => 1;
46              
47             =head2 C
48              
49             Returns a number of positive of negative percentage points.
50              
51             =head2 C
52              
53             Returns the actual price.
54              
55             =cut
56              
57             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 section.
77              
78             =head1 AUTHOR
79              
80             Sanko Robinson Esanko@cpan.orgE
81              
82             =cut
83              
84             1;