|
@ -577,7 +577,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
if ( LP_autorefs[i].usdpeg != 0 ) |
|
|
if ( LP_autorefs[i].usdpeg != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( price_usd > SMALLVAL ) |
|
|
if ( price_usd > SMALLVAL ) |
|
|
price = 1. / price_usd; |
|
|
price = price_usd; |
|
|
else continue; |
|
|
else continue; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -592,26 +592,22 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
} |
|
|
} |
|
|
if ( factor > 0. ) |
|
|
if ( factor > 0. ) |
|
|
{ |
|
|
{ |
|
|
printf("USD %.8f KMDBTC %.8f pricebtc %.8f price %.8f -> factor %.8f %.8f\n",price_usd,kmd_btc,price_btc,price,factor,(price * factor) + offset); |
|
|
//printf("USD %.8f KMDBTC %.8f pricebtc %.8f price %.8f -> factor %.8f %.8f\n",price_usd,kmd_btc,price_btc,price,factor,(price * factor) + offset);
|
|
|
price = (price * factor) + offset; |
|
|
price = (price * factor) + offset; |
|
|
} |
|
|
} |
|
|
newprice = (price * (1. + buymargin)); |
|
|
newprice = (price * (1. + buymargin)); |
|
|
printf("b newprice %.8f\n",newprice); |
|
|
|
|
|
if ( LP_autorefs[i].lastbid < SMALLVAL ) |
|
|
if ( LP_autorefs[i].lastbid < SMALLVAL ) |
|
|
LP_autorefs[i].lastbid = newprice; |
|
|
LP_autorefs[i].lastbid = newprice; |
|
|
else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.99) + (0.01 * newprice); |
|
|
else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.99) + (0.01 * newprice); |
|
|
newprice = LP_autorefs[i].lastbid; |
|
|
newprice = LP_autorefs[i].lastbid; |
|
|
printf("b2 newprice %.8f\n",newprice); |
|
|
|
|
|
LP_mypriceset(&changed,rel,base,newprice); |
|
|
LP_mypriceset(&changed,rel,base,newprice); |
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice); |
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice); |
|
|
//printf("%s/%s price %.8f margin %.8f/%.8f newprice %.8f %.8f\n",base,rel,price,buymargin,sellmargin,newprice,(1. / newprice) * (1. + sellmargin));
|
|
|
//printf("%s/%s price %.8f margin %.8f/%.8f newprice %.8f %.8f\n",base,rel,price,buymargin,sellmargin,newprice,(1. / newprice) * (1. + sellmargin));
|
|
|
newprice = (1. / price) * (1. + sellmargin); |
|
|
newprice = (1. / price) * (1. + sellmargin); |
|
|
printf("a newprice %.8f\n",newprice); |
|
|
|
|
|
if ( LP_autorefs[i].lastask < SMALLVAL ) |
|
|
if ( LP_autorefs[i].lastask < SMALLVAL ) |
|
|
LP_autorefs[i].lastask = newprice; |
|
|
LP_autorefs[i].lastask = newprice; |
|
|
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.99) + (0.01 * newprice); |
|
|
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.99) + (0.01 * newprice); |
|
|
newprice = LP_autorefs[i].lastask; |
|
|
newprice = LP_autorefs[i].lastask; |
|
|
printf("a2 newprice %.8f\n",newprice); |
|
|
|
|
|
LP_mypriceset(&changed,base,rel,newprice); |
|
|
LP_mypriceset(&changed,base,rel,newprice); |
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice); |
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice); |
|
|
} |
|
|
} |
|
|