Branch Coverage

blib/lib/Finance/Calendar.pm
Criterion Covered Total %
branch 111 142 78.1


line true false branch
94 8 534 unless exists $self->_cache->{$method_name}
122 208 112 if (my $cache = $self->_get_cache("trades_on", $exchange, $when))
127 47 65 @{$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 17 if (my $cache = $self->_get_cache("trade_date_after", $exchange, $begin))
189 17 13 if $self->trades_on($exchange, $possible)
212 1002 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 3 14 if not $opening or $self->_is_in_trading_break($exchange, $date)
317 3 7 unless $date->is_before($opening) or $date->is_after($self->closing_on($exchange, $date))
361 68 40 if (my $cache = $self->_get_cache("opening_on", $exchange, $when))
382 53 25 if (my $cache = $self->_get_cache("closing_on", $exchange, $when))
428 38 19 if $when->day_of_week != 5
433 4 15 if ($exchange->symbol eq "FOREX" or $exchange->symbol eq "METAL")
456 4 27 unless $self->trades_on($exchange, $when)
460 3 24 if ($listed) { }
2 22 elsif (my $scheduled_changes = $self->regularly_adjusts_trading_hours_on($exchange, $when)) { }
464 2 0 if $scheduled_changes->{'daily_close'}
481 13 31 unless $self->trades_on($exchange, $when)
485 2 29 if ($listed) { }
0 29 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 58 24 unless $holiday
639 22 2 if &first(sub {
650 5 11 if (my $breaks = $self->trading_breaks($exchange, $when))
652 2 3 if ($when->epoch >= $break_interval->[0]->epoch and $when->epoch <= $break_interval->[1]->epoch)
695 143 0 ref $date ? :
698 126 17 if ($self->trades_on($exchange, $that_midnight))
702 81 45 if ($which eq "trading_breaks")
704 0 81 $extended_trading_breaks && $when->day_of_week == $extended_trading_breaks ? :
706 106 20 if ($ti)
707 61 45 if (ref $ti eq 'ARRAY') { }
708 0 61 $extended_lunch_hour ? :
723 161 0 ref $when ? :
725 46 115 if $self->is_in_dst_at($exchange, $epoch)
737 53 5 unless $partial_defined
741 5 0 if &first(sub {
780 0 7 if $self->is_open_at($exchange, $date)
784 4 3 unless (defined $market_opens->{'open'})
790 3 0 unless ($market_opens->{'open'})
797 1 1 if ($date->is_after($close) and $date->is_before($open)) { }
1 0 elsif ($date->is_before($close) and $date->is_after($date->truncate_to_day)) { }
805 1 0 unless (@$trading_breaks)
842 0 17 if $next_open and not $date->is_before($next_open)
847 2 15 unless ($open)
862 7 8 if (not $breaks) { }
864 4 3 if ($close and not $when->is_before($close)) { }
3 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)) { }
892 3 5 if ($close and not $when->is_before($close)) { }
1 4 elsif ($when->is_before($open)) { }
913 0 4 exists $breaks[$i + 1] ? :
915 1 3 if ($when->is_before($int_open) and $when->is_same_as($current_open) || $when->is_after($current_open)) { }
3 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)) { }
965 16 6 if ($end_epoch - $start_epoch > $full_day - 1)
984 42 7 if ($self->trades_on($exchange, $when))
1002 42 0 if (my $breaks = $self->trading_breaks($exchange, $when))
1011 0 42 if ($total_lunch_break_time < 0)
1018 0 42 if ($total_trading_time < 0)