diff --git a/iguana/exchanges/LP_RTmetrics.c b/iguana/exchanges/LP_RTmetrics.c index ebadeec52..c44c86dbe 100644 --- a/iguana/exchanges/LP_RTmetrics.c +++ b/iguana/exchanges/LP_RTmetrics.c @@ -20,8 +20,10 @@ struct LP_metricinfo { + double metric; + double price,balance,minvol; bits256 pubkey; - double metric,price,balance,minvol,maxvol; + double maxvol; int32_t ind,numutxos,age,pendingswaps; }; @@ -181,7 +183,10 @@ double _LP_RTmetric_calc(struct LP_metricinfo *mp,double bestprice,double maxpri int32_t n; double metric,origmetric = (mp->price / bestprice); metric = origmetric; if ( mp->numutxos == 0 || relvolume == 0. || mp->maxvol == 0. || mp->balance == 0. ) + { + printf("skip i.%d as no info\n",mp->ind); return(metric * 100.); + } if ( relvolume < mp->minvol ) { metric *= (mp->minvol / relvolume); @@ -205,8 +210,8 @@ double _LP_RTmetric_calc(struct LP_metricinfo *mp,double bestprice,double maxpri if ( (n= mp->pendingswaps) > 0 ) while ( n-- > 0 ) metric *= 1.1; - if ( metric != origmetric ) - printf("price %.8f orig %.8f -> %.8f relvol %.8f min %.8f max %.8f bal %.8f age.%d pend.%d\n",mp->price,origmetric,metric,relvolume,mp->minvol,mp->maxvol,mp->balance,mp->age,mp->pendingswaps); + //if ( metric != origmetric ) + printf("i.%d price %.8f orig %.8f -> %.8f relvol %.8f min %.8f max %.8f bal %.8f age.%d pend.%d\n",mp->ind,mp->price,origmetric,metric,relvolume,mp->minvol,mp->maxvol,mp->balance,mp->age,mp->pendingswaps); return(metric); } @@ -226,7 +231,7 @@ void LP_RTmetric_calc(struct LP_metricinfo *sortbuf,int32_t ind,cJSON *item,doub cJSON *LP_RTmetrics_sort(char *base,char *rel,cJSON *rawasks,int32_t numasks,double maxprice,double relvolume) { - cJSON *array,*item; int32_t i,num,groupi; double price,prevdepth,bestprice; struct LP_metricinfo *sortbuf; + cJSON *array=rawasks,*item; int32_t i,num,groupi; double price,prevdepth,bestprice; struct LP_metricinfo *sortbuf; groupi = -1; bestprice = 0.; for (num=i=0; i 0 ) + if ( groupi > 0 ) { sortbuf = calloc(groupi+1,sizeof(*sortbuf)); prevdepth = 0.; @@ -255,7 +260,7 @@ cJSON *LP_RTmetrics_sort(char *base,char *rel,cJSON *rawasks,int32_t numasks,dou array = cJSON_CreateArray(); for (i=0; i<=groupi; i++) { - printf("(%d -> %d) ",i,sortbuf[i].ind); + printf("(%d -> %d %.3f) ",i,sortbuf[i].ind,sortbuf[i].metric); item = jitem(rawasks,sortbuf[i].ind); jaddi(array,jduplicate(item)); } @@ -263,6 +268,6 @@ cJSON *LP_RTmetrics_sort(char *base,char *rel,cJSON *rawasks,int32_t numasks,dou jaddi(array,jduplicate(jitem(rawasks,i))); printf("new ask order for %d of %d, capped at num.%d\n",groupi,numasks,num); free(sortbuf); - } else array = rawasks; + } return(array); } diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7c519636e..395866af8 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -208,7 +208,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock, } else { - printf("packet not for this node %u\n",crc32); + //printf("packet not for this node %u\n",crc32); } } else printf("error (%s) method is %s\n",jsonstr,method); } diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 65cbcefb0..0238e398b 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -575,10 +575,10 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba if ( rawtx->I.redeemlen > 0 && rawtx->I.redeemlen < 0x100 ) { memcpy(rawtx->redeemscript,&data[datalen],rawtx->I.redeemlen); - for (i=0; iI.redeemlen; i++) - printf("%02x",rawtx->redeemscript[i]); + //for (i=0; iI.redeemlen; i++) + // printf("%02x",rawtx->redeemscript[i]); bitcoin_address(redeemaddr,rawtx->coin->taddr,rawtx->coin->p2shtype,rawtx->redeemscript,rawtx->I.redeemlen); - printf(" received redeemscript.(%s) %s taddr.%d\n",redeemaddr,rawtx->coin->symbol,rawtx->coin->taddr); + //printf(" received redeemscript.(%s) %s taddr.%d\n",redeemaddr,rawtx->coin->symbol,rawtx->coin->taddr); LP_swap_coinaddr(rawtx->coin,checkaddr,0,data,datalen,0); if ( strcmp(redeemaddr,checkaddr) != 0 ) {