From 1e4e6b41e71bb00f07e3cef9dac1a4edd6c85090 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 02:51:07 +0200 Subject: [PATCH 1/6] Test --- iguana/exchanges/LP_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 7de090f22..ddd95bc15 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -99,7 +99,7 @@ char *stats_JSON(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,char *r available localhost RPC commands: \n \ pricearray(base, rel, starttime=0, endtime=-1, timescale=60) -> [timestamp, avebid, aveask, highbid, lowask]\n\ setprice(base, rel, price)\n\ -autoprice(base, rel, minprice, margin, refbase, refrel, factor, offset)*\n\ +autoprice(base, rel, fixed, minprice, margin, refbase, refrel, factor, offset)*\n\ goal(coin=*, val=)\n\ myprice(base, rel)\n\ enable(coin)\n\ From b33ce9dec274549ae4fc7e886d1877b593441cd7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 03:31:00 +0200 Subject: [PATCH 2/6] Test --- iguana/exchanges/LP_nativeDEX.c | 1 + iguana/exchanges/LP_tradebots.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 27c15480b..a5a8677e9 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -18,6 +18,7 @@ // LP_nativeDEX.c // marketmaker // +// bot status 1600% ? // BCH signing // dPoW security -> 4: KMD notarized, 5: BTC notarized, after next notary elections // bigendian architectures need to use little endian for sighash calcs diff --git a/iguana/exchanges/LP_tradebots.c b/iguana/exchanges/LP_tradebots.c index 359e65c4a..fa7ab0292 100644 --- a/iguana/exchanges/LP_tradebots.c +++ b/iguana/exchanges/LP_tradebots.c @@ -445,7 +445,7 @@ char *LP_tradebot_buy(int32_t dispdir,char *base,char *rel,double maxprice,doubl jaddnum(retjson,"txfees",dstr(txfees)); shortfall = (relvolume + dstr(txfees)) - dstr(balance); jaddnum(retjson,"shortfall",shortfall); - if ( (balance= LP_RTsmartbalance(relcoin)) > abalance+SATOSHIDEN*(shortfall+relvolume/77.) ) + if ( (balance= LP_RTsmartbalance(relcoin)) > abalance+SATOSHIDEN*(shortfall+relvolume/777.) ) { char *withdrawstr; cJSON *outputjson,*withdrawjson,*outputs,*item; outputjson = cJSON_CreateObject(); From 805b228599dba7b684c32d38c0f14e44bd19e279 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 03:35:03 +0200 Subject: [PATCH 3/6] Test --- iguana/exchanges/LP_tradebots.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_tradebots.c b/iguana/exchanges/LP_tradebots.c index fa7ab0292..83369a3b2 100644 --- a/iguana/exchanges/LP_tradebots.c +++ b/iguana/exchanges/LP_tradebots.c @@ -445,7 +445,10 @@ char *LP_tradebot_buy(int32_t dispdir,char *base,char *rel,double maxprice,doubl jaddnum(retjson,"txfees",dstr(txfees)); shortfall = (relvolume + dstr(txfees)) - dstr(balance); jaddnum(retjson,"shortfall",shortfall); - if ( (balance= LP_RTsmartbalance(relcoin)) > abalance+SATOSHIDEN*(shortfall+relvolume/777.) ) + if ( relcoin->electrum != 0 ) + balance = LP_unspents_load(relcoin->symbol,relcoin->smartaddr); + else balance = LP_RTsmartbalance(relcoin); + if ( balance > abalance+SATOSHIDEN*(shortfall+relvolume/777.) ) { char *withdrawstr; cJSON *outputjson,*withdrawjson,*outputs,*item; outputjson = cJSON_CreateObject(); From 82735661798beee0a77c676475b3a5e4aac04119 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 03:38:44 +0200 Subject: [PATCH 4/6] Test --- iguana/exchanges/LP_coins.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index fe9c20f34..38c62ac64 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -201,7 +201,9 @@ cJSON *LP_coinjson(struct iguana_info *coin,int32_t showwif) if ( coin->userpass[0] != 0 ) { jaddnum(item,"height",LP_getheight(coin)); - balance = LP_RTsmartbalance(coin); + if ( coin->electrum != 0 ) + balance = LP_unspents_load(coin->symbol,coin->smartaddr); + else balance = LP_RTsmartbalance(coin); jaddnum(item,"balance",dstr(balance)); jaddnum(item,"KMDvalue",dstr(LP_KMDvalue(coin,balance))); } From eb6db9acd1d5a5621f238b62633806139e5dbc03 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 03:55:37 +0200 Subject: [PATCH 5/6] Test --- iguana/exchanges/LP_rpc.c | 2 +- iguana/exchanges/LP_tradebots.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 975b25cd7..5b5791239 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -1040,7 +1040,7 @@ bits256 LP_getbestblockhash(struct iguana_info *coin) decode_hex(blockhash.bytes,sizeof(blockhash),retstr); free(retstr); } - } + } else printf("electrum mode doesnt support block level scanning\n"); return(blockhash); } diff --git a/iguana/exchanges/LP_tradebots.c b/iguana/exchanges/LP_tradebots.c index 83369a3b2..32db8dc62 100644 --- a/iguana/exchanges/LP_tradebots.c +++ b/iguana/exchanges/LP_tradebots.c @@ -438,17 +438,18 @@ char *LP_tradebot_buy(int32_t dispdir,char *base,char *rel,double maxprice,doubl if ( dstr(abalance) < relvolume + dstr(txfees) ) { retjson = cJSON_CreateObject(); + if ( relcoin->electrum != 0 ) + balance = LP_unspents_load(relcoin->symbol,relcoin->smartaddr); + else balance = LP_RTsmartbalance(relcoin); jaddstr(retjson,"error","not enough funds"); jaddstr(retjson,"coin",rel); + jaddnum(retjson,"abalance",dstr(abalance)); jaddnum(retjson,"balance",dstr(abalance)); jaddnum(retjson,"relvolume",relvolume); jaddnum(retjson,"txfees",dstr(txfees)); shortfall = (relvolume + dstr(txfees)) - dstr(balance); jaddnum(retjson,"shortfall",shortfall); - if ( relcoin->electrum != 0 ) - balance = LP_unspents_load(relcoin->symbol,relcoin->smartaddr); - else balance = LP_RTsmartbalance(relcoin); - if ( balance > abalance+SATOSHIDEN*(shortfall+relvolume/777.) ) + if ( balance > (relvolume + 10*relvolume/777.) ) { char *withdrawstr; cJSON *outputjson,*withdrawjson,*outputs,*item; outputjson = cJSON_CreateObject(); From 248cedd8f639a52b6340b3aa0cac33390dc9a77b Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 03:56:23 +0200 Subject: [PATCH 6/6] Test --- iguana/exchanges/LP_tradebots.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_tradebots.c b/iguana/exchanges/LP_tradebots.c index 32db8dc62..d58c870eb 100644 --- a/iguana/exchanges/LP_tradebots.c +++ b/iguana/exchanges/LP_tradebots.c @@ -444,7 +444,7 @@ char *LP_tradebot_buy(int32_t dispdir,char *base,char *rel,double maxprice,doubl jaddstr(retjson,"error","not enough funds"); jaddstr(retjson,"coin",rel); jaddnum(retjson,"abalance",dstr(abalance)); - jaddnum(retjson,"balance",dstr(abalance)); + jaddnum(retjson,"balance",dstr(balance)); jaddnum(retjson,"relvolume",relvolume); jaddnum(retjson,"txfees",dstr(txfees)); shortfall = (relvolume + dstr(txfees)) - dstr(balance);