Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
edcc1f8ca4
  1. 16
      iguana/iguana_exchanges.c
  2. 7
      iguana/iguana_realtime.c

16
iguana/iguana_exchanges.c

@ -59,7 +59,7 @@ cJSON *exchanges777_quotejson(struct exchange_quote *quote,int32_t allflag,doubl
if ( quote->orderid != 0 ) if ( quote->orderid != 0 )
jadd64bits(json,"orderid",quote->orderid); jadd64bits(json,"orderid",quote->orderid);
//if ( quote->offerNXT != 0 ) //if ( quote->offerNXT != 0 )
jadd64bits(json,"account",quote->offerNXT); jadd64bits(json,"account",quote->offerNXT);
return(json); return(json);
} else return(cJSON_CreateNumber(quote->price)); } else return(cJSON_CreateNumber(quote->price));
} }
@ -227,7 +227,7 @@ void exchanges777_json_quotes(struct exchange_info *exchange,double commission,c
//if ( strcmp(prices->exchange,"bter") == 0 && dir < 0 ) //if ( strcmp(prices->exchange,"bter") == 0 && dir < 0 )
// slot = ((bidask==0?n:m) - 1) - i; // slot = ((bidask==0?n:m) - 1) - i;
//else //else
slot = i; slot = i;
timestamp = 0; timestamp = 0;
item = jitem(bidask==0?bids:asks,slot); item = jitem(bidask==0?bids:asks,slot);
if ( pricefield != 0 && volfield != 0 ) if ( pricefield != 0 && volfield != 0 )
@ -537,10 +537,10 @@ char *exchanges777_process(struct exchange_info *exchange,int32_t *retvalp,struc
req->orderid = orderid; req->orderid = orderid;
retstr = (*exchange->issue.orderstatus)(exchange,req->orderid,req->argjson); retstr = (*exchange->issue.orderstatus)(exchange,req->orderid,req->argjson);
/*retjson = cJSON_CreateObject(); /*retjson = cJSON_CreateObject();
if ( orderid != 0 ) if ( orderid != 0 )
jadd64bits(retjson,"result",orderid); jadd64bits(retjson,"result",orderid);
else jaddstr(retjson,"error","no return value from trade call"); else jaddstr(retjson,"error","no return value from trade call");
retstr = jprint(retjson,1);*/ retstr = jprint(retjson,1);*/
} }
} }
break; break;
@ -657,7 +657,7 @@ void exchanges777_loop(void *ptr)
//if ( retval == EXCHANGE777_ISPENDING ) //if ( retval == EXCHANGE777_ISPENDING )
// queue_enqueue("Xpending",&exchange->pendingQ,&req->DL,0), flag++; // queue_enqueue("Xpending",&exchange->pendingQ,&req->DL,0), flag++;
//else //else
if ( retval == EXCHANGE777_REQUEUE ) if ( retval == EXCHANGE777_REQUEUE )
queue_enqueue("requeue",&exchange->requestQ,&req->DL,0); queue_enqueue("requeue",&exchange->requestQ,&req->DL,0);
else else
{ {
@ -769,7 +769,7 @@ char *exchanges777_submit(struct exchange_info *exchange,struct exchange_request
char *exchanges777_Qtrade(struct exchange_info *exchange,char *base,char *rel,int32_t maxseconds,int32_t dotrade,int32_t dir,double price,double volume,cJSON *argjson) char *exchanges777_Qtrade(struct exchange_info *exchange,char *base,char *rel,int32_t maxseconds,int32_t dotrade,int32_t dir,double price,double volume,cJSON *argjson)
{ {
struct exchange_request *req; int32_t polarity; struct exchange_request *req; int32_t polarity;
if ( exchange->issue.supports == 0 ) if ( exchange->issue.supports == 0 )
return(clonestr("{\"error\":\"no supports function\"}")); return(clonestr("{\"error\":\"no supports function\"}"));
if ( base[0] == 0 || rel[0] == 0 || (polarity= (*exchange->issue.supports)(exchange,base,rel,argjson)) <= 0 || price < SMALLVAL || volume < SMALLVAL ) if ( base[0] == 0 || rel[0] == 0 || (polarity= (*exchange->issue.supports)(exchange,base,rel,argjson)) <= 0 || price < SMALLVAL || volume < SMALLVAL )

7
iguana/iguana_realtime.c

@ -333,8 +333,11 @@ int32_t iguana_realtime_update(struct iguana_info *coin)
if ( (n= iguana_walkchain(coin,1)) == coin->RTheight-1 ) if ( (n= iguana_walkchain(coin,1)) == coin->RTheight-1 )
{ {
//printf("RTgenesis verified\n"); //printf("RTgenesis verified\n");
iguana_RTspendvectors(coin,bp); if ( (coin->RTheight % coin->chain->bundlesize) > 1 )
coin->RTgenesis = (uint32_t)time(NULL); {
iguana_RTspendvectors(coin,bp);
coin->RTgenesis = (uint32_t)time(NULL);
}
} else coin->RTdatabad = 1; } else coin->RTdatabad = 1;
} }
if ( dest != 0 && flag != 0 ) if ( dest != 0 && flag != 0 )

Loading…
Cancel
Save