Browse Source

Merge branch 'dev' of https://github.com/jl777/SuperNET into etomic

pass-iguana-arg
Artem Pikulin 7 years ago
parent
commit
2d12ffa05b
  1. 5
      iguana/exchanges/LP_portfolio.c
  2. 16
      iguana/exchanges/LP_transaction.c
  3. 2
      iguana/exchanges/coins
  4. 3
      iguana/m_notary_run

5
iguana/exchanges/LP_portfolio.c

@ -473,7 +473,7 @@ int32_t LP_autoref_clear(char *base,char *rel)
void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
{ {
static cJSON *tickerjson; static uint32_t lasttime; static cJSON *tickerjson; static uint32_t lasttime;
char *retstr,*base,*rel; cJSON *retjson,*bid,*ask,*fundjson,*argjson; uint64_t bidsatoshis,asksatoshis; int32_t i,changed; double bidprice,askprice,bch_usd,bch_btc,nxtkmd,price,factor,offset,newprice,buymargin,sellmargin,price_btc,price_usd,kmd_btc,kmd_usd; struct LP_priceinfo *kmdpp,*fiatpp,*nxtpp,*basepp,*relpp; char *retstr,*base,*rel; cJSON *retjson,*bid,*ask,*fundjson,*argjson; uint64_t bidsatoshis,asksatoshis; int32_t i,changed; double bidprice,askprice,bch_usd,ltc_btc,bch_btc,nxtkmd,price,factor,offset,newprice,buymargin,sellmargin,price_btc,price_usd,kmd_btc,kmd_usd; struct LP_priceinfo *kmdpp,*fiatpp,*nxtpp,*basepp,*relpp;
printf("AUTOPRICE numautorefs.%d\n",num_LP_autorefs); printf("AUTOPRICE numautorefs.%d\n",num_LP_autorefs);
if ( (retstr= issue_curlt("https://bittrex.com/api/v1.1/public/getmarketsummaries",LP_HTTP_TIMEOUT*10)) == 0 ) if ( (retstr= issue_curlt("https://bittrex.com/api/v1.1/public/getmarketsummaries",LP_HTTP_TIMEOUT*10)) == 0 )
{ {
@ -551,6 +551,7 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
} }
kmd_btc = LP_CMCbtcprice(&kmd_usd,"komodo"); kmd_btc = LP_CMCbtcprice(&kmd_usd,"komodo");
bch_btc = LP_CMCbtcprice(&bch_usd,"bitcoin-cash"); bch_btc = LP_CMCbtcprice(&bch_usd,"bitcoin-cash");
ltc_btc = LP_CMCbtcprice(&bch_usd,"litecoin");
for (i=0; i<num_LP_autorefs; i++) for (i=0; i<num_LP_autorefs; i++)
{ {
rel = LP_autorefs[i].rel; rel = LP_autorefs[i].rel;
@ -609,6 +610,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
price = kmd_btc / price_btc; price = kmd_btc / price_btc;
else if ( strcmp(rel,"BCH") == 0 && bch_btc > SMALLVAL ) else if ( strcmp(rel,"BCH") == 0 && bch_btc > SMALLVAL )
price = bch_btc / price_btc; price = bch_btc / price_btc;
else if ( strcmp(rel,"LTC") == 0 && ltc_btc > SMALLVAL )
price = ltc_btc / price_btc;
else if ( strcmp(rel,"BTC") == 0 ) else if ( strcmp(rel,"BTC") == 0 )
price = 1. / price_btc; price = 1. / price_btc;
else continue; else continue;

16
iguana/exchanges/LP_transaction.c

@ -1627,7 +1627,7 @@ char *LP_createblasttransaction(uint64_t *changep,int32_t *changeoutp,cJSON **tx
return(0); return(0);
} }
} }
if ( change < 6000 ) if ( change < 6000 || change < txfee )
change = 0; change = 0;
*changep = change; *changep = change;
if ( change != 0 ) if ( change != 0 )
@ -1913,15 +1913,17 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson)
char *LP_autosplit(struct iguana_info *coin) char *LP_autosplit(struct iguana_info *coin)
{ {
char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,halfval; char *retstr; cJSON *argjson,*withdrawjson,*outputs,*item; int64_t total,balance,halfval,txfee;
if ( coin->etomic[0] == 0 ) if ( coin->etomic[0] == 0 )
{ {
if ( coin->electrum != 0 ) if ( coin->electrum != 0 )
balance = LP_unspents_load(coin->symbol,coin->smartaddr); balance = LP_unspents_load(coin->symbol,coin->smartaddr);
else balance = LP_RTsmartbalance(coin); else balance = LP_RTsmartbalance(coin);
//printf("%s balance %.8f\n",coin->symbol,dstr(balance)); if ( (txfee= coin->txfee) == 0 ) // BTC
balance -= coin->txfee - 0.001; txfee = LP_txfeecalc(coin,0,500);
if ( balance > coin->txfee ) balance -= (txfee + 100000);
//printf("balance %.8f, txfee %.8f, threshold %.8f\n",dstr(balance),dstr(txfee),dstr((1000000 - (txfee + 100000))));
if ( balance > txfee && balance >= (1000000 - (txfee + 100000)) )
{ {
halfval = (balance / 100) * 45; halfval = (balance / 100) * 45;
argjson = cJSON_CreateObject(); argjson = cJSON_CreateObject();
@ -1938,11 +1940,11 @@ char *LP_autosplit(struct iguana_info *coin)
jadd(argjson,"outputs",outputs); jadd(argjson,"outputs",outputs);
jaddnum(argjson,"broadcast",1); jaddnum(argjson,"broadcast",1);
jaddstr(argjson,"coin",coin->symbol); jaddstr(argjson,"coin",coin->symbol);
//printf("autosplit.(%s)\n",jprint(argjson,0)); //printf("halfval %.8f autosplit.(%s)\n",dstr(halfval),jprint(argjson,0));
retstr = LP_withdraw(coin,argjson); retstr = LP_withdraw(coin,argjson);
free_json(argjson); free_json(argjson);
return(retstr); return(retstr);
} else return(clonestr("{\"error\":\"less than 0.0011 in balance\"}")); } else return(clonestr("{\"error\":\"balance too small to autosplit, please make more deposits\"}"));
} }
return(clonestr("{\"error\":\"couldnt autosplit\"}")); return(clonestr("{\"error\":\"couldnt autosplit\"}"));
} }

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

3
iguana/m_notary_run

@ -22,6 +22,9 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"ad
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"142.54.164.114\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"142.54.164.114\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"45.7.229.33\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"45.7.229.33\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"103.6.12.111\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"103.6.12.111\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"155.254.17.21\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"138.121.203.210\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"209.58.169.65\"}"
#tests/addnotarys_7776 #tests/addnotarys_7776
coins/btc_7776 coins/btc_7776

Loading…
Cancel
Save