Browse Source

Separate my prices into bob and Alice

pass-iguana-arg
jl777 7 years ago
parent
commit
42cc2b8322
  1. 20
      iguana/exchanges/LP_commands.c
  2. 1
      iguana/exchanges/LP_nativeDEX.c
  3. 28
      iguana/exchanges/LP_ordermatch.c
  4. 18
      iguana/exchanges/LP_portfolio.c
  5. 87
      iguana/exchanges/LP_prices.c

20
iguana/exchanges/LP_commands.c

@ -486,14 +486,14 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
double price,bid,ask;
if ( strcmp(method,"getprice") == 0 )
{
ask = LP_price(base,rel);
if ( (bid= LP_price(rel,base)) > SMALLVAL )
ask = LP_price(1,base,rel);
if ( (bid= LP_price(1,rel,base)) > SMALLVAL )
bid = 1./bid;
}
else
{
ask = LP_getmyprice(base,rel);
if ( (bid= LP_getmyprice(rel,base)) > SMALLVAL )
ask = LP_getmyprice(1,base,rel);
if ( (bid= LP_getmyprice(1,rel,base)) > SMALLVAL )
bid = 1./bid;
}
price = _pairaved(bid,ask);
@ -512,9 +512,9 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
price = jdouble(argjson,"price");
if ( strcmp(method,"setprice") == 0 )
{
if ( LP_mypriceset(&changed,base,rel,price) < 0 )
if ( LP_mypriceset(1,&changed,base,rel,price) < 0 )
return(clonestr("{\"error\":\"couldnt set price\"}"));
//else if ( LP_mypriceset(&changed,rel,base,1./price) < 0 )
//else if ( LP_mypriceset(1,&changed,rel,base,1./price) < 0 )
// return(clonestr("{\"error\":\"couldnt set price\"}"));
else if ( price == 0. || jobj(argjson,"broadcast") == 0 || jint(argjson,"broadcast") != 0 )
return(LP_pricepings(ctx,myipaddr,LP_mypubsock,base,rel,price * LP_profitratio));
@ -524,7 +524,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
return(LP_orderbook(base,rel,jint(argjson,"duration")));
else if ( strcmp(method,"myprice") == 0 )
{
if ( LP_myprice(&bid,&ask,base,rel) > SMALLVAL )
if ( LP_myprice(1,&bid,&ask,base,rel) > SMALLVAL )
{
retjson = cJSON_CreateObject();
jaddstr(retjson,"base",base);
@ -801,7 +801,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
return(jprint(retjson,1));
}
else if ( strcmp(method,"myprices") == 0 )
return(LP_myprices());
return(LP_myprices(1));
else if ( strcmp(method,"trust") == 0 )
return(LP_pubkey_trustset(jbits256(argjson,"pubkey"),jint(argjson,"trust")));
else if ( strcmp(method,"trusted") == 0 )
@ -863,12 +863,12 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
if ( strcmp(method,"getprice") == 0 )
{
ask = LP_price(base,rel);
if ( (bid= LP_price(rel,base)) > SMALLVAL )
if ( (bid= LP_price(1,rel,base)) > SMALLVAL )
bid = 1./bid;
}
else
{
ask = LP_getmyprice(base,rel);
ask = LP_getmyprice(1,base,rel);
if ( (bid= LP_getmyprice(rel,base)) > SMALLVAL )
bid = 1./bid;
}

1
iguana/exchanges/LP_nativeDEX.c

@ -576,6 +576,7 @@ void LP_coinsloop(void *_coins)
LP_address_utxo_reset(&num,coin);
coin->did_addrutxo_reset = 1;
}
free_json(LP_address_balance(coin,coin->smartaddr,1));
if ( coin->do_autofill_merge != 0 )
{
if ( (retstr= LP_autofillbob(coin,coin->do_autofill_merge*1.02)) != 0 )

28
iguana/exchanges/LP_ordermatch.c

@ -685,17 +685,11 @@ void LP_alicequery_clear()
int32_t LP_alice_eligible(uint32_t quotetime)
{
int32_t changed;
if ( Alice_expiration != 0 && quotetime > Alice_expiration )
{
if ( LP_Alicequery.uuidstr[0] != 0 )
LP_failedmsg(LP_Alicequery.R.requestid,LP_Alicequery.R.quoteid,-9999,LP_Alicequery.uuidstr);
printf("time expired for Alice_request\n");
/*if ( LP_Alicequery.srccoin[0] != 0 && LP_Alicequery.destcoin[0] != 0 ) cant do this! myprice is used to validate the order
{
LP_mypriceset(&changed,LP_Alicequery.destcoin,LP_Alicequery.srccoin,0.);
LP_mypriceset(&changed,LP_Alicequery.srccoin,LP_Alicequery.destcoin,0.);
}*/
LP_alicequery_clear();
}
return(Alice_expiration == 0 || time(NULL) < Alice_expiration);
@ -752,7 +746,7 @@ char *LP_cancel_order(char *uuidstr)
char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice
{
cJSON *retjson; char otheraddr[64],*msg; double bid,ask,price,qprice; int32_t pairsock = -1; int32_t DEXselector = 0; struct LP_utxoinfo *autxo,A,B,*butxo; struct basilisk_swap *swap; struct iguana_info *coin;
cJSON *retjson; char otheraddr[64],*msg; double bid,ask,price,qprice; int32_t connected,pairsock = -1; int32_t DEXselector = 0; struct LP_utxoinfo *autxo,A,B,*butxo; struct basilisk_swap *swap; struct iguana_info *coin;
if ( bits256_cmp(qp->desthash,G.LP_mypub25519) != 0 )
{
LP_aliceid(qp->tradeid,qp->aliceid,"error1",0,0);
@ -762,6 +756,12 @@ char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice
printf("CONNECTED mpnet.%d fill.%d gtc.%d numpending.%d tradeid.%u requestid.%u quoteid.%u pairstr.%s\n",qp->mpnet,qp->fill,qp->gtc,G.LP_pendingswaps,qp->tradeid,qp->R.requestid,qp->R.quoteid,pairstr!=0?pairstr:"");
LP_requestinit(&qp->R,qp->srchash,qp->desthash,qp->srccoin,qp->satoshis-qp->txfee,qp->destcoin,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector,qp->fill,qp->gtc);
//printf("calculated requestid.%u quoteid.%u\n",qp->R.requestid,qp->R.quoteid);
if ( LP_Alicequery.srccoin[0] != 0 && LP_Alicequery.destcoin[0] != 0 )
{
LP_mypriceset(0,&changed,LP_Alicequery.destcoin,LP_Alicequery.srccoin,0.);
LP_mypriceset(0,&changed,LP_Alicequery.srccoin,LP_Alicequery.destcoin,0.);
}
LP_alicequery_clear();
memset(&LP_Alicereserved,0,sizeof(LP_Alicereserved));
LP_aliceid(qp->tradeid,qp->aliceid,"connected",qp->R.requestid,qp->R.quoteid);
autxo = &A;
@ -778,7 +778,7 @@ char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice
printf("quote %s/%s validate error %.0f\n",qp->srccoin,qp->destcoin,qprice);
return(clonestr("{\"error\":\"quote validation error\"}"));
}
if ( LP_myprice(&bid,&ask,qp->srccoin,qp->destcoin) <= SMALLVAL || bid <= SMALLVAL )
if ( LP_myprice(0,&bid,&ask,qp->srccoin,qp->destcoin) <= SMALLVAL || bid <= SMALLVAL )
{
printf("this node has no price for %s/%s (%.8f %.8f)\n",qp->destcoin,qp->srccoin,bid,ask);
LP_availableset(qp->desttxid,qp->vout);
@ -969,7 +969,7 @@ void LP_reserved(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo
double LP_trades_bobprice(double *bidp,double *askp,struct LP_quoteinfo *qp)
{
double price; struct iguana_info *coin; char str[65];
price = LP_myprice(bidp,askp,qp->srccoin,qp->destcoin);
price = LP_myprice(1,bidp,askp,qp->srccoin,qp->destcoin);
if ( (coin= LP_coinfind(qp->srccoin)) == 0 || price <= SMALLVAL || *askp <= SMALLVAL )
{
//printf("this node has no price for %s/%s\n",qp->srccoin,qp->destcoin);
@ -1260,7 +1260,7 @@ struct LP_quoteinfo *LP_trades_gotconnected(void *ctx,struct LP_quoteinfo *qp,st
LP_aliceid(qp->tradeid,qp->aliceid,"connected",0,0);
if ( (retstr= LP_connectedalice(qp,pairstr)) != 0 )
free(retstr);
LP_mypriceset(&changed,qp->destcoin,qp->srccoin,0.);
LP_mypriceset(0,&changed,qp->destcoin,qp->srccoin,0.);
LP_alicequery_clear();
return(qp);
} else LP_failedmsg(qp->R.requestid,qp->R.quoteid,val,qp->uuidstr);
@ -1594,7 +1594,9 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_CONNECTED);
}
}
price = LP_myprice(&bid,&ask,Q.srccoin,Q.destcoin);
if ( strcmp(method,"request") == 0 || strcmp(method,"connect") == 0 ) // bob
price = LP_myprice(1,&bid,&ask,Q.srccoin,Q.destcoin);
else price = LP_myprice(0,&bid,&ask,Q.srccoin,Q.destcoin); // alice
if ( (coin= LP_coinfind(Q.srccoin)) == 0 || coin->inactive != 0 )
{
//printf("%s is not active\n",Q.srccoin);
@ -1796,8 +1798,8 @@ char *LP_autobuy(void *ctx,int32_t fomoflag,char *myipaddr,int32_t mypubsock,cha
Q.mpnet = 0;
Q.fill = fillflag;
Q.gtc = gtcflag;
LP_mypriceset(&changed,rel,base,1. / maxprice);
LP_mypriceset(&changed,base,rel,0.);
LP_mypriceset(0,&changed,rel,base,1. / maxprice);
LP_mypriceset(0,&changed,base,rel,0.);
if ( uuidstr == 0 || uuidstr[0] == 0 )
{
uint8_t uuidhash[256]; bits256 hash; uint64_t millis; int32_t len = 0;

18
iguana/exchanges/LP_portfolio.c

@ -152,7 +152,7 @@ char *LP_portfolio()
coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr);
coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr);
if ( strcmp(coin->symbol,"KMD") != 0 )
coin->price_kmd = LP_price(coin->symbol,"KMD");
coin->price_kmd = LP_price(1,coin->symbol,"KMD");
else coin->price_kmd = 1.;
coin->maxamount = coin->valuesumA;
if ( coin->valuesumB > coin->maxamount )
@ -274,7 +274,7 @@ void LP_autopriceset(int32_t ind,void *ctx,int32_t dir,struct LP_priceinfo *base
oppomargin = basepp->buymargins[relpp->ind];
if ( (fixedprice= basepp->fixedprices[relpp->ind]) > SMALLVAL )
{
LP_mypriceset(&changed,relpp->symbol,basepp->symbol,fixedprice);
LP_mypriceset(1,&changed,relpp->symbol,basepp->symbol,fixedprice);
//printf("autoprice FIXED %s/%s <- %.8f\n",basepp->symbol,relpp->symbol,fixedprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,fixedprice);
return;
@ -285,7 +285,7 @@ void LP_autopriceset(int32_t ind,void *ctx,int32_t dir,struct LP_priceinfo *base
factor = basepp->factors[relpp->ind];
if ( fabs(price) < SMALLVAL && refbase != 0 && refrel != 0 )
{
price = LP_myprice(&bid,&ask,refbase,refrel);
price = LP_myprice(1,&bid,&ask,refbase,refrel);
//printf("%s/%s USE ref %s/%s %.8f factor %.8f offset %.8f margin %.8f/%.8f\n",basepp->symbol,relpp->symbol,refbase,refrel,price,factor,offset,oppomargin,margin);
}
if ( LP_pricevalid(price) > 0 )
@ -312,7 +312,7 @@ void LP_autopriceset(int32_t ind,void *ctx,int32_t dir,struct LP_priceinfo *base
newprice = LP_autorefs[ind].lastask;
//printf("autopriceset %s/%s <- %.8f %.8f (%.8f %.8f)\n",basepp->symbol,relpp->symbol,price,newprice,LP_autorefs[ind].lastbid,LP_autorefs[ind].lastask);
}
LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice);
LP_mypriceset(1,&changed,relpp->symbol,basepp->symbol,newprice);
if ( changed != 0 || time(NULL) > lasttime+LP_ORDERBOOK_DURATION*.777)
{
lasttime = (uint32_t)time(NULL);
@ -582,9 +582,9 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
LP_autorefs[i].lastask = askprice;
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.9) + (0.1 * askprice);
askprice = LP_autorefs[i].lastask;
LP_mypriceset(&changed,rel,base,bidprice);
LP_mypriceset(1,&changed,rel,base,bidprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,bidprice);
LP_mypriceset(&changed,base,rel,askprice);
LP_mypriceset(1,&changed,base,rel,askprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,askprice);
//printf("price %.8f -> %.8f %.8f\n",price,bidprice,askprice);
}
@ -626,7 +626,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
LP_autorefs[i].lastbid = newprice;
else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.99) + (0.01 * newprice);
newprice = LP_autorefs[i].lastbid;
LP_mypriceset(&changed,rel,base,newprice);
LP_mypriceset(1,&changed,rel,base,newprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,newprice);
//printf("%s/%s price %.8f margin %.8f/%.8f newprice %.8f %.8f\n",base,rel,price,buymargin,sellmargin,newprice,(1. / newprice) * (1. + sellmargin));
newprice = (1. / price) * (1. + sellmargin);
@ -634,7 +634,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
LP_autorefs[i].lastask = newprice;
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.99) + (0.01 * newprice);
newprice = LP_autorefs[i].lastask;
LP_mypriceset(&changed,base,rel,newprice);
LP_mypriceset(1,&changed,base,rel,newprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,base,rel,newprice);
} //else printf("null return from CMC\n");
}
@ -782,7 +782,7 @@ int32_t LP_portfolio_trade(void *ctx,uint32_t *requestidp,uint32_t *quoteidp,str
char *retstr2; uint64_t txfee,desttxfee; double bid,ask,maxprice; bits256 zero; uint32_t requestid,quoteid,iter,i; cJSON *retjson2; struct LP_utxoinfo A; struct LP_address_utxo *utxos[1000]; int32_t max=(int32_t)(sizeof(utxos)/sizeof(*utxos));
LP_txfees(&txfee,&desttxfee,buy->symbol,sell->symbol);
requestid = quoteid = 0;
LP_myprice(&bid,&ask,buy->symbol,sell->symbol);
LP_myprice(1,&bid,&ask,buy->symbol,sell->symbol);
maxprice = ask;
if ( setbaserel != 0 )
{

87
iguana/exchanges/LP_prices.c

@ -35,7 +35,7 @@ struct LP_priceinfo
int32_t ind,pad;
double diagval,high[2],low[2],last[2],bid[2],ask[2];
double relvals[LP_MAXPRICEINFOS];
double myprices[LP_MAXPRICEINFOS];
double myprices[2][LP_MAXPRICEINFOS];
double minprices[LP_MAXPRICEINFOS]; // autoprice
double fixedprices[LP_MAXPRICEINFOS]; // fixedprices
double buymargins[LP_MAXPRICEINFOS];
@ -451,16 +451,16 @@ void LP_priceinfoupdate(char *base,char *rel,double price)
}
}
double LP_myprice(double *bidp,double *askp,char *base,char *rel)
double LP_myprice(int32_t iambob,double *bidp,double *askp,char *base,char *rel)
{
struct LP_priceinfo *basepp,*relpp; double val;
*bidp = *askp = 0.;
if ( (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 )
{
*askp = basepp->myprices[relpp->ind];
*askp = basepp->myprices[iambob][relpp->ind];
if ( LP_pricevalid(*askp) > 0 )
{
val = relpp->myprices[basepp->ind];
val = relpp->myprices[iambob][basepp->ind];
if ( LP_pricevalid(val) > 0 )
{
*bidp = 1. / val;
@ -474,7 +474,7 @@ double LP_myprice(double *bidp,double *askp,char *base,char *rel)
}
else
{
val = relpp->myprices[basepp->ind];
val = relpp->myprices[iambob][basepp->ind];
if ( LP_pricevalid(val) > 0 )
{
*bidp = 1. / val;
@ -486,7 +486,7 @@ double LP_myprice(double *bidp,double *askp,char *base,char *rel)
return(0.);
}
char *LP_myprices()
char *LP_myprices(int32_t iambob)
{
int32_t baseid,relid; double bid,ask; char *base,*rel; cJSON *item,*array;
array = cJSON_CreateArray();
@ -496,7 +496,7 @@ char *LP_myprices()
for (relid=0; relid<LP_numpriceinfos; relid++)
{
rel = LP_priceinfos[relid].symbol;
if ( LP_myprice(&bid,&ask,base,rel) > SMALLVAL )
if ( LP_myprice(iambob,&bid,&ask,base,rel) > SMALLVAL )
{
item = cJSON_CreateObject();
jaddstr(item,"base",base);
@ -510,7 +510,7 @@ char *LP_myprices()
return(jprint(array,1));
}
int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
int32_t LP_mypriceset(int32_t iambob,int32_t *changedp,char *base,char *rel,double price)
{
struct LP_priceinfo *basepp=0,*relpp=0; struct LP_pubkey_info *pubp; double minprice,maxprice,margin,buymargin,sellmargin;
*changedp = 0;
@ -519,43 +519,46 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 )
{
if ( price == 0. || fabs(basepp->myprices[relpp->ind] - price)/price > 0.001 )
if ( price == 0. || fabs(basepp->myprices[iambob][relpp->ind] - price)/price > 0.001 )
*changedp = 1;
sellmargin = relpp->sellmargins[basepp->ind];
buymargin = relpp->buymargins[basepp->ind];
margin = (sellmargin + buymargin) * 0.5;
if ( price == 0. )
if ( iambob != 0 )
{
relpp->minprices[basepp->ind] = 0.;
relpp->fixedprices[basepp->ind] = 0.;
relpp->buymargins[basepp->ind] = 0.;
relpp->sellmargins[basepp->ind] = 0.;
relpp->offsets[basepp->ind] = 0.;
relpp->factors[basepp->ind] = 0.;
LP_autoref_clear(base,rel);
margin = 0.;
}
else if ( (minprice= basepp->minprices[relpp->ind]) > SMALLVAL && price < minprice )
{
//printf("%s/%s price %.8f less than minprice %.8f\n",base,rel,price,minprice);
price = minprice * (1. - margin);
}
else if ( (maxprice= relpp->minprices[basepp->ind]) > SMALLVAL )
{
if ( price > (1. / maxprice) )
sellmargin = relpp->sellmargins[basepp->ind];
buymargin = relpp->buymargins[basepp->ind];
margin = (sellmargin + buymargin) * 0.5;
if ( price == 0. )
{
relpp->minprices[basepp->ind] = 0.;
relpp->fixedprices[basepp->ind] = 0.;
relpp->buymargins[basepp->ind] = 0.;
relpp->sellmargins[basepp->ind] = 0.;
relpp->offsets[basepp->ind] = 0.;
relpp->factors[basepp->ind] = 0.;
LP_autoref_clear(base,rel);
margin = 0.;
}
else if ( (minprice= basepp->minprices[relpp->ind]) > SMALLVAL && price < minprice )
{
//printf("%s/%s price %.8f less than minprice %.8f\n",base,rel,price,minprice);
price = minprice * (1. - margin);
}
else if ( (maxprice= relpp->minprices[basepp->ind]) > SMALLVAL )
{
//printf("%s/%s price %.8f less than maxprice %.8f, more than %.8f\n",base,rel,price,maxprice,1./maxprice);
price = (1. / maxprice) * (1. + margin);
if ( price > (1. / maxprice) )
{
//printf("%s/%s price %.8f less than maxprice %.8f, more than %.8f\n",base,rel,price,maxprice,1./maxprice);
price = (1. / maxprice) * (1. + margin);
}
}
}
/*else if ( basepp->myprices[relpp->ind] > SMALLVAL )
{
price = (basepp->myprices[relpp->ind] * 0.9) + (0.1 * price);
}*/
basepp->myprices[relpp->ind] = price; // ask
basepp->myprices[iambob][relpp->ind] = price; // ask
//printf("LP_mypriceset base.%s rel.%s <- price %.8f\n",base,rel,price);
//relpp->myprices[basepp->ind] = (1. / price); // bid, but best to do one dir at a time
if ( (pubp= LP_pubkeyadd(G.LP_mypub25519)) != 0 )
if ( iambob != 0 && (pubp= LP_pubkeyadd(G.LP_mypub25519)) != 0 )
{
pubp->timestamp = (uint32_t)time(NULL);
LP_pubkey_update(pubp,basepp->ind,relpp->ind,price,0,0,0,0,0);
@ -569,12 +572,12 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
return(-1);
}
double LP_price(char *base,char *rel)
double LP_price(int32_t iambob,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. )
if ( (price= basepp->myprices[iambob][relind]) == 0. )
{
price = basepp->relvals[relind];
}
@ -582,19 +585,19 @@ double LP_price(char *base,char *rel)
return(price);
}
double LP_getmyprice(char *base,char *rel)
double LP_getmyprice(int32_t iambob,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. )
if ( (price= basepp->myprices[iambob][relind]) == 0. )
{
}
}
return(price);
}
cJSON *LP_priceinfomatrix(int32_t usemyprices)
cJSON *LP_priceinfomatrix(int32_t iambob,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();
now = (uint32_t)time(NULL);
@ -611,7 +614,7 @@ cJSON *LP_priceinfomatrix(int32_t usemyprices)
pp->diagval = sum = n = 0;
for (j=0; j<LP_numpriceinfos; j++)
{
if ( usemyprices == 0 || (val= pp->myprices[j]) == 0. )
if ( usemyprices == 0 || (val= pp->myprices[iambob][j]) == 0. )
val = pp->relvals[j];
if ( val > SMALLVAL )
{
@ -661,7 +664,7 @@ struct LP_priceinfo *LP_priceinfoadd(char *symbol)
pp->coinbits = stringbits(symbol);
pp->ind = LP_numpriceinfos++;
//LP_numpriceinfos++;
if ( (retjson= LP_priceinfomatrix(0)) != 0 )
if ( (retjson= LP_priceinfomatrix(1,0)) != 0 )
free_json(retjson);
return(pp);
}
@ -1016,7 +1019,7 @@ int64_t LP_KMDvalue(struct iguana_info *coin,int64_t balance)
KMDvalue = balance;
else
{
if ( (price= LP_price(coin->symbol,"KMD")) > SMALLVAL )
if ( (price= LP_price(1,coin->symbol,"KMD")) > SMALLVAL )
KMDvalue = price * balance;
}
}

Loading…
Cancel
Save