From aa72b9a07e8d9f2b0b7cf051f959ad03dadcf612 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 11:02:53 -0300 Subject: [PATCH] test --- basilisk/basilisk_tradebot.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/basilisk/basilisk_tradebot.c b/basilisk/basilisk_tradebot.c index 2965590d0..bc62e5858 100755 --- a/basilisk/basilisk_tradebot.c +++ b/basilisk/basilisk_tradebot.c @@ -160,7 +160,7 @@ double tradebot_liquidity_active(struct supernet_info *myinfo,double *refpricep, double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk_request *issueR,struct basilisk_request *list,int32_t n) { - int32_t i,noquoteflag=0,havequoteflag=0,myrequest=0,maxi=-1; uint64_t destamount,minamount = 0,maxamount = 0; uint32_t pendingid=0; struct basilisk_swap *active; double metric = 0.; + int32_t i,noquoteflag=0,havequoteflag=0,myrequest=0,maxi=-1; uint64_t balance=0,destamount,minamount = 0,maxamount = 0; uint32_t pendingid=0; struct basilisk_swap *active; double metric = 0.; memset(issueR,0,sizeof(*issueR)); minamount = list[0].minamount; //printf("need to verify null quoteid is list[0] requestid.%u quoteid.%u\n",list[0].requestid,list[0].quoteid); @@ -191,7 +191,7 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk } else noquoteflag++; } printf("%s -> %s myrequest.%d pendingid.%u noquoteflag.%d havequoteflag.%d maxi.%d %.8f\n",list[0].src,list[0].dest,myrequest,pendingid,noquoteflag,havequoteflag,maxi,dstr(maxamount)); - double retvals[4],refprice,profitmargin,aveprice,balance=0.; cJSON *retjson; char *retstr; + double retvals[4],refprice,profitmargin,aveprice; cJSON *retjson; char *retstr; if ( myinfo->IAMLP != 0 && myrequest == 0 && pendingid == 0 && noquoteflag != 0 && (profitmargin= tradebot_liquidity_active(myinfo,&refprice,list[0].src,list[0].dest)) > 0. ) { if ( (aveprice= instantdex_avehbla(myinfo,retvals,list[0].src,list[0].dest,1.3 * dstr(list[0].srcamount))) == 0. || refprice > aveprice ) @@ -203,12 +203,13 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk { if ( (retjson= cJSON_Parse(retstr)) != 0 ) { - balance = jdouble(retjson,"result"); + balance = jdouble(retjson,"result") * SATOSHIDEN; free_json(retjson); } free(retstr); } - printf("%s balance %.8f destamount %.8f aveprice %.8f minamount %.8f\n",list[0].dest,balance,dstr(destamount),aveprice,dstr(minamount)); + // BTC balance 0.00500000 destamount 0.00041951 aveprice 0.00421619 minamount 0.00020000 + printf("%s balance %.8f destamount %.8f aveprice %.8f minamount %.8f\n",list[0].dest,dstr(balance),dstr(destamount),aveprice,dstr(minamount)); if ( balance > destamount && destamount > 0 && destamount >= maxamount && destamount >= minamount ) { metric = 1.;