Branch Coverage

blib/lib/Finance/Calendar.pm
Criterion Covered Total %
branch 129 160 80.6


line true false branch
94 11 595 unless exists $self->_cache->{$method_name}
122 219 143 if (my $cache = $self->_get_cache("trades_on", $exchange, $when))
127 74 69 @{$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 1153 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 51 if (my $cache = $self->_get_cache("opening_on", $exchange, $when))
382 53 36 if (my $cache = $self->_get_cache("closing_on", $exchange, $when))
459 10 78 if ($day_of_week == 0) { }
34 44 elsif ($day_of_week == 5) { }
460 8 2 if ($exchange->symbol =~ /^(TACTICAL_FOREX.*|TACTICAL_METALS)$/)
463 8 0 if ($partial_trading)
464 4 4 $use_dst_time ? :
467 8 0 if ($open_time)
468 4 4 $use_dst_time ? :
482 4 30 if ($exchange->symbol =~ /^(FOREX|METAL)$/) { }
15 15 elsif ($exchange->symbol =~ /^(TACTICAL_FOREX.*|TACTICAL_METALS)$/) { }
490 6 9 $use_dst_time ? :
491 6 9 $use_dst_time ? :
515 4 40 unless $self->trades_on($exchange, $when)
519 3 37 if ($listed) { }
11 26 elsif (my $scheduled_changes = $self->regularly_adjusts_trading_hours_on($exchange, $when)) { }
523 11 0 if $scheduled_changes->{'daily_close'}
540 13 42 unless $self->trades_on($exchange, $when)
544 2 40 if ($listed) { }
8 32 elsif (my $scheduled_changes = $self->regularly_adjusts_trading_hours_on($exchange, $when)) { }
548 8 0 if $scheduled_changes->{'daily_open'}
573 17 5 if ($day_start != $start_epoch and $start_epoch < $end_epoch)
577 10 12 if ($day_end != $end_epoch and $start_epoch < $end_epoch)
584 7 15 if ($start_epoch < $end_epoch)
602 0 2 if $self->closing_on($exchange, $when)
608 2 0 if (not $self->closes_early_on($exchange, $possible) || $self->opens_late_on($exchange, $possible) and $self->trades_on($exchange, $possible))
632 0 2 unless $self->trades_on($exchange, $when)
638 1 1 if (defined $breaks)
695 85 24 unless $holiday
698 22 2 if &first(sub {
709 5 11 if (my $breaks = $self->trading_breaks($exchange, $when))
711 2 3 if ($when->epoch >= $break_interval->[0]->epoch and $when->epoch <= $break_interval->[1]->epoch)
754 149 0 ref $date ? :
757 132 17 if ($self->trades_on($exchange, $that_midnight))
761 81 51 if ($which eq "trading_breaks")
763 0 81 $extended_trading_breaks && $when->day_of_week == $extended_trading_breaks ? :
765 112 20 if ($ti)
766 61 51 if (ref $ti eq 'ARRAY') { }
767 0 61 $extended_lunch_hour ? :
782 167 0 ref $when ? :
784 46 121 if $self->is_in_dst_at($exchange, $epoch)
796 77 5 unless $partial_defined
800 5 0 if &first(sub {
839 0 7 if $self->is_open_at($exchange, $date)
843 4 3 unless (defined $market_opens->{'open'})
849 3 0 unless ($market_opens->{'open'})
856 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)) { }
864 1 0 unless (@$trading_breaks)
901 0 17 if $next_open and not $date->is_before($next_open)
906 2 15 unless ($open)
921 7 8 if (not $breaks) { }
923 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)) { }
951 3 5 if ($close and not $when->is_before($close)) { }
1 4 elsif ($when->is_before($open)) { }
972 0 4 exists $breaks[$i + 1] ? :
974 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)) { }
1024 16 6 if ($end_epoch - $start_epoch > $full_day - 1)
1043 42 7 if ($self->trades_on($exchange, $when))
1061 42 0 if (my $breaks = $self->trading_breaks($exchange, $when))
1070 0 42 if ($total_lunch_break_time < 0)
1077 0 42 if ($total_trading_time < 0)