lib/Finance/Robinhood/Forex/Quote.pm

filter: Statementstmt 78.2% 18 / 23 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 71.4% 25 / 35 CC 2 SCAR 4.4
CC
2
Cov
76%
_test_pair
2.5
pair
2.0
_test__init
1.4
CRAP 1.6
« lib/Finance/Robinhood/Options/Chain/Underlying.pm ↑ Summary lib/Finance/Robinhood/Utilities.pm »
1 package Finance::Robinhood::Forex::Quote;
2  
3 =encoding utf-8
4  
5 =for stopwords watchlist watchlists untradable urls
6  
7 =head1 NAME
8  
9 Finance::Robinhood::Forex::Quote - Represents Quote Data for a Single Forex
10 Currency Pair
11  
12 =head1 SYNOPSIS
13  
14 use Finance::Robinhood;
15 my $rh = Finance::Robinhood->new;
16
17 # TODO
18  
19 =cut
20  
21 1 our $VERSION = '0.92_003';
22 1 ▶use Mojo::Base-base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Mojo::URL;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Time::Moment;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Finance::Robinhood::Forex::Pair;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 1 ▶sub _test__init {
Subroutine _test__init: called CC=1 SCAR=3.5
28 1 my $rh = t::Utility::rh_instance(1);
29 0 my $quote = $rh->forex_pairs->current->quote();
30 0 isa_ok($quote, __PACKAGE__);
31 0 t::Utility::stash('QUOTE', $quote); # Store it for later
32 }
33 #
34 1 has _rh => undef => weak => 1;
35  
36 =head1 METHODS
37  
38  
39 =head2 C<ask_price( )>
40  
41 Live ask price.
42  
43 =head2 C<bid_price( )>
44  
45 Delayed bid price.
46  
47 =head2 C<high_price( )>
48  
49 Period high price.
50  
51 =head2 C<low_price( )>
52  
53 Period low price.
54  
55 =head2 C<mark_price( )>
56  
57 Spread midpoint.
58  
59 =head2 C<open_price( )>
60  
61 Period open price.
62  
63 =head2 C<symbol( )>
64  
65 The ticker symbol of the currency pair related to this quote data. See C<pair(
66 )> to be given the object itself.
67  
68 =head2 C<volume( )>
69  
70 Volume traded during period.
71  
72 =cut
73  
74 1 has ['ask_price', 'bid_price', 'high_price', 'id',
75 'low_price', 'mark_price', 'open_price', 'symbol',
76 'volume'
77 ];
78  
79 =head2 C<instrument( )>
80  
81 my $instrument = $quote->instrument();
82  
83 Loops back to a Finance::Robinhood::Forex::Instrument object.
84  
85 =cut
86  
87 0 ▶sub pair ($s) {
Subroutine pair: not called CC=1 SCAR=6.9
Pod undocumented
88 0 return $s->_rh->forex_pair_by_id($s->{id});
89 }
90  
91 1 ▶sub _test_pair {
Subroutine _test_pair: called CC=2 SCAR=9.2
92 1 ▶ t::Utility::stash('QUOTE') // skip_all();
Condition50%1/2
t::Utility::stash("QUOTE") // skip_all()
l!l
01
MC/DC0%0/2
t::Utility::stash("QUOTE") // skip_all()
t::Utility::stash("QUOTE") skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("QUOTE")B= skip_all()
ABresult
1X1
011
000
93 0 isa_ok(t::Utility::stash('QUOTE')->pair(),
94 'Finance::Robinhood::Forex::Pair');
95 }
96  
97 =head1 LEGAL
98  
99 This is a simple wrapper around the API used in the official apps. The author
100 provides no investment, legal, or tax advice and is not responsible for any
101 damages incurred while using this software. This software is not affiliated
102 with Robinhood Financial LLC in any way.
103  
104 For Robinhood's terms and disclosures, please see their website at
105 https://robinhood.com/legal/
106  
107 =head1 LICENSE
108  
109 Copyright (C) Sanko Robinson.
110  
111 This library is free software; you can redistribute it and/or modify it under
112 the terms found in the Artistic License 2. Other copyrights, terms, and
113 conditions may apply to data transmitted through this module. Please refer to
114 the L<LEGAL> section.
115  
116 =head1 AUTHOR
117  
118 Sanko Robinson E<lt>sanko@cpan.orgE<gt>
119  
120 =cut
121  
122 1 1;
« lib/Finance/Robinhood/Options/Chain/Underlying.pm ↑ Summary lib/Finance/Robinhood/Utilities.pm »