File Coverage

lib/Finance/Robinhood/Forex/Historicals/Datapoint.pm
Criterion Covered Total %
statement 8 16 50.0
branch n/a
condition 1 2 50.0
subroutine 4 5 80.0
pod 1 1 100.0
total 14 24 58.3


line stmt bran cond sub pod time code
1             package Finance::Robinhood::Forex::Historicals::Datapoint;
2              
3             =encoding utf-8
4              
5             =for stopwords watchlist watchlists untradable urls
6              
7             =head1 NAME
8              
9             Finance::Robinhood::Forex::Historicals::Datapoint - Represents a Single
10             Interval of Time in a Forex Currency's Historical Price Data
11              
12             =head1 SYNOPSIS
13              
14             use Finance::Robinhood;
15             my $rh = Finance::Robinhood->new->login('user', 'pass');
16              
17             # TODO
18              
19             =cut
20              
21             our $VERSION = '0.92_001';
22 1     1   4213 use Mojo::Base-base, -signatures;
  1         2  
  1         10  
23 1     1   233 use Mojo::URL;
  1         2  
  1         9  
24              
25             sub _test__init {
26 1     1   8197 my $rh = t::Utility::rh_instance(1);
27 0         0 my ($datapoint) = $rh->forex_pair_by_id('3d961844-d360-45fc-989b-f6fca761d511') # BTC-USD
28             ->historicals( interval => '5minute' )->data_points;
29 0         0 isa_ok( $datapoint, __PACKAGE__ );
30 0         0 t::Utility::stash( 'DATAPOINT', $datapoint ); # Store it for later
31             }
32             ##
33              
34             =head1 METHODS
35              
36             =cut
37              
38             has _rh => undef => weak => 1;
39              
40             =head2 C
41              
42             Returns a Time::Moment object.
43              
44             =head2 C
45              
46              
47              
48             =head2 C
49              
50              
51             =head2 C
52              
53              
54             =head2 C
55              
56             Returns a Time::Moment object.
57              
58             =head2 C
59              
60              
61             =head2 C
62              
63             Returns a Time::Moment object.
64              
65             =head2 C
66              
67             =cut
68              
69             has [ 'close_price', 'high_price', 'interpolated', 'low_price', 'open_price', 'session', 'volume' ];
70              
71 0     0 1 0 sub begins_at ($s) {
  0         0  
  0         0  
72 0         0 Time::Moment->from_string( $s->{begins_at} );
73             }
74              
75             sub _test_begins_at {
76 1   50 1   2039 t::Utility::stash('DATAPOINT') // skip_all('No historical datapoint object in stash');
77 0           isa_ok( t::Utility::stash('DATAPOINT')->begins_at, 'Time::Moment' );
78             }
79              
80             =head1 LEGAL
81              
82             This is a simple wrapper around the API used in the official apps. The author
83             provides no investment, legal, or tax advice and is not responsible for any
84             damages incurred while using this software. This software is not affiliated
85             with Robinhood Financial LLC in any way.
86              
87             For Robinhood's terms and disclosures, please see their website at
88             https://robinhood.com/legal/
89              
90             =head1 LICENSE
91              
92             Copyright (C) Sanko Robinson.
93              
94             This library is free software; you can redistribute it and/or modify it under
95             the terms found in the Artistic License 2. Other copyrights, terms, and
96             conditions may apply to data transmitted through this module. Please refer to
97             the L section.
98              
99             =head1 AUTHOR
100              
101             Sanko Robinson Esanko@cpan.orgE
102              
103             =cut
104              
105             1;