From 723f28cddb0fb6fe9c43407a0a992d3435d724c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 23 Dec 2016 00:35:47 +0200 Subject: [PATCH 1/6] test --- iguana/dpow/dpow_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index f106cb255..78d7d0a97 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -692,9 +692,9 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru bp->notaries[senderind].src.prev_vout = srcvout; bp->notaries[senderind].dest.prev_hash = destutxo; bp->notaries[senderind].dest.prev_vout = destvout; - //if ( bestmask != 0 ) + if ( bestmask != 0 ) bp->notaries[senderind].bestmask = bestmask; - //if ( recvmask != 0 ) + if ( recvmask != 0 ) bp->notaries[senderind].recvmask = recvmask; if ( (bp->notaries[senderind].paxwdcrc= paxwdcrc) != 0 ) { From 753498d0e3eb96ef5a4cb3ec1995e20680062d59 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 23 Dec 2016 10:29:00 +0200 Subject: [PATCH 2/6] test --- iguana/dpow/dpow_network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 78d7d0a97..b63a1a0dd 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -367,7 +367,7 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) maxsize = 1024 * 1024; printf("RCVBUF.%d\n",nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); printf("RCVBUF.%d\n",nn_setsockopt(repsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); - printf("DEXINIT dpow.%d dex.%d rep.%d\n",dpowsock,myinfo->dexsock,myinfo->repsock); + printf("DEXINIT dpow.%d dex.%d rep.%d\n",dpowsock,dexsock,repsock); } } } From 095a82018c428acb3b185d898ad801bae5367f59 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 23 Dec 2016 11:54:39 +0200 Subject: [PATCH 3/6] test --- iguana/dpow/dpow_network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index b63a1a0dd..6f2895f6b 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -480,7 +480,7 @@ void dpow_nanoutxoset(struct dpow_nanoutxo *np,struct dpow_block *bp,int32_t isr } else { - dpow_bestconsensus(bp); + //dpow_bestconsensus(bp); np->srcutxo = bp->notaries[bp->myind].src.prev_hash; np->srcvout = bp->notaries[bp->myind].src.prev_vout; np->destutxo = bp->notaries[bp->myind].dest.prev_hash; From 96c9b4dda70f3a763b88212c3bc139a9a9671057 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 23 Dec 2016 12:39:47 +0200 Subject: [PATCH 4/6] test --- iguana/main.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/iguana/main.c b/iguana/main.c index 1ab88d59d..a6710261a 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1618,21 +1618,21 @@ void iguana_main(void *arg) iguana_urlinit(myinfo,ismainnet,usessl); portable_mutex_init(&myinfo->dpowmutex); portable_mutex_init(&myinfo->notarymutex); - if ( myinfo->IAMNOTARY == 0 ) - { #if LIQUIDITY_PROVIDER - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("lakebtc"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("quadriga"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("okcoin"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btce"),0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitstamp"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("lakebtc"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("quadriga"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("okcoin"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btce"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitstamp"),0); #endif + if ( myinfo->IAMNOTARY == 0 ) + { if ( iguana_commandline(myinfo,arg) == 0 ) { iguana_helpinit(myinfo); From 7582dd3ecdf0d7117600ab58cd8d78946d8f18a5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 23 Dec 2016 12:50:15 +0200 Subject: [PATCH 5/6] test --- iguana/iguana_exchanges.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/iguana_exchanges.c b/iguana/iguana_exchanges.c index dadfd3b59..899f3479f 100755 --- a/iguana/iguana_exchanges.c +++ b/iguana/iguana_exchanges.c @@ -100,7 +100,7 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s for (totalvol=pricesum=i=0; i Date: Fri, 23 Dec 2016 14:30:08 +0200 Subject: [PATCH 6/6] test --- iguana/exchanges/poloniex.c | 19 ++++++++++++++----- iguana/iguana_exchanges.c | 19 +++++++++++++------ iguana/tests/rate | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/iguana/exchanges/poloniex.c b/iguana/exchanges/poloniex.c index ffcd1481a..0e4061d99 100755 --- a/iguana/exchanges/poloniex.c +++ b/iguana/exchanges/poloniex.c @@ -72,20 +72,29 @@ int32_t SUPPORTS(struct exchange_info *exchange,char *base,char *rel,cJSON *argj { //char *baserels[][2] = { {"btc","usd"} }; //return(baserel_polarity(baserels,(int32_t)(sizeof(baserels)/sizeof(*baserels)),base,rel)); - if ( strlen(base) > 5 || strlen(rel) > 5 || strcmp(rel,"CNY") == 0 || strcmp(base,"CNY") == 0 || strcmp(rel,"USD") == 0 || strcmp(base,"USD") == 0 ) + if ( strlen(base) > 5 || strlen(rel) > 5 || strcmp(rel,"CNY") == 0 || strcmp(base,"CNY") == 0 ) return(0); - if ( strcmp(rel,"BTC") == 0 ) + if ( strcmp(base,"BTC") == 0 && strcmp(rel,"USD") == 0 ) + return(1); + else if ( strcmp(rel,"BTC") == 0 && strcmp(base,"USD") == 0 ) + return(-1); + else if ( strcmp(rel,"BTC") == 0 ) return(1); else if ( strcmp(base,"BTC") == 0 ) return(-1); else return(0); } -double UPDATE(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *quotes,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert) +double UPDATE(struct exchange_info *exchange,char *_base,char *_rel,struct exchange_quote *quotes,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert) { - char market[128],url[1024]; - sprintf(market,"%s_%s",rel,base); + char market[128],url[1024],base[16],rel[16]; + strcpy(base,_base), touppercase(base); + strcpy(rel,_rel), touppercase(rel); + if ( strcmp(rel,"USD") == 0 ) + sprintf(market,"USDT_%s",base); + else sprintf(market,"%s_%s",rel,base); sprintf(url,"https://poloniex.com/public?command=returnOrderBook¤cyPair=%s&depth=%d",market,maxdepth); + //printf("URL.(%s)\n",url); return(exchanges777_standardprices(exchange,commission,base,rel,url,quotes,0,0,maxdepth,0,invert)); } diff --git a/iguana/iguana_exchanges.c b/iguana/iguana_exchanges.c index 899f3479f..47384fbc2 100755 --- a/iguana/iguana_exchanges.c +++ b/iguana/iguana_exchanges.c @@ -25,7 +25,7 @@ int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_quote *sortbuf,int32_t n,int32_t max,int32_t ind,int32_t dir,struct exchange_quote *quotes,int32_t numquotes) { int32_t i; struct exchange_quote *quote; - //printf("instantdex_updatesources.%s update dir.%d numquotes.%d\n",exchange->name,dir,numquotes); + printf("instantdex_updatesources.%s update dir.%d numquotes.%d\n",exchange->name,dir,numquotes); for (i=0; inumbids > 0 && active[i]->numasks > 0 ) + { + + } + } for (i=n=0; inumbids > 0 ) @@ -93,19 +100,19 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s else if ( dir > 0 && active[i]->numasks > 0 ) n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,-1,&active[i]->bidasks[1],active[i]->numasks); } - //printf("numexchanges.%d dir.%d %s/%s numX.%d n.%d\n",myinfo->numexchanges,dir,base,rel,num,n); + printf("numexchanges.%d dir.%d %s/%s numX.%d n.%d\n",myinfo->numexchanges,dir,base,rel,num,n); if ( dir < 0 ) revsort64s(&sortbuf[0].satoshis,n,sizeof(*sortbuf)); else sort64s(&sortbuf[0].satoshis,n,sizeof(*sortbuf)); - for (totalvol=pricesum=i=0; iexchange->name,pricesum/totalvol,totalvol); + printf("dir.%d i.%d of %d %12.8f vol %.8f %s | aveprice %.8f total vol %.8f\n",dir,i,n,sortbuf[i].price,quote.volume,active[quote.val]->exchange->name,pricesum/totalvol,totalvol); } } if ( totalvol > 0. ) @@ -821,7 +828,7 @@ void exchanges777_loop(void *ptr) for (i=req->numasks=0; idepth; i++) if ( req->bidasks[(i << 1) + 1].price > SMALLVAL ) req->numasks++; - //printf("%-10s %s/%s numbids.%d numasks.%d\n",exchange->name,req->base,req->rel,req->numbids,req->numasks); +//printf("%-10s %s/%s numbids.%d numasks.%d\n",exchange->name,req->base,req->rel,req->numbids,req->numasks); prices777_processprice(exchange,req->base,req->rel,req->bidasks,req->depth); } queue_enqueue("pricesQ",&exchange->pricesQ,&req->DL); diff --git a/iguana/tests/rate b/iguana/tests/rate index 8692a94cc..99ea9f314 100755 --- a/iguana/tests/rate +++ b/iguana/tests/rate @@ -1,2 +1,2 @@ #!/bin/bash -curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"iguana\",\"method\":\"rate\",\"base\":\"BTCD\",\"rel\":\"BTC\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"iguana\",\"method\":\"rate\",\"base\":\"BTC\",\"rel\":\"USD\"}"