jl777 7 years ago
parent
commit
9356088dd5
  1. 6
      iguana/exchanges/LP_commands.c
  2. 12
      iguana/exchanges/LP_prices.c

6
iguana/exchanges/LP_commands.c

@ -657,7 +657,7 @@ jpg(srcfile, destfile, power2=7, passphrase, data="", required)\n\
return(jprint(LP_fundvalue(argjson),1));
else if ( strcmp(method,"getprice") == 0 || strcmp(method,"getmyprice") == 0 )
{
double price,bid,ask,tmp;
double price,bid,ask;
if ( strcmp(method,"getprice") == 0 )
{
ask = LP_price(base,rel);
@ -666,8 +666,8 @@ jpg(srcfile, destfile, power2=7, passphrase, data="", required)\n\
}
else
{
ask = LP_myprice(&tmp,&tmp,base,rel);
if ( (bid= LP_myprice(&tmp,&tmp,rel,base)) > SMALLVAL )
ask = LP_getmyprice(base,rel);
if ( (bid= LP_getmyprice(rel,base)) > SMALLVAL )
bid = 1./bid;
}
price = _pairaved(bid,ask);

12
iguana/exchanges/LP_prices.c

@ -561,6 +561,18 @@ double LP_price(char *base,char *rel)
return(price);
}
double LP_getmyprice(char *base,char *rel)
{
struct LP_priceinfo *basepp; int32_t relind; double price = 0.;
if ( (basepp= LP_priceinfoptr(&relind,base,rel)) != 0 )
{
if ( (price= basepp->myprices[relind]) == 0. )
{
}
}
return(price);
}
cJSON *LP_priceinfomatrix(int32_t usemyprices)
{
int32_t i,j,n,m; double total,sum,val; struct LP_priceinfo *pp; uint32_t now; struct LP_cacheinfo *ptr,*tmp; cJSON *vectorjson = cJSON_CreateObject();

Loading…
Cancel
Save