Branch Coverage

blib/lib/App/cryp/arbit/Strategy/merge_order_book.pm
Criterion Covered Total %
branch 73 138 52.9


line true false branch
43 1 16 if ($account_balances and $min_account_balances)
50 2 1 if (defined $min_account_balances->{$eacc} and defined $min_account_balances->{$eacc}{$cur})
62 2 50 if defined $max_order_pairs and @order_pairs >= $max_order_pairs
71 15 30 if ($account_balances)
74 6 9 unless (@{$$account_balances{$sell->{'exchange'}}{$base_currency} // [];})
81 11 39 unless $sell_index < @$all_buy_orders
91 0 37 if ($buy->{'exchange'} eq $sell->{'exchange'})
94 9 28 if ($account_balances)
96 1 8 unless (@{$$account_balances{$buy->{'exchange'}}{$buy->{'quote_currency'}} // [];})
103 3 36 unless $buy_index < @$all_sell_orders
112 17 19 unless ($opportunity)
114 17 0 if (App::cryp::arbit::_is_fiat($quote_currency))
130 1 35 if ($trading_profit_margin < $min_net_profit_margin)
157 8 27 if ($account_balances)
167 7 28 if (defined $max_order_quote_size)
172 8 27 if ($account_balances)
199 35 58 if ($which eq 'buy order') { }
35 23 elsif ($which eq 'sell order') { }
8 15 elsif ($which eq 'sell exchange balance') { }
8 7 elsif ($which eq 'buy exchange balance') { }
200 11 24 if ($used_up) { }
206 13 22 if ($used_up) { }
212 5 3 if ($used_up) { }
220 2 6 if ($used_up) { }
229 8 27 if ($account_balances)
235 26 9 unless $exchange_pairs
237 5 4 unless $pair_recs
240 4 0 if ($_->{'base_currency'} eq $base_currency)
244 0 4 unless $pair_rec
245 1 3 if (defined $pair_rec->{'min_base_size'} and $order_pair->{'base_size'} < $pair_rec->{'min_base_size'})
251 1 2 if (defined $pair_rec->{'min_quote_size'} and $quote_size < $pair_rec->{'min_quote_size'})
260 26 7 unless $exchange_pairs
262 2 5 unless $pair_recs
265 5 0 if ($_->{'base_currency'} eq $base_currency)
269 0 5 unless $pair_rec
270 1 4 if (defined $pair_rec->{'min_base_size'} and $order_pair->{'base_size'} < $pair_rec->{'min_base_size'})
276 2 2 if (defined $pair_rec->{'min_quote_size'} and $quote_size < $pair_rec->{'min_quote_size'})
298 0 30 if ($bcur eq $scur)
306 30 0 if $forex_spreads
308 0 30 unless (defined $spread)
320 1 29 if ($op->{'net_profit_margin'} < $min_net_profit_margin)
347 0 0 if $r->{'args'}{'ignore_balance'}
362 0 0 unless App::cryp::arbit::_is_fiat($cur)
363 0 0 if $cur eq 'USD'
364 0 0 if $seen{$cur}++
370 0 0 if ($fxres_low->[0] != 200)
377 0 0 if ($fxres_high->[0] != 200)
399 0 0 unless App::cryp::arbit::_is_fiat($cur)
400 0 0 unless grep {$cur eq $_;} @curs
402 0 0 unless @curs
408 0 0 if $cur1 eq $cur2
412 0 0 if ($fxres_low->[0] != 200)
419 0 0 if ($fxres_high->[0] != 200)
427 0 0 $r1 > $r2 ? :
442 0 0 unless grep {$_ eq $basecur;} @{$$r{'_stash'}{'base_currencies'};}
443 0 0 unless grep {$_ eq $quotecur;} @{$$r{'_stash'}{'quote_currencies'};}
446 0 0 if (App::cryp::arbit::_is_fiat($quotecur)) { }
450 0 0 unless grep {$_ eq $quotecur;} @{$fiat_for{$exchange};}
459 0 0 unless grep {$_ eq $pair;} @{$pairs_for{$exchange};}
502 0 0 if ($quote_currency0 eq ':fiat') { }
511 0 0 unless grep {$_ eq $pair;} @{$pairs_for{$exchange};}
516 0 0 unless ($res->[0] == 200)
524 0 0 unless (@{$res->[2]{'sell'};})
529 0 0 unless (@{$res->[2]{'buy'};})
557 0 0 if (not App::cryp::arbit::_is_fiat($quotecur) or $quotecur eq 'USD') { }
568 0 0 unless my $fxrate = $r->{'_stash'}{'forex_rates'}{"$quotecur/USD"}
601 0 0 if (keys %buy_orders < 2)
606 0 0 if (keys %sell_orders < 2)
654 0 0 if ($opportunity)