GeniusTrader/MoneyManagement/FixedShares.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 3 SCAR 17.5
CC
3
Cov
0%
new
12.0
manage_quantity
2.0
BEGIN
2.0
CRAP 5.8
1 package Finance::GeniusTrader::MoneyManagement::FixedShares;
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 strict;
8 use vars qw(@NAMES @ISA);
9  
10 use Finance::GeniusTrader::MoneyManagement;
11 use Finance::GeniusTrader::Prices;
12  
13 @NAMES = ("FixedShares[#1]");
14 @ISA = qw(Finance::GeniusTrader::MoneyManagement);
15  
16 =head1 Finance::GeniusTrader::MoneyManagement::FixedShares
17  
18 =head2 Overview
19  
20 This money management rule will allowed to each trade exactly the same
21 number of shares. The default number is set up to 100 shares.
22  
23 =cut
24  
25 sub new {
26 my $type = shift;
27 my $class = ref($type) || $type;
28 my $args = shift;
29
30 my $self = { 'args' => defined($args) ? $args : [ 100 ] };
31  
32 $args->[0] = 100 if (! defined($args->[0]));
33
34 return manage_object(\@NAMES, $self, $class, $self->{'args'}, '');
35 }
36  
37 sub manage_quantity {
38 my ($self, $order, $i, $calc, $portfolio) = @_;
39
40 return $self->{'args'}[0];
41 }
42  
43 1;