| 1 | package Finance::StockAccount::Transaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use Time::Moment; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Finance::StockAccount::Stock; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use constant BUY => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use constant SELL => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use constant SHORT => 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | use constant COVER => 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | my $lineFormatPattern = "%-35s %-6s %-6s %8s %7.2f %10.2f %5.2f %10.2f\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 10 | my $headerPattern = "%-35s %-6s %-6s %8s %7s %10s %5s %10s\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 10 | my @headerNames = qw(Date Symbol Action Quantity Price Commission Fees CashEffect); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 278 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 278 | my ($class, $init) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 278 | my $self = { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | tm => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | action => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | stock => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | quantity => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | price => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | commission => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | regulatoryFees => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | otherFees => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 278 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 278 | ▶ | $init and $self->set($init); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 278 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | ▶ | sub order { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
order: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | return qw(date action stock quantity price commission regulatoryFees otherFees); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 13484 | ▶ | sub tm { # Time::Moment object getter/setter | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tm: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 13484 | my ($self, $tm) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 13484 | ▶ | if ($tm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 241 | ▶ | if (ref($tm) and ref($tm) eq 'Time::Moment') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $tm and ref $tm eq "Time::Moment"
MC/DC0%0/2
ref $tm and ref $tm eq "Time::Moment"
ref $tm
ref $tm eq "Time::Moment"
Truth table33%1/3
A and B
A= ref $tmB= ref $tm eq "Time::Moment"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 241 | $self->{tm} = $tm; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 241 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | warn "$tm not a valid Time::Moment object.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 13243 | return $self->{tm}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 29 | ▶ | sub dateString { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dateString: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 29 | my ($self, $dateString) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 29 | ▶ | if ($dateString) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 27 | my $tm = Time::Moment->from_string($dateString); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 27 | ▶ | if ($tm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 27 | $self->{tm} = $tm; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 27 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | warn "Unable to create Time::Moment object from date string $dateString.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 2 | my $tm = $self->{tm}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | ▶ | if ($tm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | return $tm->to_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | warn "Time::Moment property not set.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 36 | ▶ | sub action { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
action: called CC=6 SCAR=20.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 36 | my ($self, $action) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 36 | ▶ | if ($action) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 36 | ▶ | if ($action eq 'buy') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 21 | return $self->buy(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | elsif ($action eq 'sell') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 14 | return $self->sell(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | elsif ($action eq 'short') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | return $self->short(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | elsif ($action eq 'cover') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return $self->cover(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | die "Action must a string, one of 'buy', 'sell', 'short', 'cover'.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | return $self->{action}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 2678 | ▶ | sub stock { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stock: called CC=5 SCAR=21.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 2678 | my ($self, $stock) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 2678 | ▶ | if ($stock) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | if (ref($stock) and 'Finance::StockAccount::Stock' eq ref($stock)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $stock and "Finance::StockAccount::Stock" eq ref $stock
MC/DC0%0/2
ref $stock and "Finance::StockAccount::Stock" eq ref $stock
ref $stock
"Finance::StockAccount::Stock" eq ref $stock
Truth table0%0/3
A and B
A= ref $stockB= "Finance::StockAccount::Stock" eq ref $stock
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $self->{stock} = $stock; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | warn "$stock is not a recognized Finance::StockAccount::Stock object.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2678 | $stock = $self->{stock}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2678 | ▶ | if (!$stock) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 275 | $stock = Finance::StockAccount::Stock->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 275 | $self->{stock} = $stock; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 2678 | return $stock; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub sameStock { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sameStock: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my ($self, $testStock) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $stock = $self->{stock}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ($stock) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return $stock->same($testStock); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | warn "Can't test for sameStock, object stock property not yet defined.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1101 | ▶ | sub symbol { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
symbol: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1101 | my ($self, $symbol) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1101 | my $stock = $self->stock(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1101 | return $stock->symbol($symbol); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | ▶ | sub exchange { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exchange: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | my ($self, $exchange) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | my $stock = $self->stock(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | return $stock->exchange($exchange); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 3065 | ▶ | sub quantity { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quantity: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 3065 | my ($self, $quantity) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3065 | ▶ | if ($quantity) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | $self->{quantity} = $quantity; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3064 | return $self->{quantity}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | ▶ | sub price { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
price: called CC=2 SCAR=8.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | my ($self, $price) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | ▶ | if ($price) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $self->{price} = $price; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | return $self->{price}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 3010 | ▶ | sub commission { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
commission: called CC=2 SCAR=8.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 3010 | my ($self, $commission) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 3010 | ▶ | if ($commission) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $self->{commission} = $commission; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 3010 | return $self->{commission}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 3009 | ▶ | sub regulatoryFees { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
regulatoryFees: called CC=2 SCAR=8.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 3009 | my ($self, $regulatoryFees) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 3009 | ▶ | if ($regulatoryFees) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $self->{regulatoryFees} = $regulatoryFees; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 3009 | return $self->{regulatoryFees}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 3009 | ▶ | sub otherFees { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
otherFees: called CC=2 SCAR=8.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 3009 | my ($self, $otherFees) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 3009 | ▶ | if ($otherFees) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $self->{otherFees} = $otherFees; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 3009 | return $self->{otherFees}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 3543 | ▶ | sub priceByQuantity { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
priceByQuantity: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3543 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 3543 | return $self->{price} * $self->{quantity}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 3543 | ▶ | sub feesAndCommissions { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
feesAndCommissions: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 3543 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 3543 | return $self->{commission} + $self->{regulatoryFees} + $self->{otherFees}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 3543 | ▶ | sub cashEffect { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cashEffect: called CC=6 SCAR=19.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 3543 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 3543 | my $cashEffect; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 3543 | ▶ | if ($self->buy() or $self->short()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$self->buy or $self->short
MC/DC50%1/2
$self->buy or $self->short
$self->buy
$self->short
Truth table66%2/3
A or B
A= $self->buyB= $self->short
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 1604 | $cashEffect = 0 - ($self->priceByQuantity() + $self->feesAndCommissions()); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | ▶ | elsif ($self->sell() or $self->cover()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->sell or $self->cover
MC/DC0%0/2
$self->sell or $self->cover
$self->sell
$self->cover
Truth table33%1/3
A or B
A= $self->sellB= $self->cover
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1939 | $cashEffect = $self->priceByQuantity() - $self->feesAndCommissions(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 3543 | ▶ | if ($cashEffect) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 3543 | return $cashEffect; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | warn "Cannot calculate cash effect.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 280 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: called CC=8 SCAR=21.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 280 | my ($self, $init) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 280 | my $status = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 280 | foreach my $key (keys %{$init}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1649 | ▶ | if (exists($self->{$key})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1348 | ▶ | if ($key eq 'action') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 36 | $self->action($init->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | elsif ($key eq 'tm') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 241 | $self->tm($init->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 1071 | $self->{$key} = $init->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | elsif ($key eq 'symbol') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 274 | $self->symbol($init->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | elsif ($key eq 'exchange') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $self->exchange($init->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | elsif ($key eq 'dateString') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 27 | $self->dateString($init->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $status = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | warn "Tried to set $key in StockAccount::Transaction object, but that's not a known key.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 280 | return $status; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my ($self, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | if ($key and exists($self->{$key})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key and exists $self->{$key}
MC/DC0%0/2
$key and exists $self->{$key}
$key
exists $self->{$key}
Truth table0%0/3
A and B
A= $keyB= exists $self->{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return $self->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | warn "Tried to get key from StockAccount::Transaction object, but that's not a known key.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 24843 | ▶ | sub validateAction { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validateAction: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 24843 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 24843 | ▶ | if (!defined($self->{action})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | die "Action has not yet been set."; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 24842 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 15847 | ▶ | sub buy { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buy: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 15847 | my ($self, $assertion) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 15847 | ▶ | if ($assertion) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 167 | $self->{action} = BUY; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 167 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 15680 | $self->validateAction(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 15680 | return $self->{action} == BUY; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 5727 | ▶ | sub sell { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sell: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 5727 | my ($self, $assertion) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 5727 | ▶ | if ($assertion) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 111 | $self->{action} = SELL; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 111 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 5616 | $self->validateAction(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 5615 | return $self->{action} == SELL; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 3548 | ▶ | sub short { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
short: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 3548 | my ($self, $assertion) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 3548 | ▶ | if ($assertion) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | $self->{action} = SHORT; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 3547 | $self->validateAction(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 3547 | return $self->{action} == SHORT; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub cover { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cover: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my ($self, $assertion) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if ($assertion) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | $self->{action} = COVER; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $self->validateAction(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return $self->{action} == COVER; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1154 | ▶ | sub actionString { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actionString: called CC=5 SCAR=21.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1154 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1154 | ▶ | if ($self->buy()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 93 | return 'buy'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | elsif ($self->sell()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 1061 | return 'sell'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | elsif ($self->short()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | return 'short'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | elsif ($self->cover()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | return 'cover'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 2 | ▶ | sub string { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string: called CC=9 SCAR=22.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 2 | my $pattern = "%14s %-35s\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 2 | my $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 2 | foreach my $key ($self->order()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 16 | ▶ | if (defined($self->{$key})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 14 | ▶ | if ($key eq 'stock') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 2 | my $symbol = $self->symbol(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 2 | my $exchange = $self->exchange(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 2 | ▶ | if (defined($symbol)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 2 | $string .= sprintf($pattern, 'symbol', $self->symbol()); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 2 | ▶ | if (defined($exchange)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $string .= sprintf($pattern, 'exchange', $self->exchange()); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 12 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 12 | ▶ | if ($key eq 'action') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 2 | $value = $self->actionString(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 10 | $value = $self->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 12 | $string .= sprintf($pattern, $key, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | elsif ($key eq 'date') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 2 | ▶ | if ($self->{tm}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 2 | $string .= sprintf($pattern, $key, $self->dateString()); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 2 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 3 | ▶ | sub lineFormatHeader { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lineFormatHeader: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 3 | return sprintf($headerPattern, @headerNames); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 148 | ▶ | sub lineFormatPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lineFormatPattern: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 148 | return $lineFormatPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 148 | ▶ | sub lineFormatValues { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lineFormatValues: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 148 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | $self->{tm} || '', $self->symbol(), $self->actionString(), $self->{quantity}, $self->{price} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 148 | ▶ | $self->{commission} || 0, ($self->{regulatoryFees} + $self->{otherFees}) || 0, $self->cashEffect() || 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%8/10
$self->{'tm'} || ''
$self->{'price'} || 0
$self->{'commission'} || 0
$self->{'regulatoryFees'} + $self->{'otherFees'} || 0
$self->cashEffect || 0
MC/DC100%1/1
$self->{'tm'} || ''
$self->{'tm'}
MC/DC0%0/1
$self->{'price'} || 0
$self->{'price'}
MC/DC100%1/1
$self->{'commission'} || 0
$self->{'commission'}
MC/DC100%1/1
$self->{'regulatoryFees'} + $self->{'otherFees'} || 0
$self->{'regulatoryFees'} + $self->{'otherFees'}
MC/DC0%0/1
$self->cashEffect || 0
$self->cashEffect
Truth table100%2/2
A
A= $self->{'tm'}
Truth table50%1/2
A
A= $self->{'price'}
Truth table100%2/2
A
A= $self->{'commission'}
Truth table100%2/2
A
A= $self->{'regulatoryFees'} + $self->{'otherFees'}
Truth table50%1/2
A
A= $self->cashEffect
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 1 | ▶ | sub lineFormatString { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lineFormatString: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 1 | return sprintf($lineFormatPattern, @{$self->lineFormatValues()}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||