Browse Source

Test

etomic
jl777 8 years ago
parent
commit
b669071678
  1. 10
      iguana/exchanges/LP_ordermatch.c
  2. 12
      iguana/exchanges/LP_prices.c

10
iguana/exchanges/LP_ordermatch.c

@ -594,7 +594,7 @@ struct LP_utxoinfo *LP_bestutxo(double *ordermatchpricep,int64_t *bestdestsatosh
{ {
if ( bestprice == 0. ) // assumes price ordered asks if ( bestprice == 0. ) // assumes price ordered asks
bestprice = price; bestprice = price;
//printf("item.[%d] %s\n",i,jprint(item,0)); printf("item.[%d] %s\n",i,jprint(item,0));
txid = jbits256(item,"txid"); txid = jbits256(item,"txid");
vout = jint(item,"vout"); vout = jint(item,"vout");
vol = jdouble(item,"volume"); vol = jdouble(item,"volume");
@ -634,10 +634,14 @@ struct LP_utxoinfo *LP_bestutxo(double *ordermatchpricep,int64_t *bestdestsatosh
if ( butxo != 0 ) if ( butxo != 0 )
printf("%llu %llu %d %d %d: ",(long long)(vol*SATOSHIDEN),(long long)butxo->S.satoshis,vol*SATOSHIDEN == butxo->S.satoshis,LP_isavailable(butxo) > 0,LP_ismine(butxo) == 0); printf("%llu %llu %d %d %d: ",(long long)(vol*SATOSHIDEN),(long long)butxo->S.satoshis,vol*SATOSHIDEN == butxo->S.satoshis,LP_isavailable(butxo) > 0,LP_ismine(butxo) == 0);
printf("cant find butxo.%p or value mismatch %.8f != %.8f or bestflag.%d\n",butxo,vol,butxo!=0?dstr(butxo->S.satoshis):0,butxo->T.bestflag); printf("cant find butxo.%p or value mismatch %.8f != %.8f or bestflag.%d\n",butxo,vol,butxo!=0?dstr(butxo->S.satoshis):0,butxo->T.bestflag);
//if ( (butxo= LP_utxofind(1,txid,vout)) != 0 && (long long)(vol*SATOSHIDEN) == butxo->S.satoshis && LP_isavailable(butxo) > 0 && LP_ismine(butxo) == 0 && butxo->T.bestflag == 0 )
} }
} else printf("self trading or blacklisted peer\n"); } else printf("self trading or blacklisted peer\n");
} else break; }
else
{
printf("maxprice %.8f vs %.8f\n",maxprice,price);
break;
}
} }
} }
free_json(orderbook); free_json(orderbook);

12
iguana/exchanges/LP_prices.c

@ -584,13 +584,13 @@ char *LP_orderbook(char *base,char *rel,int32_t duration)
qsort(bids,numbids,sizeof(*bids),_cmp_orderbook); qsort(bids,numbids,sizeof(*bids),_cmp_orderbook);
if ( numasks > 1 ) if ( numasks > 1 )
{ {
for (i=0; i<numasks; i++) //for (i=0; i<numasks; i++)
printf("%.8f ",asks[i]->price); // printf("%.8f ",asks[i]->price);
printf(" -> "); //printf(" -> ");
qsort(asks,numasks,sizeof(*asks),_cmp_orderbook); qsort(asks,numasks,sizeof(*asks),_cmp_orderbook);
for (i=0; i<numasks; i++) //for (i=0; i<numasks; i++)
printf("%.8f ",asks[i]->price); // printf("%.8f ",asks[i]->price);
printf("sorted asks.%d\n",numasks); //printf("sorted asks.%d\n",numasks);
} }
for (i=0; i<numbids; i++) for (i=0; i<numbids; i++)
{ {

Loading…
Cancel
Save