App/Chart/Series/OHLCVI.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # Copyright 2007, 2008, 2009, 2010 Kevin Ryde
2  
3 # This file is part of Chart.
4 #
5 # Chart is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3, or (at your option) any later version.
8 #
9 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Chart. If not, see <http://www.gnu.org/licenses/>.
16  
17 package App::Chart::Series::OHLCVI;
18 use 5.010;
19 use strict;
20 use warnings;
21 use Carp;
22 use base 'App::Chart::Series';
23  
24 use constant default_linestyle => 'Candles';
25  
26  
27 sub new {
28 my $class = shift;
29 my @opens = ();
30 my @highs = ();
31 my @lows = ();
32 my @closes = ();
33 my @volumes = ();
34 my @openints = ();
35 my $self = $class->SUPER::new (opens => \@opens,
36 highs => \@highs,
37 lows => \@lows,
38 closes => \@closes,
39 volumes => \@volumes,
40 openints => \@openints,
41 arrays => { opens => \@opens,
42 highs => \@highs,
43 lows => \@lows,
44 closes => \@closes,
45 volumes => \@volumes,
46 openints => \@openints },
47 array_aliases => { 'values' => 'closes'},
48 @_);
49 return $self;
50 }
51  
52 use constant range_default_names => ('opens', 'highs', 'lows', 'closes');
53  
54 1;
55 __END__
56  
57 =for stopwords OHLCVI
58  
59 =head1 NAME
60  
61 App::Chart::Series::OHLCVI -- series with open, high, low, close, ...
62  
63 =head1 SYNOPSIS
64  
65 use App::Chart::Series::OHLCVI;
66  
67 =head1 CLASS HIERARCHY
68  
69 App::Chart::Series
70 App::Chart::Series::OHLCVI
71  
72 =over 4
73  
74 =item C<< $series->values_array >>
75  
76 For an OHLCVI series the C<values> method of C<App::Chart::Series> is the
77 C<closes>.
78  
79 =back
80  
81 =head1 SEE ALSO
82  
83 L<App::Chart::Series>, L<App::Chart::Series::Database>
84  
85 =cut
86  
87  
88 # =head1 FUNCTIONS
89 #
90 # =over 4
91 #
92 # =item C<< $series->opens >>
93 #
94 # =item C<< $series->array('highs') >>
95 #
96 # =item C<< $series->lows >>
97 #
98 # =item C<< $series->closes >>
99 #
100 # =item C<< $series->volumes >>
101 #
102 # =item C<< $series->openints >>
103 #
104 # Return an array reference for the respective data, being daily opening
105 # price, day's high, day's low, close, traded volume, and open interest (for
106 # futures contracts).
107 #
108 # These are like the C<values> method (see L<App::Chart::Series>). Data is
109 # only loaded into the arrays (into all of them at once) when the C<fill>
110 # method is called. So for example
111 #
112 # $series->fill (100, 150);
113 # my $volumes = $series->volumes;
114 # foreach my $t (100 .. 150) {
115 # my $volume = $volumes->[$t];
116 # if (defined $volume) { print "$volume\n"; }
117 # }
118  
119 # sub opens {
120 # my ($self) = @_;
121 # return $self->array('opens');
122 # }
123 # sub highs {
124 # my ($self) = @_;
125 # return $self->array('highs');
126 # }
127 # sub lows {
128 # my ($self) = @_;
129 # return $self->array('lows');
130 # }
131 # sub closes {
132 # my ($self) = @_;
133 # return $self->array('closes');
134 # }
135 # sub volumes {
136 # my ($self) = @_;
137 # return $self->array('volumes');
138 # }
139 # sub openints {
140 # my ($self) = @_;
141 # return $self->array('openints');
142 # }
143  
144 # *values = \&closes;
145