jl777 7 years ago
parent
commit
34e3df0935
  1. 12
      iguana/exchanges/LP_portfolio.c
  2. 2
      iguana/exchanges/LP_prices.c

12
iguana/exchanges/LP_portfolio.c

@ -539,12 +539,12 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
if ( LP_autorefs[i].fundbid[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundbid)) > SMALLVAL ) 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 ) if ( tickerjson != 0 && LP_autorefs[i].count == 0 )
price = LP_tickered_price(0,base,rel,price,tickerjson); price = LP_tickered_price(0,base,rel,price,tickerjson);
newprice = (1. / price) * (1. + buymargin); newprice = (1. / price) * (1. + buymargin);
//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.9) + (0.1 *newprice); else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.9) + (0.1 *newprice);
newprice = LP_autorefs[i].lastbid; newprice = LP_autorefs[i].lastbid;
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);
@ -553,12 +553,12 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
if ( LP_autorefs[i].fundask[0] != 0 && (price= jdouble(fundjson,LP_autorefs[i].fundask)) > SMALLVAL ) 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 ) if ( tickerjson != 0 && LP_autorefs[i].count == 0 )
price = LP_tickered_price(1,base,rel,price,tickerjson); price = LP_tickered_price(1,base,rel,price,tickerjson);
newprice = (price * (1. + sellmargin)); newprice = (price * (1. + sellmargin));
//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.9) + (0.1 *newprice); else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.9) + (0.1 *newprice);
newprice = LP_autorefs[i].lastask; newprice = LP_autorefs[i].lastask;
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);

2
iguana/exchanges/LP_prices.c

@ -513,6 +513,8 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
{ {
struct LP_priceinfo *basepp,*relpp; struct LP_pubkey_info *pubp; struct LP_priceinfo *basepp,*relpp; struct LP_pubkey_info *pubp;
*changedp = 0; *changedp = 0;
if ( strcmp("DEX",base) == 0 || strcmp("DEX",rel) == 0 )
printf("%s/%s setprice %.8f\n",base,rel,price);
if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 )
{ {

Loading…
Cancel
Save