|
@ -855,7 +855,7 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char * |
|
|
|
|
|
|
|
|
char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
{ |
|
|
{ |
|
|
uint32_t now,i; int64_t depth; struct LP_priceinfo *basepp=0,*relpp=0; struct LP_orderbookentry **bids = 0,**asks = 0; cJSON *retjson,*array; struct iguana_info *basecoin,*relcoin; int32_t n,numbids=0,numasks=0,cachenumbids,cachenumasks,baseid,relid,suppress_prefetch=0; |
|
|
uint32_t now,i; int64_t depth,askdepth=0,biddepth=0; struct LP_priceinfo *basepp=0,*relpp=0; struct LP_orderbookentry **bids = 0,**asks = 0; cJSON *retjson,*array; struct iguana_info *basecoin,*relcoin; int32_t n,numbids=0,numasks=0,cachenumbids,cachenumasks,baseid,relid,suppress_prefetch=0; |
|
|
basecoin = LP_coinfind(base); |
|
|
basecoin = LP_coinfind(base); |
|
|
relcoin = LP_coinfind(rel); |
|
|
relcoin = LP_coinfind(rel); |
|
|
if ( basecoin == 0 || relcoin == 0 ) |
|
|
if ( basecoin == 0 || relcoin == 0 ) |
|
@ -902,6 +902,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
} |
|
|
} |
|
|
for (i=n=0; i<numbids; i++) |
|
|
for (i=n=0; i<numbids; i++) |
|
|
{ |
|
|
{ |
|
|
|
|
|
biddepth = bids[i]->depth; |
|
|
jaddi(array,LP_orderbookjson(rel,bids[i])); |
|
|
jaddi(array,LP_orderbookjson(rel,bids[i])); |
|
|
if ( suppress_prefetch == 0 && n < 3 && bids[i]->numutxos == 0 ) |
|
|
if ( suppress_prefetch == 0 && n < 3 && bids[i]->numutxos == 0 ) |
|
|
{ |
|
|
{ |
|
@ -923,9 +924,11 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
relcoin->lastmonitor -= 3600; |
|
|
relcoin->lastmonitor -= 3600; |
|
|
jadd(retjson,"bids",array); |
|
|
jadd(retjson,"bids",array); |
|
|
jaddnum(retjson,"numbids",numbids); |
|
|
jaddnum(retjson,"numbids",numbids); |
|
|
|
|
|
jaddnum(retjson,"biddepth",dstr(biddepth)); |
|
|
array = cJSON_CreateArray(); |
|
|
array = cJSON_CreateArray(); |
|
|
for (i=n=0; i<numasks; i++) |
|
|
for (i=n=0; i<numasks; i++) |
|
|
{ |
|
|
{ |
|
|
|
|
|
askdepth = asks[i]->depth; |
|
|
jaddi(array,LP_orderbookjson(base,asks[i])); |
|
|
jaddi(array,LP_orderbookjson(base,asks[i])); |
|
|
if ( suppress_prefetch == 0 && n < 3 && asks[i]->numutxos == 0 ) |
|
|
if ( suppress_prefetch == 0 && n < 3 && asks[i]->numutxos == 0 ) |
|
|
{ |
|
|
{ |
|
@ -947,6 +950,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
basecoin->lastmonitor -= 3600; |
|
|
basecoin->lastmonitor -= 3600; |
|
|
jadd(retjson,"asks",array); |
|
|
jadd(retjson,"asks",array); |
|
|
jaddnum(retjson,"numasks",numasks); |
|
|
jaddnum(retjson,"numasks",numasks); |
|
|
|
|
|
jaddnum(retjson,"askdepth",dstr(askdepth)); |
|
|
jaddstr(retjson,"base",base); |
|
|
jaddstr(retjson,"base",base); |
|
|
jaddstr(retjson,"rel",rel); |
|
|
jaddstr(retjson,"rel",rel); |
|
|
jaddnum(retjson,"timestamp",now); |
|
|
jaddnum(retjson,"timestamp",now); |
|
|