| 1 | package Finance::GeniusTrader::MarketCalculator; | ||
| 2 | |||
| 3 | # Copyright 2000-2002 Raphaƫl Hertzog, Fabien Fulhaber | ||
| 4 | # This file is distributed under the terms of the General Public License | ||
| 5 | # version 2 or (at your option) any later version. | ||
| 6 | |||
| 7 | use Finance::GeniusTrader::CacheValues; | ||
| 8 | use Finance::GeniusTrader::MetaInfo; | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Finance::GeniusTrader::MarketCalculator - Calculator-like for Markets | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | THIS OBJECT IS NOT USED ANYWHERE AT THE PRESENT TIME | ||
| 17 | |||
| 18 | This is a facility object to ease the collaboration of | ||
| 19 | between Finance::GeniusTrader::List, Finance::GeniusTrader::CacheValues and Finance::GeniusTrader::MetaInfo | ||
| 20 | |||
| 21 | =over | ||
| 22 | |||
| 23 | =item C<< my $market = Finance::GeniusTrader::Markets->new($list [, $name]) >> | ||
| 24 | |||
| 25 | Create a new Finance::GeniusTrader::Markets object with $list used for calculations. The market is associated to market $name. | ||
| 26 | |||
| 27 | =item C<< $market->indices() >> | ||
| 28 | |||
| 29 | =item C<< $market->indicators() >> | ||
| 30 | |||
| 31 | =item C<< $market->signals() >> | ||
| 32 | |||
| 33 | =item C<< $market->metainfo() >> | ||
| 34 | |||
| 35 | Return the corresponding object that is part of Finance::GeniusTrader::Markets. | ||
| 36 | |||
| 37 | =item C<< $market->set_name($name) >> | ||
| 38 | |||
| 39 | Set market object name. | ||
| 40 | |||
| 41 | =item C<< $market->name() >> | ||
| 42 | |||
| 43 | Return market object name. | ||
| 44 | |||
| 45 | =back | ||
| 46 | |||
| 47 | =cut | ||
| 48 | sub new { | ||
| 49 | my $type = shift; | ||
| 50 | my $class = ref($type) || $type; | ||
| 51 | my $list = shift; | ||
| 52 | my $name = shift || ""; | ||
| 53 | |||
| 54 | my $self = { '_list' => $list, 'name' => $name }; | ||
| 55 | $self->{'_indices'} = Finance::GeniusTrader::CacheValues->new(); | ||
| 56 | $self->{'_indicators'} = Finance::GeniusTrader::CacheValues->new(); | ||
| 57 | $self->{'_signals'} = Finance::GeniusTrader::CacheValues->new(); | ||
| 58 | $self->{'_metainfo'} = Finance::GeniusTrader::MetaInfo->new(); | ||
| 59 | |||
| 60 | return bless $self, $class; | ||
| 61 | } | ||
| 62 | |||
| 63 | sub set_name { | ||
| 64 | my ($self, $name) = @_; | ||
| 65 | $self->{'name'} = $name; | ||
| 66 | } | ||
| 67 | |||
| 68 | sub name { | ||
| 69 | return shift->{'name'}; | ||
| 70 | } | ||
| 71 | |||
| 72 | sub list { | ||
| 73 | return shift->{'_list'}; | ||
| 74 | } | ||
| 75 | |||
| 76 | sub indices { | ||
| 77 | return shift->{'_indices'}; | ||
| 78 | } | ||
| 79 | |||
| 80 | sub indicators { | ||
| 81 | return shift->{'_indicators'}; | ||
| 82 | } | ||
| 83 | |||
| 84 | sub signals { | ||
| 85 | return shift->{'_signals'}; | ||
| 86 | } | ||
| 87 | |||
| 88 | sub metainfo { | ||
| 89 | return shift->{'_metainfo'}; | ||
| 90 | } | ||
| 91 | |||
| 92 | 1; |