Browse Source

Test

etomic
jl777 8 years ago
parent
commit
8e04818a37
  1. 5
      iguana/exchanges/LP_prices.c

5
iguana/exchanges/LP_prices.c

@ -572,12 +572,13 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char *
char *LP_orderbook(char *base,char *rel) 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 ) if ( (basepp= LP_priceinfofind(base)) == 0 || (relpp= LP_priceinfofind(rel)) == 0 )
return(clonestr("{\"error\":\"base or rel not added\"}")); return(clonestr("{\"error\":\"base or rel not added\"}"));
baseid = basepp->ind; baseid = basepp->ind;
relid = relpp->ind; relid = relpp->ind;
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
/*struct LP_cacheinfo *ptr,*tmp;
HASH_ITER(hh,LP_cacheinfos,ptr,tmp) HASH_ITER(hh,LP_cacheinfos,ptr,tmp)
{ {
if ( ptr->timestamp < now-3600*2 || ptr->price == 0. ) if ( ptr->timestamp < now-3600*2 || ptr->price == 0. )
@ -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 ) 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; bids[numbids++] = op;
} }
} }*/
cachenumbids = numbids, cachenumasks = numasks; cachenumbids = numbids, cachenumasks = numasks;
//printf("start cache.(%d %d) numbids.%d numasks.%d\n",cachenumbids,cachenumasks,numbids,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); numasks = LP_orderbook_utxoentries(now,1,base,rel,&asks,numasks,cachenumasks);

Loading…
Cancel
Save