Branch Coverage

blib/lib/App/cryp/arbit.pm
Criterion Covered Total %
branch 1 230 0.4


line true false branch
498 0 0 if ($r->{'args'}{'usd_rates'} and $r->{'args'}{'usd_rates'}{$cur}) { }
503 0 0 unless $fxres->[0] == 200 or $fxres->[0] == 304
506 0 0 if (not $rate_mem{$cur} or $rate_mem{$cur} != $fxres->[2]{'rate'})
522 0 0 if $r->{'_stash'}{'exchange_ids'}{$exchange}
526 0 0 unless $rec
531 0 0 unless ($eid)
545 0 0 if $r->{'_stash'}{'account_ids'}{$exchange}{$account}
552 0 0 unless ($aid)
582 0 0 unless (defined $account)
584 0 0 unless keys %$h
591 0 0 if $r->{'_stash'}{'exchange_clients'}{$exchange}{$account}
598 0 0 unless ($r->{'_cryp'}{'exchanges'}{$exchange}{$account})
604 0 0 unless ($client_args{'api_key'})
626 0 0 unless ($res->[0] == 200)
660 0 0 if $r->{'_stash'}{'exchange_pairs'}{$exchange}
665 0 0 if ($res->[0] == 200) { }
688 17 0 $Locale::Codes::Data{'currency'}{'code2id'}{'alpha'}{uc $code} ? :
705 0 0 unless exists $r->{'args'}{'accounts'}
710 0 0 unless $r->{'args'}{'accounts'} and @{$r->{'args'}{'accounts'};} >= 2
712 0 0 unless m[(.+)/(.+)]
714 0 0 unless (exists $account_exchanges{$xchg})
715 0 0 unless $xcat->by_safename($xchg)
720 0 0 unless keys %account_exchanges >= 2
731 0 0 if $opts->{'skip_connect'}
746 0 0 if $opts->{'skip_connect'}
752 0 0 unless $res->[0] == 200
779 0 0 if (_is_fiat($quotecur)) { }
794 0 0 if (grep {':fiat';} @possible_quotecurs)
799 0 0 if (@quotecurs_arg) { }
802 0 0 if (grep {$c eq $_;} @possible_quotecurs) { }
808 0 0 if (@impossible_quotecurs)
835 0 0 unless grep {$_ eq $quotecur;} @{$$r{'_stash'}{'quote_currencies'};}
845 0 0 if (@basecurs_arg) { }
848 0 0 if (grep {$c eq $_;} @possible_basecurs) { }
854 0 0 if (@impossible_basecurs)
864 0 0 unless @basecurs
890 0 0 _is_fiat($buy_currency) ? :
908 0 0 if (_is_fiat($buy_currency) and $buy_currency ne 'USD')
912 0 0 if (_is_fiat($sell_currency) and $sell_currency ne 'USD')
981 0 0 unless ($dbh->do("INSERT INTO order_pair (\n ctime,\n base_currency, base_size,\n expected_net_profit_margin, expected_net_profit,\n\n buy_exchange_id , buy_account_id , buy_quote_currency , buy_gross_price_orig , buy_gross_price , buy_status,\n sell_exchange_id, sell_account_id, sell_quote_currency, sell_gross_price_orig, sell_gross_price, sell_status\n\n ) VALUES (\n ?,\n ?, ?,\n ?, ?,\n\n ?, ?, ?, ?, ?, ?,\n ?, ?, ?, ?, ?, ?\n )", {}, $time, $op->{'base_currency'}, $op->{'base_size'}, $op->{'net_profit_margin'}, $op->{'net_profit'}, $buy_eid, $buy_aid, $buy_quotecur, $buy->{'gross_price_orig'}, $buy->{'gross_price'}, 'creating', $sell_eid, $sell_aid, $sell_quotecur, $sell->{'gross_price_orig'}, $sell->{'gross_price'}, 'creating'))
997 0 0 unless ($res->[0] == 200)
1009 0 0 unless ($res2->[0] == 200)
1019 0 0 unless ($dbh->do('UPDATE order_pair SET buy_ctime=?, buy_order_id=?, buy_actual_price=?, buy_actual_base_size=?, buy_status=? WHERE id=?', {}, $res2->[2]{'create_time'}, $buy_order_id, $res->[2]{'price'}, $res->[2]{'base_size'}, 'open', $pair_id))
1034 0 0 unless ($res->[0] == 200)
1046 0 0 unless ($res2->[0] == 200)
1056 0 0 unless ($dbh->do('UPDATE order_pair SET sell_ctime=?, sell_order_id=?, sell_actual_price=?, sell_actual_base_size=?, sell_status=? WHERE id=?', {}, $res2->[2]{'create_time'}, $sell_order_id, $res->[2]{'price'}, $res->[2]{'base_size'}, 'open', $pair_id))
1063 0 0 unless $is_err
1064 0 0 if ($do_cancel_buy_order_on_err)
1071 0 0 if ($res->[0] != 200) { }
1078 0 0 if ($do_cancel_sell_order_on_err)
1085 0 0 if ($res->[0] != 200) { }
1107 0 0 unless $res->[0] == 200
1146 0 0 unless $res->[0] == 200
1147 0 0 unless $res->[0] == 200
1154 0 0 unless $res->[0] == 200
1223 0 0 unless $args{'min_net_profit_margin'} > 0
1227 0 0 unless $res->[0] == 200
1228 0 0 unless $res->[0] == 200
1244 0 0 if ($res->[0] == 200) { }
1254 0 0 if ($args{'-dry_run'})
1255 0 0 if ($args{'rounds'} == 1) { }
1268 0 0 if $args{'rounds'} > 0 and $round >= $args{'rounds'}
1303 0 0 unless $res->[0] == 200
1304 0 0 unless $res->[0] == 200
1319 0 0 unless grep {$_ eq $basecur;} @{$$r{'_stash'}{'base_currencies'};}
1320 0 0 unless grep {$_ eq $quotecur;} @{$$r{'_stash'}{'quote_currencies'};}
1323 0 0 if (_is_fiat($quotecur)) { }
1327 0 0 unless grep {$_ eq $quotecur;} @{$fiat_for{$exchange};}
1336 0 0 unless grep {$_ eq $pair;} @{$pairs_for{$exchange};}
1353 0 0 if ($quote_currency0 eq ':fiat') { }
1362 0 0 unless grep {$_ eq $pair;} @{$pairs_for{$exchange};}
1367 0 0 unless ($res->[0] == 200)
1377 0 0 unless ($res->[2]{$type} and @{$res->[2]{$type};})
1416 0 0 unless ($dbh->do('UPDATE order_pair SET buy_status=? WHERE id=?', {}, $status, $id))
1421 0 0 $summary ? :
1436 0 0 unless ($dbh->do('UPDATE order_pair SET sell_status=? WHERE id=?', {}, $status, $id))
1441 0 0 $summary ? :
1456 0 0 unless ($dbh->do('UPDATE order_pair SET buy_filled_base_size=? WHERE id=?', {}, $size, $id))
1461 0 0 $summary ? :
1476 0 0 unless ($dbh->do('UPDATE order_pair SET sell_filled_base_size=? WHERE id=?', {}, $size, $id))
1481 0 0 $summary ? :
1522 0 0 if $op->{'buy_status'} =~ /\A(done|cancelled)\z/
1525 0 0 if ($res->[0] == 404) { }
0 0 elsif ($res->[0] != 200) { }
1539 0 0 if ($status eq 'open' and $time - $op->{'ctime'} > $r->{'args'}{'max_order_age'})
1542 0 0 if ($cancelres->[0] != 200) { }
1552 0 0 if $op->{'sell_status'} =~ /\A(done|cancelled)\z/
1555 0 0 if ($res->[0] == 404) { }
0 0 elsif ($res->[0] != 200) { }
1569 0 0 if ($status eq 'open' and $time - $op->{'ctime'} > $r->{'args'}{'max_order_age'})
1572 0 0 if ($cancelres->[0] != 200) { }
1608 0 0 unless $res->[0] == 200
1643 0 0 unless $res->[0] == 200
1649 0 0 if (defined $args{'open'})
1650 0 0 if ($args{'open'}) { }
1656 0 0 if ($args{'time_start'})
1660 0 0 if ($args{'time_end'})
1664 0 0 @wheres ? :
1695 0 0 defined $op->{'buy_filled_base_size'} ? :
0 0 defined $op->{'sell_filled_base_size'} ? :
1738 0 0 unless $res->[0] == 200
1744 0 0 if ($args{'time_start'})
1748 0 0 if ($args{'time_end'})
1752 0 0 @wheres ? :
1773 0 0 unless defined $op->{'buy_filled_base_size'} and $op->{'buy_filled_base_size'}
1792 0 0 $op->{'buy_account'} eq 'default' ? :
1795 0 0 if $args{'detail'}
1798 0 0 unless defined $op->{'sell_filled_base_size'} and $op->{'sell_filled_base_size'}
1817 0 0 $op->{'sell_account'} eq 'default' ? :
1820 0 0 if $args{'detail'}
1832 0 0 $i++ ? :
1844 0 0 $i++ ? :
1847 0 0 if exists $per_currency_sums_usd{$cur}
1864 0 0 if _is_fiat($cur)
1865 0 0 if $per_currency_sums{$cur} == 0