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_003';
22 1     1   4149 use Mojo::Base-base, -signatures;
  1         3  
  1         8  
23 1     1   209 use Mojo::URL;
  1         2  
  1         8  
24              
25             sub _test__init {
26 1     1   8052 my $rh = t::Utility::rh_instance(1);
27 0         0 my ($datapoint)
28             = $rh->forex_pair_by_id(
29             '3d961844-d360-45fc-989b-f6fca761d511') # BTC-USD
30             ->historicals(interval => '5minute')->data_points;
31 0         0 isa_ok($datapoint, __PACKAGE__);
32 0         0 t::Utility::stash('DATAPOINT', $datapoint); # Store it for later
33             }
34             ##
35              
36             =head1 METHODS
37              
38             =cut
39              
40             has _rh => undef => weak => 1;
41              
42             =head2 C
43              
44             Returns a Time::Moment object.
45              
46             =head2 C
47              
48              
49              
50             =head2 C
51              
52              
53             =head2 C
54              
55              
56             =head2 C
57              
58             Returns a Time::Moment object.
59              
60             =head2 C
61              
62              
63             =head2 C
64              
65             Returns a Time::Moment object.
66              
67             =head2 C
68              
69             =cut
70              
71             has ['close_price', 'high_price', 'interpolated', 'low_price',
72             'open_price', 'session', 'volume'
73             ];
74              
75 0     0 1 0 sub begins_at ($s) {
  0         0  
  0         0  
76 0         0 Time::Moment->from_string($s->{begins_at});
77             }
78              
79             sub _test_begins_at {
80 1   50 1   2042 t::Utility::stash('DATAPOINT')
81             // skip_all('No historical datapoint object in stash');
82 0           isa_ok(t::Utility::stash('DATAPOINT')->begins_at, 'Time::Moment');
83             }
84              
85             =head1 LEGAL
86              
87             This is a simple wrapper around the API used in the official apps. The author
88             provides no investment, legal, or tax advice and is not responsible for any
89             damages incurred while using this software. This software is not affiliated
90             with Robinhood Financial LLC in any way.
91              
92             For Robinhood's terms and disclosures, please see their website at
93             https://robinhood.com/legal/
94              
95             =head1 LICENSE
96              
97             Copyright (C) Sanko Robinson.
98              
99             This library is free software; you can redistribute it and/or modify it under
100             the terms found in the Artistic License 2. Other copyrights, terms, and
101             conditions may apply to data transmitted through this module. Please refer to
102             the L section.
103              
104             =head1 AUTHOR
105              
106             Sanko Robinson Esanko@cpan.orgE
107              
108             =cut
109              
110             1;