Branch Coverage

blib/lib/Finance/Nadex.pm
Criterion Covered Total %
branch 158 264 59.8


line true false branch
38 0 0 unless $self->logged_in
53 0 0 unless $self->logged_in
57 0 0 unless scalar @orders
70 0 0 unless $self->logged_in
74 0 0 unless exists $args{'id'}
76 0 0 unless $args{'id'}
92 0 0 unless $cancelled_response
104 6 12 unless $self->logged_in
109 2 10 unless exists $args{'price'}
112 1 9 unless exists $args{'direction'}
115 1 8 unless exists $args{'epic'}
118 1 7 unless exists $args{'size'}
123 0 7 unless $args{'epic'}
129 1 6 unless $self->_is_valid_price($args{"price"}, $contract->type)
132 1 5 unless $self->_is_valid_direction($args{"direction"})
133 0 5 unless $contract
138 1 4 unless $self->_is_valid_size($args{"size"})
141 2 2 if $args{'direction'} eq "buy"
142 1 3 if $args{'direction'} eq "sell"
147 3 1 if $contract->type eq "binary"
167 4 0 if defined $order
177 0 7 unless $self->logged_in
182 0 7 unless exists $args{'epic'}
185 0 7 unless $args{'epic'}
190 0 7 unless $epic_ref
194 0 7 unless exists $epic_ref->{'instrument'} and exists $epic_ref->{'marketSnapshot'}
198 0 7 unless $epic_ref->{'instrument'}{'instrumentType'} and $epic_ref->{'instrument'}{'marketName'} and $epic_ref->{'instrument'}{'displayPrompt'}
221 0 5 unless $self->logged_in
226 2 3 unless exists $args{'market'}
229 1 2 unless exists $args{'instrument'}
232 1 1 unless exists $args{'series'}
235 0 1 unless $args{'market'}
237 0 1 unless $args{'instrument'}
239 0 1 unless $args{'series'}
242 0 1 if exists $index_name{$args{'instrument'}}
246 0 1 unless $market_list_ref
255 0 1 unless $market_id
260 0 1 unless $instruments_list_ref
267 1 0 if $instrument->{'name'} eq $args{'instrument'}
270 0 1 unless $instrument_id
275 0 1 unless $instrument_list_ref
281 1 0 if $series->{'name'} eq $args{'series'}
284 0 1 unless $time_series_id
290 0 1 unless $series_list_ref
309 0 6 unless $self->logged_in
314 2 4 unless exists $args{'period'}
317 0 4 unless exists $args{'market'}
322 1 1 unless exists $args{'time'} or exists $args{'period'} and $args{'period'} =~ /^event$/i
325 1 2 unless exists $args{'instrument'}
328 0 2 unless exists $args{'strike'}
331 0 2 unless $args{'period'}
333 0 2 unless $args{'market'}
337 0 1 unless $args{'time'} or exists $args{'period'} and $args{'period'} =~ /^event$/i
339 0 2 unless $args{'instrument'}
341 0 2 unless $args{'strike'}
343 2 0 if exists $args{'period'}
345 1 1 if exists $args{'time'}
349 0 2 unless $market_list_ref
358 0 2 unless $market_id
362 0 2 unless $market_list_ref
371 0 2 unless $market_id
375 0 2 unless $market_list_ref
382 1 1 if $args{'period'} eq "Daily"
383 0 2 if $args{'period'} eq "Intraday"
384 0 2 if $args{'period'} eq "Weekly"
385 1 1 if $args{'period'} eq "Event"
387 0 2 unless $target_period_time
397 0 2 unless $market_id
401 0 2 unless $market_list_ref
407 1 1 if exists $args{'time'}
408 1 1 unless exists $args{'time'}
409 2 0 if ($market->{'instrumentName'} =~ /$args{'strike'}( \($args{'time'}\))?$/)
425 0 2 unless $self->logged_in
430 1 1 unless exists $args{'name'}
433 0 1 unless $args{'name'}
437 0 1 unless $market_list_ref
446 0 1 unless $market_id
450 0 1 unless $market_list_ref
465 0 1 unless $self->logged_in
470 0 1 unless $market_list_ref
488 0 4 unless $self->logged_in
492 0 4 if exists $args{'instrument'} and $index_name{$args{'instrument'}}
496 2 2 unless exists $args{'market'}
499 1 1 unless exists $args{'instrument'}
503 0 1 unless $market_list_ref
512 0 1 unless $market_id
517 0 1 unless $market_list_ref
524 1 0 if $instrument->{'name'} eq $args{'instrument'}
527 0 1 if $instrument->{'name'} eq "Forex" and $args{'market'} eq "5 Minute Binaries"
530 0 1 if $instrument->{'name'} eq "Indices" and $args{'market'} eq "20 Minute Binaries"
533 0 1 unless $instrument_id
538 0 1 unless $market_list_ref
542 0 1 if ($args{'market'} eq "5 Minute Binaries" or $args{'market'} eq "20 Minute Binaries")
548 0 0 if $instrument->{'name'} eq $args{'instrument'}
551 0 0 unless $instrument_id
556 0 0 unless $market_list_ref
581 11 54 unless $self->{'security_token'}
583 0 54 unless $self->{'session_id'}
596 0 0 unless exists $args{'username'} or exists $self->{'username'}
599 0 0 unless exists $args{'password'} or exists $self->{'password'}
601 12 0 if exists $args{'username'}
602 12 0 if exists $args{'password'}
630 0 23 if (exists $args{'platform'} and $args{'platform'} eq 'demo') { }
655 1 2 unless $self->logged_in
659 1 1 unless exists $args{'id'}
660 0 1 unless $args{'id'}
668 0 1 unless $order_ref
678 1 1 unless $self->logged_in
685 0 1 unless $order_list_ref
702 1 2 unless $self->logged_in
707 1 1 unless exists $args{'id'}
709 0 1 unless $args{'id'}
717 0 1 unless $position_ref
727 1 1 unless $self->logged_in
734 0 1 unless $position_list_ref
764 0 0 if $response->header("X-SECURITY-TOKEN")
789 29 0 if $response->header("X-SECURITY-TOKEN")
814 15 1 if $response->header("X-SECURITY-TOKEN")
831 9 2 if (not exists $args{'accept_match'} or $args{'accept_match'} == 0) { }
832 7 2 if ($market->{'name'} eq $args{'name'})
837 2 0 if ($market->{'name'} =~ /$args{'name'}/ or $market->{'name'} eq $args{'name'})
853 11 0 if $key =~ /JSESSIONID/
863 1 6 if $price =~ /-|\+/
865 5 1 if ($type eq "binary")
866 0 5 unless $price =~ /^(\d+\.\d{1,2}|\.\d{1,2}|\d+)$/
868 5 0 if ($price =~ /\.(\d+)/)
869 0 0 if $1 != 0 and $1 != 25 and $1 != 50 and $1 != 75
873 1 5 if ($type eq "spread")
874 0 1 unless $price =~ /^(\d+|\d+\.\d{1,4})$/
887 5 1 exists $valid{$direction} ? :
895 1 4 unless $size =~ /^\d+$/
897 0 4 if $size == 0