|
|
@ -534,7 +534,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
|
newprice = (1. / price) * (1. + margin); |
|
|
|
if ( LP_autorefs[i].lastbid < SMALLVAL ) |
|
|
|
LP_autorefs[i].lastbid = newprice; |
|
|
|
else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.5) + (0.5 *newprice); |
|
|
|
else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.9) + (0.1 *newprice); |
|
|
|
newprice = LP_autorefs[i].lastbid; |
|
|
|
LP_mypriceset(&changed,rel,base,newprice); |
|
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice); |
|
|
@ -547,7 +547,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
|
newprice = (price * (1. + margin)); |
|
|
|
if ( LP_autorefs[i].lastask < SMALLVAL ) |
|
|
|
LP_autorefs[i].lastask = newprice; |
|
|
|
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.5) + (0.5 *newprice); |
|
|
|
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.9) + (0.1 *newprice); |
|
|
|
newprice = LP_autorefs[i].lastask; |
|
|
|
LP_mypriceset(&changed,base,rel,newprice); |
|
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice); |
|
|
@ -596,7 +596,14 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
|
|
|
|
|
void LP_autoprices_update(char *method,char *base,double basevol,char *rel,double relvol) |
|
|
|
{ |
|
|
|
//printf("%s: autoprice update %s/%s %.8f\n",method,base,rel,relvol/basevol);
|
|
|
|
int32_t changed; double price,myprice,bid,ask,newprice; |
|
|
|
if ( basevol > 0. && relvol > 0 && (myprice= LP_myprice(&bid,&ask,base,rel)) > SMALLVAL ) |
|
|
|
{ |
|
|
|
price = relvol/basevol; |
|
|
|
newprice = (myprice * 0.95) + (0.05 * price); |
|
|
|
printf("%s: autoprice update %s/%s %.8f vs myprice %.8f -> %.8f\n",method,base,rel,price,myprice,newprice); |
|
|
|
LP_mypriceset(&changed,base,rel,newprice); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int32_t LP_autoprice(void *ctx,char *base,char *rel,cJSON *argjson) |
|
|
|