Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
512c351d40
  1. 2
      iguana/iguana777.c
  2. 26
      iguana/iguana_exchanges.c
  3. 1
      includes/iguana_apideclares.h

2
iguana/iguana777.c

@ -430,7 +430,7 @@ void iguana_update_balances(struct iguana_info *coin)
iguana_volatilespurge(coin,&bp->ramchain); iguana_volatilespurge(coin,&bp->ramchain);
iguana_volatilesalloc(coin,&bp->ramchain,1);//i < hdrsi); iguana_volatilesalloc(coin,&bp->ramchain,1);//i < hdrsi);
} }
for (hdrsi=0; hdrsi<max; hdrsi++) for (; hdrsi<max; hdrsi++)
{ {
if ( (bp= coin->bundles[hdrsi]) != 0 ) if ( (bp= coin->bundles[hdrsi]) != 0 )
{ {

26
iguana/iguana_exchanges.c

@ -1116,6 +1116,12 @@ void exchanges777_init(struct supernet_info *myinfo,cJSON *exchanges,int32_t sle
} }
} }
cJSON *iguana_pricesarray(struct supernet_info *myinfo,char *exchange,char *base,char *rel,int32_t period,uint32_t start,uint32_t end)
{
cJSON *array = cJSON_CreateArray();
return(array);
}
#include "../includes/iguana_apidefs.h" #include "../includes/iguana_apidefs.h"
THREE_STRINGS_AND_THREE_INTS(InstantDEX,orderbook,exchange,base,rel,depth,allfields,ignore) THREE_STRINGS_AND_THREE_INTS(InstantDEX,orderbook,exchange,base,rel,depth,allfields,ignore)
@ -1332,6 +1338,26 @@ TWO_STRINGS(iguana,rate,base,rel)
} else return(clonestr("{\"error\":\"null return from aveprice\"}")); } else return(clonestr("{\"error\":\"null return from aveprice\"}"));
} }
THREE_STRINGS_AND_THREE_INTS(iguana,prices,exchange,base,rel,period,start,end)
{
cJSON *retjson = cJSON_CreateObject();
if ( period <= 0 )
period = 60;
if ( end <= 0 )
end = (uint32_t)time(NULL);
if ( start <= 0 || start >= end )
start = end - 1024*period;
jaddstr(retjson,"base",base);
jaddstr(retjson,"rel",rel);
jaddstr(retjson,"exchange",exchange[0] != 0 ? exchange : "all");
jaddstr(retjson,"result","success");
jaddnum(retjson,"start",start);
jaddnum(retjson,"end",end);
jaddnum(retjson,"period",period);
jadd(retjson,"prices",iguana_pricesarray(myinfo,exchange,base,rel,period,start,end));
return(jprint(retjson,1));
}
INT_AND_ARRAY(iguana,rates,unused,quotes) INT_AND_ARRAY(iguana,rates,unused,quotes)
{ {
int32_t i,n,len,j; char *retstr,*quote,base[16][64],rel[16][64],field[64]; double aveprice; cJSON *tmpjson,*item,*array=0,*retjson = cJSON_CreateObject(); int32_t i,n,len,j; char *retstr,*quote,base[16][64],rel[16][64],field[64]; double aveprice; cJSON *tmpjson,*item,*array=0,*retjson = cJSON_CreateObject();

1
includes/iguana_apideclares.h

@ -15,6 +15,7 @@
INT_AND_ARRAY(iguana,rates,unused,quotes); INT_AND_ARRAY(iguana,rates,unused,quotes);
TWO_STRINGS(iguana,rate,base,rel); TWO_STRINGS(iguana,rate,base,rel);
THREE_STRINGS_AND_THREE_INTS(iguana,prices,exchange,base,rel,period,start,end);
ZERO_ARGS(InstantDEX,allcoins); ZERO_ARGS(InstantDEX,allcoins);
STRING_ARG(InstantDEX,available,source); STRING_ARG(InstantDEX,available,source);

Loading…
Cancel
Save