Browse Source

Test

etomic
jl777 8 years ago
parent
commit
9c2633ca63
  1. 4
      iguana/exchanges/LP_prices.c
  2. 4
      iguana/exchanges/LP_quotes.c

4
iguana/exchanges/LP_prices.c

@ -553,9 +553,9 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char *
{
//char str[65]; printf("found utxo not in orderbook %s/v%d\n",bits256_str(str,utxo->payment.txid),utxo->payment.vout);
*arrayp = realloc(*arrayp,sizeof(*(*arrayp)) * (num+1));
//if ( polarity > 0 )
if ( polarity > 0 )
basesatoshis = utxo->payment.value;
//else basesatoshis = utxo->payment.value * price;
else basesatoshis = utxo->payment.value * price;
if ( (op= LP_orderbookentry(base,rel,utxo->payment.txid,utxo->payment.vout,utxo->deposit.txid,utxo->deposit.vout,polarity > 0 ? price : 1./price,basesatoshis,utxo->pubkey)) != 0 )
(*arrayp)[num++] = op;
if ( bits256_cmp(utxo->pubkey,LP_mypubkey) == 0 && utxo->T.lasttime == 0 )

4
iguana/exchanges/LP_quotes.c

@ -166,7 +166,7 @@ char *LP_quotereceived(cJSON *argjson)
if ( (ptr= LP_cacheadd(Q.srccoin,Q.destcoin,Q.txid,Q.vout,price,&Q)) != 0 )
{
ptr->Q = Q;
char str[65]; printf("received.(%s) quote %.8f\n",bits256_str(str,Q.txid),price);
printf("\n>>>>>>>>>> received.(%s) quote %.8f\n\n",jprint(argjson,0),price);
return(clonestr("{\"result\":\"updated\"}"));
} else return(clonestr("{\"error\":\"nullptr\"}"));
}
@ -276,6 +276,7 @@ double LP_query(char *method,struct LP_quoteinfo *qp)
int32_t LP_connectstartbob(int32_t pubsock,struct LP_utxoinfo *utxo,cJSON *argjson,char *myipaddr,char *base,char *rel,double profitmargin)
{
char *retstr,pairstr[512],destaddr[64]; cJSON *retjson; double price; bits256 privkey; int32_t pair=-1,retval = -1,DEXselector = 0; uint64_t destvalue; struct LP_quoteinfo Q; struct basilisk_swap *swap;
printf("LP_connectstartbob with.(%s)\n",jprint(argjson,0));
if ( (price= LP_price(base,rel)) > SMALLVAL )
{
price *= (1. + profitmargin);
@ -283,7 +284,6 @@ int32_t LP_connectstartbob(int32_t pubsock,struct LP_utxoinfo *utxo,cJSON *argjs
return(-1);
if ( LP_quoteparse(&Q,argjson) < 0 )
return(-2);
printf("connect with.(%s)\n",jprint(argjson,0));
Q.destsatoshis = Q.satoshis * price;
privkey = LP_privkey(utxo->coinaddr);
if ( bits256_nonz(utxo->S.mypub) == 0 )

Loading…
Cancel
Save