From 79d2c680331ee90f273c77181f6bec520c0fb2db Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 20 Jul 2017 14:53:17 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_coins.c | 2 +- iguana/exchanges/LP_portfolio.c | 6 +++--- iguana/exchanges/LP_prices.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 21661ab86..242743d93 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -271,7 +271,7 @@ struct iguana_info *LP_coinfind(char *symbol) assetname = ""; if ( strcmp(symbol,"BTC") == 0 ) { - txfee = 50000; + txfee = 0; estimatedrate = 300; pubtype = 0; p2shtype = 5; diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 2d9a26b0f..da3956e43 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -404,7 +404,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) void prices_loop(void *ignore) { - char *buycoin,*sellcoin,*retstr,*retstr2; double bid,ask,maxprice,relvolume; struct iguana_info *buy,*sell; uint32_t requestid,quoteid; cJSON *retjson,*retjson2; struct LP_priceinfo *btcpp; void *ctx = bitcoin_ctx(); + char *buycoin,*sellcoin,*retstr,*retstr2; double bid,ask,maxprice,relvolume; struct iguana_info *buy,*sell; uint32_t requestid,quoteid,iter; cJSON *retjson,*retjson2; struct LP_priceinfo *btcpp; void *ctx = bitcoin_ctx(); while ( 1 ) { if ( (btcpp= LP_priceinfofind("BTC")) == 0 ) @@ -423,10 +423,10 @@ void prices_loop(void *ignore) LP_myprice(&bid,&ask,buycoin,sellcoin); maxprice = ask; printf("base buy.%s force %f, rel sell.%s force %f relvolume %f maxprice %.8f (%.8f %.8f)\n",buycoin,jdouble(retjson,"buyforce"),sellcoin,jdouble(retjson,"sellforce"),sell->relvolume,maxprice,bid,ask); - if ( maxprice > SMALLVAL ) + if ( maxprice > SMALLVAL && LP_utxo_bestfit(sellcoin,sell->relvolume) != 0 ) { relvolume = sell->relvolume; - while ( relvolume > 0.0001 ) + for (iter=0; iter<3; iter++) { requestid = quoteid = 0; if ( (retstr2= LP_autotrade(ctx,"127.0.0.1",-1,buycoin,sellcoin,maxprice,sell->relvolume,60,24*3600)) != 0 ) diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index a81ea73ac..6cc7a79c8 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -344,7 +344,7 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price) if ( fabs(basepp->myprices[relpp->ind] - price) > SMALLVAL ) *changedp = 1; basepp->myprices[relpp->ind] = price; // ask - printf("LP_mypriceset base.%s rel.%s <- price %.8f\n",base,rel,price); + //printf("LP_mypriceset base.%s rel.%s <- price %.8f\n",base,rel,price); //relpp->myprices[basepp->ind] = (1. / price); // bid if ( (pubp= LP_pubkeyadd(LP_mypub25519)) != 0 ) {