From 7d9ed2dcf12ea52a9b14d2228f78966f03c3ea23 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 29 Mar 2019 03:34:48 -1100 Subject: [PATCH] Test --- src/komodo_gateway.h | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 163e680d3..05ea4ba05 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1850,15 +1850,39 @@ uint32_t get_stockprice(const char *symbol) uint32_t get_dailyfx() { char url[512]; cJSON *json; uint32_t datenum=0,price = 0; - sprintf(url,"http://api.openrates.io/latest"); - if ( (json= send_curl(url,(char *)"curldata")) != 0 )//get_urljson(url)) != 0 ) - //if ( (json= get_urljson(url)) != 0 ) + sprintf(url,"http://api.openrates.io/latest?base=USD"); + if ( (json= send_curl(url,(char *)"dailyfx")) != 0 ) { free_json(json); } return(datenum); } +uint32_t get_binanceprice(const char *symbol) +{ + char url[512]; cJSON *json; uint32_t price = 0; + sprintf(url,"https://api.binance.com/api/v1/ticker/price?symbol=%sBTC",symbol); + if ( (json= get_urljson(url)) != 0 ) + { + price = jdouble(json,(char *)"price")*SATOSHIDEN + 0.0000000049; + free_json(json); + } + return(price); +} + +int32_t get_cryptoprices(const char *list[],int32_t n) +{ + int32_t i,errs=0; uint32_t price; + for (i=0; i