Browse Source

Test

etomic
jl777 7 years ago
parent
commit
b9332019ef
  1. 16
      iguana/exchanges/LP_portfolio.c

16
iguana/exchanges/LP_portfolio.c

@ -288,11 +288,11 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP
if ( margin == 0. )
margin = oppomargin;
//printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin)));
//if ( dir > 0 )
// price = 1. / (price * (1. - margin));
//else price = (price * (1. - margin));
if ( dir > 0 )
newprice = 1. / (price * (1. - margin));
else newprice = (price * (1. - margin));
newprice = 1. / (price * (1. - margin));
//newprice = 1. / (price * (1. - margin));
if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice )
{
LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice);
@ -380,7 +380,7 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf
//printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]);
continue;
}
//LP_autopriceset(ctx,1,coinpp,refpp,price,0,0);
LP_autopriceset(ctx,1,coinpp,refpp,price,0,0);
LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0);
}
}
@ -440,7 +440,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
{
//printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice"));
price = jdouble(retjson,"price");
//LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0);
LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0);
LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0);
free_json(retjson);
}
@ -464,7 +464,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
if ( bidsatoshis != 0 && asksatoshis != 0 )
price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd;
}
//LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0);
LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0);
LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0);
//printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price);
free_json(retjson);
@ -477,7 +477,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
basepp = LP_priceinfofind(LP_autorefs[i].base);
relpp = LP_priceinfofind(LP_autorefs[i].rel);
if ( basepp != 0 && relpp != 0 )
LP_autopriceset(ctx,-1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel);
LP_autopriceset(ctx,1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel);
}
}

Loading…
Cancel
Save