Branch Coverage

blib/lib/Finance/Calendar.pm
Criterion Covered Total %
branch 101 138 73.1


line true false branch
94 8 439 unless exists $self->_cache->{$method_name}
122 171 96 if (my $cache = $self->_get_cache("trades_on", $exchange, $when))
127 39 57 @{$exchange->trading_days_list;}[$really_when->day_of_week] && !$self->is_holiday_for($exchange->symbol, $really_when) ? :
146 0 5 if (my $cache = $self->_get_cache("trade_date_before", $exchange, $begin))
158 5 3 if $self->trades_on($exchange, $possible)
181 2 13 if (my $cache = $self->_get_cache("trade_date_after", $exchange, $begin))
189 13 9 if $self->trades_on($exchange, $possible)
212 822 35 unless $exchange->trading_date_can_differ
218 1 34 if $open_ti and $next_day->epoch + $open_ti->seconds <= $date->epoch
234 0 6 if (my $cache = $self->_get_cache("calendar_days_to_trade_date_after", $exchange, $when))
256 0 4 if (my $cache = $self->_get_cache("trading_days_between", $exchange, $begin, $end))
278 0 2 if (my $cache = $self->_get_cache("holiday_days_between", $exchange, $begin, $end))
316 2 8 if not $opening or $self->_is_in_trading_break($exchange, $date)
317 3 3 unless $date->is_before($opening) or $date->is_after($self->closing_on($exchange, $date))
361 51 30 if (my $cache = $self->_get_cache("opening_on", $exchange, $when))
382 46 21 if (my $cache = $self->_get_cache("closing_on", $exchange, $when))
428 30 15 if $when->day_of_week != 5
433 4 11 if ($exchange->symbol eq "FOREX" or $exchange->symbol eq "METAL")
456 4 23 unless $self->trades_on($exchange, $when)
460 3 20 if ($listed) { }
2 18 elsif (my $scheduled_changes = $self->regularly_adjusts_trading_hours_on($exchange, $when)) { }
464 2 0 if $scheduled_changes->{'daily_close'}
481 11 23 unless $self->trades_on($exchange, $when)
485 2 21 if ($listed) { }
0 21 elsif (my $scheduled_changes = $self->regularly_adjusts_trading_hours_on($exchange, $when)) { }
489 0 0 if $scheduled_changes->{'daily_open'}
514 17 5 if ($day_start != $start_epoch and $start_epoch < $end_epoch)
518 10 12 if ($day_end != $end_epoch and $start_epoch < $end_epoch)
525 7 15 if ($start_epoch < $end_epoch)
543 0 2 if $self->closing_on($exchange, $when)
549 2 0 if (not $self->closes_early_on($exchange, $possible) || $self->opens_late_on($exchange, $possible) and $self->trades_on($exchange, $possible))
573 0 2 unless $self->trades_on($exchange, $when)
579 1 1 if (defined $breaks)
636 50 24 unless $holiday
639 22 2 if &first(sub {
650 1 8 if (my $breaks = $self->trading_breaks($exchange, $when))
652 1 0 if ($when->epoch >= $break_interval->[0]->epoch and $when->epoch <= $break_interval->[1]->epoch)
695 112 0 ref $date ? :
698 97 15 if ($self->trades_on($exchange, $that_midnight))
702 64 33 if ($which eq "trading_breaks")
704 0 64 $extended_trading_breaks && $when->day_of_week == $extended_trading_breaks ? :
706 84 13 if ($ti)
707 51 33 if (ref $ti eq 'ARRAY') { }
708 0 51 $extended_lunch_hour ? :
723 132 0 ref $when ? :
725 33 99 if $self->is_in_dst_at($exchange, $epoch)
737 41 5 unless $partial_defined
741 5 0 if &first(sub {
780 0 0 if $self->is_open_at($exchange, $date)
784 0 0 unless (defined $market_opens->{'open'})
790 0 0 unless ($market_opens->{'open'})
794 0 0 if ($date->is_after($close) and $date->is_before($open))
831 0 10 if $next_open and not $date->is_before($next_open)
836 2 8 unless ($open)
851 4 4 if (not $breaks) { }
853 2 2 if ($close and not $when->is_before($close)) { }
2 0 elsif ($when->is_before($open)) { }
0 0 elsif ($when->is_same_as($open) or $when->is_after($open) and $when->is_before($close) or $when->is_same_same($close)) { }
881 1 3 if ($close and not $when->is_before($close)) { }
0 3 elsif ($when->is_before($open)) { }
902 0 3 exists $breaks[$i + 1] ? :
904 1 2 if ($when->is_before($int_open) and $when->is_same_as($current_open) || $when->is_after($current_open)) { }
2 0 elsif ($when->is_same_as($int_open) or $when->is_after($int_open) and $when->is_before($int_close) or $when->is_same_as($int_close)) { }
0 0 elsif ($when->is_after($int_close) and $when->is_before($next_open)) { }
954 16 6 if ($end_epoch - $start_epoch > $full_day - 1)
973 42 7 if ($self->trades_on($exchange, $when))
991 42 0 if (my $breaks = $self->trading_breaks($exchange, $when))
1000 0 42 if ($total_lunch_break_time < 0)
1007 0 42 if ($total_trading_time < 0)