|
|
@ -657,6 +657,11 @@ void exchanges777_loop(void *ptr) |
|
|
|
tradebot_timeslice(exchange,bot); |
|
|
|
if ( time(NULL) > exchange->lastpoll+exchange->pollgap ) |
|
|
|
{ |
|
|
|
if ( strcmp(exchange->name,"bitcoin") == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(SuperNET_MYINFO(0)); |
|
|
|
//printf("InstantDEX call update\n");
|
|
|
|
} |
|
|
|
if ( (req= queue_dequeue(&exchange->pricesQ,0)) != 0 ) |
|
|
|
{ |
|
|
|
//printf("check %s pricesQ (%s %s)\n",exchange->name,req->base,req->rel);
|
|
|
@ -962,7 +967,7 @@ THREE_STRINGS_AND_THREE_INTS(InstantDEX,orderbook,exchange,base,rel,depth,allfie |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qprices(ptr,base,rel,juint(json,"maxseconds"),allfields,depth,json,0,ptr->commission)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -974,7 +979,7 @@ THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,buy,exchange,base,rel,price,volume,do |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qtrade(ptr,base,rel,juint(json,"maxseconds"),dotrade,1,price,volume,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -986,7 +991,7 @@ THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,sell,exchange,base,rel,price,volume,d |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qtrade(ptr,base,rel,juint(json,"maxseconds"),dotrade,-1,price,volume,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -998,7 +1003,7 @@ THREE_STRINGS_AND_DOUBLE(InstantDEX,withdraw,exchange,base,destaddr,amount) |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qrequest(ptr,'W',base,0,juint(json,"maxseconds"),0,destaddr,amount,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -1010,7 +1015,7 @@ TWO_STRINGS(InstantDEX,balance,exchange,base) |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qrequest(ptr,'B',base,0,juint(json,"maxseconds"),0,0,0,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -1022,7 +1027,7 @@ TWO_STRINGS(InstantDEX,orderstatus,exchange,orderid) |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qrequest(ptr,'P',0,0,juint(json,"maxseconds"),calc_nxt64bits(orderid),0,0,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -1034,7 +1039,7 @@ TWO_STRINGS(InstantDEX,cancelorder,exchange,orderid) |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qrequest(ptr,'C',0,0,juint(json,"maxseconds"),calc_nxt64bits(orderid),0,0,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -1046,7 +1051,7 @@ STRING_ARG(InstantDEX,openorders,exchange) |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qrequest(ptr,'O',0,0,juint(json,"maxseconds"),0,0,0,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
@ -1058,7 +1063,7 @@ STRING_ARG(InstantDEX,tradehistory,exchange) |
|
|
|
struct exchange_info *ptr; |
|
|
|
if ( remoteaddr == 0 ) |
|
|
|
{ |
|
|
|
instantdex_update(myinfo); |
|
|
|
//instantdex_update(myinfo);
|
|
|
|
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 ) |
|
|
|
return(exchanges777_Qrequest(ptr,'H',0,0,juint(json,"maxseconds"),0,0,0,json)); |
|
|
|
else return(clonestr("{\"error\":\"cant find or create exchange\"}")); |
|
|
|