|
|
@ -572,13 +572,14 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char * |
|
|
|
|
|
|
|
char *LP_orderbook(char *base,char *rel) |
|
|
|
{ |
|
|
|
uint32_t now,i; struct LP_priceinfo *basepp=0,*relpp=0; struct LP_cacheinfo *ptr,*tmp; struct LP_orderbookentry *op,**bids = 0,**asks = 0; cJSON *retjson,*array; int32_t numbids=0,numasks=0,cachenumbids,cachenumasks,baseid,relid; |
|
|
|
uint32_t now,i; struct LP_priceinfo *basepp=0,*relpp=0; struct LP_orderbookentry **bids = 0,**asks = 0; cJSON *retjson,*array; int32_t numbids=0,numasks=0,cachenumbids,cachenumasks,baseid,relid; |
|
|
|
if ( (basepp= LP_priceinfofind(base)) == 0 || (relpp= LP_priceinfofind(rel)) == 0 ) |
|
|
|
return(clonestr("{\"error\":\"base or rel not added\"}")); |
|
|
|
baseid = basepp->ind; |
|
|
|
relid = relpp->ind; |
|
|
|
now = (uint32_t)time(NULL); |
|
|
|
HASH_ITER(hh,LP_cacheinfos,ptr,tmp) |
|
|
|
/*struct LP_cacheinfo *ptr,*tmp;
|
|
|
|
HASH_ITER(hh,LP_cacheinfos,ptr,tmp) |
|
|
|
{ |
|
|
|
if ( ptr->timestamp < now-3600*2 || ptr->price == 0. ) |
|
|
|
continue; |
|
|
@ -594,7 +595,7 @@ char *LP_orderbook(char *base,char *rel) |
|
|
|
if ( (op= LP_orderbookentry(base,rel,ptr->Q.txid,ptr->Q.vout,ptr->Q.txid2,ptr->Q.vout2,1./ptr->price,ptr->Q.satoshis,ptr->Q.srchash)) != 0 ) |
|
|
|
bids[numbids++] = op; |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
cachenumbids = numbids, cachenumasks = numasks; |
|
|
|
//printf("start cache.(%d %d) numbids.%d numasks.%d\n",cachenumbids,cachenumasks,numbids,numasks);
|
|
|
|
numasks = LP_orderbook_utxoentries(now,1,base,rel,&asks,numasks,cachenumasks); |
|
|
|