|
@ -421,13 +421,18 @@ void prices_loop(void *ignore) |
|
|
{ |
|
|
{ |
|
|
LP_myprice(&bid,&ask,buycoin,sellcoin); |
|
|
LP_myprice(&bid,&ask,buycoin,sellcoin); |
|
|
maxprice = ask; |
|
|
maxprice = ask; |
|
|
|
|
|
strcpy(LP_portfolio_base,""); |
|
|
|
|
|
strcpy(LP_portfolio_rel,""); |
|
|
|
|
|
LP_portfolio_relvolume = 0.; |
|
|
printf("base buy.%s force %f, rel sell.%s force %f relvolume %f maxprice %.8f (%.8f %.8f)\n",buycoin,jdouble(retjson,"buyforce"),sellcoin,jdouble(retjson,"sellforce"),sell->relvolume,maxprice,bid,ask); |
|
|
printf("base buy.%s force %f, rel sell.%s force %f relvolume %f maxprice %.8f (%.8f %.8f)\n",buycoin,jdouble(retjson,"buyforce"),sellcoin,jdouble(retjson,"sellforce"),sell->relvolume,maxprice,bid,ask); |
|
|
if ( LP_pricevalid(maxprice) > 0 && LP_utxo_bestfit(sellcoin,sell->relvolume) != 0 ) |
|
|
if ( LP_pricevalid(maxprice) > 0 ) |
|
|
{ |
|
|
{ |
|
|
relvolume = sell->relvolume; |
|
|
relvolume = sell->relvolume; |
|
|
for (iter=0; iter<3; iter++) |
|
|
for (iter=0; iter<3; iter++) |
|
|
{ |
|
|
{ |
|
|
requestid = quoteid = 0; |
|
|
requestid = quoteid = 0; |
|
|
|
|
|
if ( LP_utxo_bestfit(sellcoin,relvolume) == 0 ) |
|
|
|
|
|
continue; |
|
|
if ( (retstr2= LP_autotrade(ctx,"127.0.0.1",-1,buycoin,sellcoin,maxprice,relvolume,60,24*3600)) != 0 ) |
|
|
if ( (retstr2= LP_autotrade(ctx,"127.0.0.1",-1,buycoin,sellcoin,maxprice,relvolume,60,24*3600)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (retjson2= cJSON_Parse(retstr2)) != 0 ) |
|
|
if ( (retjson2= cJSON_Parse(retstr2)) != 0 ) |
|
|