|
|
@ -533,12 +533,12 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
|
{ |
|
|
|
if ( (fundjson= LP_fundvalue(argjson)) != 0 ) |
|
|
|
{ |
|
|
|
printf("%s\n",jprint(fundjson,0)); |
|
|
|
//printf("%s\n",jprint(fundjson,0));
|
|
|
|
if ( jint(fundjson,"missing") == 0 ) |
|
|
|
{ |
|
|
|
if ( LP_autorefs[i].fundbid[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundbid)) > SMALLVAL ) |
|
|
|
{ |
|
|
|
printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundbid,price); |
|
|
|
//printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundbid,price);
|
|
|
|
if ( tickerjson != 0 && LP_autorefs[i].count == 0 ) |
|
|
|
price = LP_tickered_price(0,base,rel,price,tickerjson); |
|
|
|
newprice = (1. / price) * (1. + buymargin); |
|
|
@ -548,11 +548,11 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
|
newprice = LP_autorefs[i].lastbid; |
|
|
|
LP_mypriceset(&changed,rel,base,newprice); |
|
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice); |
|
|
|
printf("fundbid %.8f margin %.8f newprice %.8f\n",price,buymargin,newprice); |
|
|
|
//printf("fundbid %.8f margin %.8f newprice %.8f\n",price,buymargin,newprice);
|
|
|
|
} |
|
|
|
if ( LP_autorefs[i].fundask[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundask)) > SMALLVAL ) |
|
|
|
{ |
|
|
|
printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundask,price); |
|
|
|
//printf("%s/%s %s %.8f -> ",base,rel,LP_autorefs[i].fundask,price);
|
|
|
|
if ( tickerjson != 0 && LP_autorefs[i].count == 0 ) |
|
|
|
price = LP_tickered_price(1,base,rel,price,tickerjson); |
|
|
|
newprice = (price * (1. + sellmargin)); |
|
|
@ -562,7 +562,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
|
newprice = LP_autorefs[i].lastask; |
|
|
|
LP_mypriceset(&changed,base,rel,newprice); |
|
|
|
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice); |
|
|
|
printf("fundask %.8f margin %.8f newprice %.8f\n",price,sellmargin,newprice); |
|
|
|
//printf("fundask %.8f margin %.8f newprice %.8f\n",price,sellmargin,newprice);
|
|
|
|
} |
|
|
|
LP_autorefs[i].count++; |
|
|
|
} |
|
|
@ -623,7 +623,7 @@ void LP_autoprices_update(char *method,char *base,double basevol,char *rel,doubl |
|
|
|
{ |
|
|
|
if ( strcmp(LP_autorefs[i].rel,rel) == 0 && strcmp(base,LP_autorefs[i].base) == 0 ) |
|
|
|
{ |
|
|
|
newprice = (LP_autorefs[i].lastask * 0.99) + (0.01 * price); |
|
|
|
newprice = (LP_autorefs[i].lastask * 0.9) + (0.1 * price); |
|
|
|
if ( LP_autorefs[i].lastask > 0 ) |
|
|
|
{ |
|
|
|
//printf("%s: autoprice ask update %s/%s %.8f vs myprice %.8f/%.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,LP_autorefs[i].lastask,newprice);
|
|
|
@ -632,7 +632,7 @@ void LP_autoprices_update(char *method,char *base,double basevol,char *rel,doubl |
|
|
|
} |
|
|
|
else if ( strcmp(LP_autorefs[i].rel,base) == 0 && strcmp(rel,LP_autorefs[i].base) == 0 ) |
|
|
|
{ |
|
|
|
newprice = (LP_autorefs[i].lastbid * 0.99) + (0.01 * price); |
|
|
|
newprice = (LP_autorefs[i].lastbid * 0.9) + (0.1 * price); |
|
|
|
if ( LP_autorefs[i].lastbid > 0 ) |
|
|
|
{ |
|
|
|
//printf("%s: autoprice bid update %s/%s %.8f vs myprice %.8f/%.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,LP_autorefs[i].lastask,newprice);
|
|
|
|