Browse Source

Test

etomic
jl777 7 years ago
parent
commit
c9a5374bdf
  1. 5
      iguana/exchanges/LP_ordermatch.c

5
iguana/exchanges/LP_ordermatch.c

@ -500,12 +500,14 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo **
printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr); printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr);
} }
mini = -1; mini = -1;
if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,utxos,m,targetval)) >= 0 && (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,utxos,m,targetval)) >= 0 )
{ {
up = utxos[mini]; up = utxos[mini];
utxos[mini] = 0; utxos[mini] = 0;
targetval2 = (targetval / 8) * 9 + 2*txfee; targetval2 = (targetval / 8) * 9 + 2*txfee;
printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval); printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(utxos[mini]->U.value),dstr(targetval),dstr(targetval2),(double)utxos[mini]->U.value/targetval);
if ( (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 )
{
if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 ) if ( (mini= LP_nearest_utxovalue(coin,utxos,m,targetval2 * 1.01)) >= 0 )
{ {
if ( up != 0 && (up2= utxos[mini]) != 0 ) if ( up != 0 && (up2= utxos[mini]) != 0 )
@ -518,6 +520,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo **
} }
} }
} else printf("cant find targetval2 %.8f\n",dstr(targetval2)); } else printf("cant find targetval2 %.8f\n",dstr(targetval2));
} else printf("failed ratio test %.8f\n",(double)utxos[mini]->U.value/targetval);
} else if ( targetval != 0 && mini >= 0 ) } else if ( targetval != 0 && mini >= 0 )
printf("targetval %.8f mini.%d ratio %.8f\n",dstr(targetval),mini,(double)utxos[mini]->U.value/targetval); printf("targetval %.8f mini.%d ratio %.8f\n",dstr(targetval),mini,(double)utxos[mini]->U.value/targetval);
} else printf("no utxos pass LP_address_utxo_ptrs filter\n"); } else printf("no utxos pass LP_address_utxo_ptrs filter\n");

Loading…
Cancel
Save