Browse Source

Test

etomic
jl777 8 years ago
parent
commit
a82f63a815
  1. 10
      iguana/exchanges/LP_prices.c
  2. 15
      iguana/exchanges/LP_rpc.c

10
iguana/exchanges/LP_prices.c

@ -777,7 +777,7 @@ void LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinfo
void prices_loop(void *ignore)
{
char *retstr; struct LP_priceinfo *btcpp; void *ctx = bitcoin_ctx();
char *retstr; cJSON *retjson; int32_t i; struct LP_priceinfo *btcpp; void *ctx = bitcoin_ctx();
while ( 1 )
{
if ( LP_autoprices == 0 )
@ -806,6 +806,14 @@ void prices_loop(void *ignore)
}
LP_pricesparse(ctx,0,retstr,btcpp);
free(retstr);
for (i=0; i<32; i++)
{
if ( (retjson= LP_paxprice(CURRENCIES[i])) != 0 )
{
printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice"));
free_json(retjson);
}
}
sleep(60);
}
}

15
iguana/exchanges/LP_rpc.c

@ -217,10 +217,19 @@ cJSON *LP_getmempool(char *symbol)
return(bitcoin_json(coin,"getrawmempool","[]"));
}
cJSON *LP_paxprice(char *fiat)
{
char buf[128],lfiat[65]; struct iguana_info *coin = LP_coinfind("KMD");
strcpy(lfiat,fiat);
tolowercase(lfiat);
sprintf(buf,"[\"%s\", \"kmd\"]",lfiat);
return(bitcoin_json(coin,"paxprice",buf));
}
cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
{
char buf[128],str[65]; struct iguana_info *coin = LP_coinfind(symbol);
sprintf(buf,"\"%s\", %d, true",bits256_str(str,txid),vout);
sprintf(buf,"[\"%s\", %d, true]",bits256_str(str,txid),vout);
return(bitcoin_json(coin,"gettxout",buf));
}
@ -248,7 +257,7 @@ cJSON *LP_getblockhashstr(char *symbol,char *blockhashstr)
cJSON *LP_listunspent(char *symbol,char *coinaddr)
{
char buf[128]; struct iguana_info *coin = LP_coinfind(symbol);
sprintf(buf,"0, 99999999, [\"%s\"]",coinaddr);
sprintf(buf,"[0, 99999999, [\"%s\"]]",coinaddr);
return(bitcoin_json(coin,"listunspent",buf));
}
@ -264,7 +273,7 @@ cJSON *LP_listtransactions(char *symbol,char *coinaddr,int32_t count,int32_t ski
cJSON *LP_validateaddress(char *symbol,char *address)
{
char buf[512]; struct iguana_info *coin = LP_coinfind(symbol);
sprintf(buf,"\"%s\"",address);
sprintf(buf,"[\"%s\"]",address);
return(bitcoin_json(coin,"validateaddress",buf));
}

Loading…
Cancel
Save