From e119b6c3fced1dd93c2ee5819c7ddf961e5ad97c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 16 Jul 2017 12:24:02 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_prices.c | 26 +++++++++++++++++++++----- iguana/exchanges/LP_rpc.c | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index e422931d2..33e11eee7 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -782,9 +782,23 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf return(nxtkmd); } +static char *assetids[][2] = +{ + { "12071612744977229797", "UNITY" }, + { "15344649963748848799", "DEX" }, + { "6883271355794806507", "PANGEA" }, + { "17911762572811467637", "JUMBLR" }, + { "17083334802666450484", "BET" }, + { "13476425053110940554", "CRYPTO" }, + { "6932037131189568014", "HODL" }, + { "3006420581923704757", "SHARK" }, + { "17571711292785902558", "BOTS" }, + { "10524562908394749924", "MGW" }, +}; + void prices_loop(void *ignore) { - char *retstr,*assetid; cJSON *retjson; int32_t i; double nxtkmd,price; struct LP_priceinfo *btcpp,*kmdpp,*fiatpp; void *ctx = bitcoin_ctx(); + char *retstr; cJSON *retjson; int32_t i; double nxtkmd,price; struct LP_priceinfo *btcpp,*kmdpp,*fiatpp; void *ctx = bitcoin_ctx(); while ( 1 ) { if ( LP_autoprices == 0 ) @@ -832,11 +846,13 @@ void prices_loop(void *ignore) } if ( nxtkmd > SMALLVAL ) { - assetid = "12071612744977229797"; - if ( (retjson= LP_assethbla(assetid)) != 0 ) + for (i=0; i (%s) nxtkmd %.8f\n",assetid,jprint(retjson,0),nxtkmd); - free_json(retjson); + if ( (retjson= LP_assethbla(assetids[i][0])) != 0 ) + { + printf("%s %s -> (%s) nxtkmd %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd); + free_json(retjson); + } } } sleep(60); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index a9846086d..2a86c583a 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -228,7 +228,7 @@ cJSON *LP_assethbla(char *assetid) { if ( (array= jarray(&n,bid,"bidOrders")) != 0 ) jadd(retjson,"bid",jduplicate(jitem(array,0))); - if ( (array= jarray(&n,bid,"askOrders")) != 0 ) + if ( (array= jarray(&n,ask,"askOrders")) != 0 ) jadd(retjson,"ask",jduplicate(jitem(array,0))); } if ( bid != 0 )