lib/Finance/Robinhood/Forex/Portfolio.pm

filter: Statementstmt 69.5% 16 / 23 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 6 / 8 Podpod 100% 1 / 1 totaltotal 62.5% 25 / 40 CC 3 SCAR 5.6
CC
3
Cov
67%
_test_stringify
2.5
_test_updated_at
2.5
updated_at
2.0
CRAP 1.7
« lib/Finance/Robinhood/Forex/Account.pm ↑ Summary lib/Finance/Robinhood/Forex/Historicals/Datapoint.pm »
1 package Finance::Robinhood::Forex::Portfolio;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Forex::Portfolio - Represents a Single Forex Portfolio
10  
11 =head1 SYNOPSIS
12  
13 use Finance::Robinhood;
14 my $rh = Finance::Robinhood->new;
15  
16 # TODO
17  
18 =cut
19  
20 1 our $VERSION = '0.92_003';
21 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=3.5
25 1 my $rh = t::Utility::rh_instance(1);
26 0 my $act = $rh->forex_portfolios->current;
27 0 isa_ok($act, __PACKAGE__);
28 0 t::Utility::stash('PORTFOLIO', $act); # Store it for later
29 }
30 0 ▶use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
31  
32 1 ▶sub _test_stringify {
Subroutine _test_stringify: called CC=2 SCAR=9.2
33 1 ▶ t::Utility::stash('PORTFOLIO') // skip_all();
Condition50%1/2
t::Utility::stash("PORTFOLIO") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("PORTFOLIO") // skip_all()
t::Utility::stash("PORTFOLIO") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PORTFOLIO")B= skip_all()
ABresult
1X1
011
000
34 0 like(+t::Utility::stash('PORTFOLIO'),
35 qr'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'i
36 );
37 }
38 #
39 1 has _rh => undef => weak => 1;
40  
41 =head1 METHODS
42
43 =head2 C<account_id( )>
44  
45 Returns a UUID.
46  
47 =head2 C<equity( )>
48  
49 Returs a dollar amount.
50  
51 =head2 C<extended_hours_equity( )>
52  
53 Returns a dollar amount if applicable.
54  
55 =head2 C<extended_hours_market_value( )>
56  
57 Returns a dollar amount if applicable.
58  
59 =head2 C<id( )>
60  
61 Returns a UUID.
62  
63 =head2 C<market_value( )>
64  
65 Returns a dollar amount.
66  
67 =head2 C<previous_close( )>
68  
69 Returns a dollar amount.
70  
71 =cut
72  
73 1 has ['account_id', 'equity',
74 'extended_hours_equity', 'extended_hours_market_value',
75 'id', 'market_value',
76 'previous_close'
77 ];
78  
79 =head2 C<updated_at( )>
80  
81 Returns a Time::Moment object.
82  
83 =cut
84  
85 0 ▶sub updated_at ($s) {
Subroutine updated_at: not called CC=1 SCAR=6.9
Pod documented
86 0 Time::Moment->from_string($s->{updated_at});
87 }
88  
89 1 ▶sub _test_updated_at {
Subroutine _test_updated_at: called CC=2 SCAR=9.2
90 1 ▶ t::Utility::stash('PORTFOLIO') // skip_all();
Condition50%1/2
t::Utility::stash("PORTFOLIO") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("PORTFOLIO") // skip_all()
t::Utility::stash("PORTFOLIO") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PORTFOLIO")B= skip_all()
ABresult
1X1
011
000
91 0 isa_ok(t::Utility::stash('PORTFOLIO')->updated_at, 'Time::Moment');
92 }
93  
94 =head1 LEGAL
95  
96 This is a simple wrapper around the API used in the official apps. The author
97 provides no investment, legal, or tax advice and is not responsible for any
98 damages incurred while using this software. This software is not affiliated
99 with Robinhood Financial LLC in any way.
100  
101 For Robinhood's terms and disclosures, please see their website at
102 https://robinhood.com/legal/
103  
104 =head1 LICENSE
105  
106 Copyright (C) Sanko Robinson.
107  
108 This library is free software; you can redistribute it and/or modify it under
109 the terms found in the Artistic License 2. Other copyrights, terms, and
110 conditions may apply to data transmitted through this module. Please refer to
111 the L<LEGAL> section.
112  
113 =head1 AUTHOR
114  
115 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
116  
117 =cut
118  
119 1 1;
« lib/Finance/Robinhood/Forex/Account.pm ↑ Summary lib/Finance/Robinhood/Forex/Historicals/Datapoint.pm »