Browse Source

Test

etomic
jl777 8 years ago
parent
commit
6b22e3fac3
  1. 10
      iguana/exchanges/LP_prices.c

10
iguana/exchanges/LP_prices.c

@ -306,7 +306,7 @@ char *LP_orderbook(char *base,char *rel)
now = (uint32_t)time(NULL);
HASH_ITER(hh,LP_cacheinfos,ptr,tmp)
{
if ( ptr->timestamp < now-60 || ptr->price == 0. )
if ( ptr->timestamp < now-60*2 || ptr->price == 0. )
continue;
if ( strcmp(ptr->Q.srccoin,base) == 0 && strcmp(ptr->Q.destcoin,rel) == 0 )
{
@ -329,7 +329,15 @@ char *LP_orderbook(char *base,char *rel)
jaddnum(retjson,"numbids",numbids);
array = cJSON_CreateArray();
if ( numasks > 1 )
{
for (i=0; i<numasks; i++)
printf("%.8f ",asks[i]->price);
printf(" -> ");
qsort(asks,numasks,sizeof(*asks),_cmp_orderbook);
for (i=0; i<numasks; i++)
printf("%.8f ",asks[i]->price);
printf("sorted asks.%d\n",numasks);
}
for (i=0; i<numasks; i++)
jaddi(array,LP_orderbookjson(asks[i],1));
jadd(retjson,"asks",array);

Loading…
Cancel
Save