Browse Source

Test

etomic
jl777 7 years ago
parent
commit
1e00ed4dd0
  1. 20
      iguana/exchanges/LP_portfolio.c
  2. 4
      iguana/exchanges/LP_prices.c

20
iguana/exchanges/LP_portfolio.c

@ -596,13 +596,23 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
void LP_autoprices_update(char *method,char *base,double basevol,char *rel,double relvol)
{
int32_t changed; double price,myprice,bid,ask,newprice;
if ( basevol > 0. && relvol > 0 && (myprice= LP_myprice(&bid,&ask,base,rel)) > SMALLVAL )
int32_t i; double price,newprice;
if ( basevol > 0. && relvol > 0. )
{
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);
for (i=0; i<num_LP_autorefs; i++)
{
if ( strcmp(LP_autorefs[i].rel,rel) == 0 && strcmp(base,LP_autorefs[i].base) == 0 && LP_autorefs[i].lastask > SMALLVAL )
{
newprice = (LP_autorefs[i].lastask * 0.99) + (0.01 * price);
printf("%s: autoprice ask update %s/%s %.8f vs myprice %.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastask,newprice);
}
else if ( strcmp(LP_autorefs[i].rel,base) == 0 && strcmp(rel,LP_autorefs[i].base) == 0 && LP_autorefs[i].lastbid > SMALLVAL )
{
newprice = (LP_autorefs[i].lastbid * 0.99) + (0.01 * price);
printf("%s: autoprice bid update %s/%s %.8f vs myprice %.8f -> %.8f\n",method,base,rel,price,LP_autorefs[i].lastbid,newprice);
}
}
}
}

4
iguana/exchanges/LP_prices.c

@ -524,10 +524,10 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
relpp->offsets[basepp->ind] = 0.;
relpp->factors[basepp->ind] = 0.;
}
else if ( basepp->myprices[relpp->ind] > SMALLVAL )
/*else if ( basepp->myprices[relpp->ind] > SMALLVAL )
{
price = (basepp->myprices[relpp->ind] * 0.9) + (0.1 * price);
}
}*/
basepp->myprices[relpp->ind] = price; // ask
//printf("LP_mypriceset base.%s rel.%s <- price %.8f\n",base,rel,price);
//relpp->myprices[basepp->ind] = (1. / price); // bid

Loading…
Cancel
Save