Browse Source

Initial mm

etomic
jl777 8 years ago
parent
commit
a99bdff100
  1. 58
      .gitignore
  2. 10
      basilisk/tradebots_liquidity.c
  3. 17
      basilisk/tradebots_marketmaker.c
  4. 1
      crypto777/OS_portable.h
  5. 11
      crypto777/bitcoind_RPC.c
  6. 141
      crypto777/iguana_utils.c
  7. 4
      iguana/dpow/dpow_prices.c
  8. 18
      iguana/exchanges/bittrex.c
  9. 25
      iguana/iguana_exchanges.c
  10. 43
      iguana/iguana_notary.c
  11. 17
      iguana/iguana_rpc.c
  12. 4
      iguana/m_osx
  13. 2
      iguana/tests/dexlistunspent2
  14. 1
      iguana/tests/mm
  15. 2
      includes/iguana_globals.h

58
.gitignore

@ -67,3 +67,61 @@ iguana/SVM/models/.tmpmarker
SuperNET.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist
SuperNET.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/SuperNET.xcscheme
iguana/DB/BTC/.tmpmarker
*.vouts
iguana/DB/BTC/vouts/.tmpmarker
iguana/DB/BTC/accounts/.tmpmarker
iguana/DB/BTC/spends/.tmpmarker
iguana/DB/BTC/validated/.tmpmarker
iguana/DB/KMD/.tmpmarker
iguana/DB/KMD/accounts/.tmpmarker
iguana/DB/KMD/spends/.tmpmarker
iguana/DB/KMD/validated/.tmpmarker
iguana/DB/KMD/vouts/.tmpmarker
iguana/DB/purgeable/KMD/.tmpmarker
iguana/DB/ro/.tmpmarker
iguana/DB/ro/BTC/.tmpmarker
iguana/DB/ro/KMD/.tmpmarker
iguana/confs/682c279f7b01b96aee50f11b327bf6c0a3d3481a23a9a265f0796e9bb3765b24
iguana/confs/682c279f7b01b96aee50f11b327bf6c0a3d3481a23a9a265f0796e9bb3765b24.old
iguana/confs/83cb074c13289a91a0cd50a8e6932b2237d1533ec1cbff56ab3d9b1d37f8df35
iguana/confs/83cb074c13289a91a0cd50a8e6932b2237d1533ec1cbff56ab3d9b1d37f8df35.old
iguana/tmp/BTC/.tmpmarker
iguana/tmp/BTC/0/.tmpmarker
iguana/tmp/BTC/0/0/.tmpmarker
iguana/tmp/BTC/peers.txt
iguana/tmp/BTC/RT/.tmpmarker
iguana/tmp/KMD/.tmpmarker
iguana/tmp/KMD/0/.tmpmarker
iguana/tmp/KMD/0/0/.tmpmarker
iguana/tmp/KMD/peers.txt
iguana/tmp/KMD/RT/.tmpmarker

10
basilisk/tradebots_liquidity.c

@ -982,7 +982,7 @@ void _default_liquidity_command(struct supernet_info *myinfo,char *base,bits256
} else tradebot_monitor(myinfo,0,0,0,li.exchange,li.base,li.rel,0.);
}
myinfo->linfos[i] = li;
printf("Set linfo[%d] %s (%s/%s) profitmargin %.6f bid %.6f ask %.8f maxvol %.f ref %.8f\n",i,li.exchange,li.base,li.rel,li.profit,li.bid,li.ask,li.maxvol,li.refprice);
printf("Set linfo[%d] %s (%s/%s) profitmargin %.6f bid %.8f ask %.8f minvol %.6f maxvol %.6f ref %.8f <- (%s)\n",i,li.exchange,li.base,li.rel,li.profit,li.bid,li.ask,li.minvol,li.maxvol,li.refprice,jprint(vals,0));
return;
}
}
@ -1101,8 +1101,8 @@ void _default_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_s
{
printf("BOB: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir < 0. ? "buy" : "sell",price + dir * price * profitmargin,100*profitmargin);
if ( dir < 0. )
tradestr = InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
else tradestr = InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
tradestr = InstantDEX_buy(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
else tradestr = InstantDEX_sell(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
}
}
else
@ -1111,8 +1111,8 @@ void _default_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_s
{
printf("ALICE: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir > 0. ? "buy" : "sell",price - dir * price * profitmargin,100*profitmargin);
if ( dir > 0. )
tradestr = InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
else tradestr = InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
tradestr = InstantDEX_buy(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
else tradestr = InstantDEX_sell(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
}
}
if ( tradestr != 0 )

17
basilisk/tradebots_marketmaker.c

@ -180,24 +180,15 @@ ZERO_ARGS(tradebot,portfolio)
else return(jprint(portfolio,1));
}
/*li.profit = jdouble(vals,"profit");
li.refprice = jdouble(vals,"refprice");
li.bid = jdouble(vals,"bid");
li.ask = jdouble(vals,"ask");
if ( (li.minvol= jdouble(vals,"minvol")) <= 0. )
li.minvol = (strcmp("BTC",base) == 0) ? 0.0001 : 0.001;
if ( (li.maxvol= jdouble(vals,"maxvol")) < li.minvol )
li.maxvol = li.minvol;*/
ARRAY_OBJ_INT(tradebot,goals,currencies,vals,targettime)
{
static bits256 zero; char *targetcoin; int32_t i,n;
if ( currencies != 0 && vals != 0 )
{
// init things so automatically updates refli.bid and refli.ask
// volume range with margin
// currency percentage value in BTC? target distribution, max percentage, min percentage`
// min price to sell, max price to buy, max volume
// init things so automatically updates refli.bid and refli.ask
// volume range with margin
// currency percentage value in BTC? target distribution, max percentage, min percentage`
// min price to sell, max price to buy, max volume
n = cJSON_GetArraySize(currencies);
for (i=0; i<n; i++)
{

1
crypto777/OS_portable.h

@ -404,6 +404,7 @@ int32_t revsort32(uint32_t *buf,uint32_t num,int32_t size);
bits256 bits256_sha256(bits256 data);
void bits256_rmd160(uint8_t rmd160[20],bits256 data);
void bits256_rmd160_sha256(uint8_t rmd160[20],bits256 data);
double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,double *CMC_averagep,double changes[3],char *name,char *base,char *rel);
extern char *Iguana_validcommands[];
extern bits256 GENESIS_PUBKEY,GENESIS_PRIVKEY;

11
crypto777/bitcoind_RPC.c

@ -109,6 +109,8 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
*
************************************************************************/
static int32_t USE_JAY;
char *Jay_NXTrequest(char *command,char *params)
{
char *retstr = 0;
@ -127,7 +129,7 @@ char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *
didinit = 1;
curl_global_init(CURL_GLOBAL_ALL); //init the curl session
}
if ( USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0) )
if ( (0) && (USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0)) )
{
if ( (databuf= Jay_NXTrequest(command,params)) != 0 )
return(databuf);
@ -177,9 +179,12 @@ try_again:
bracket0 = (char *)"[";
bracket1 = (char *)"]";
}
char agentstr[64];
databuf = (char *)malloc(256 + strlen(command) + strlen(params));
sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1);
if ( debugstr[0] != 0 )
sprintf(agentstr,"\"agent\":\"%s\",",debugstr);
else agentstr[0] = 0;
sprintf(databuf,"{\"id\":\"jl777\",%s\"method\":\"%s\",\"params\":%s%s%s}",agentstr,command,bracket0,params,bracket1);
//printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf);
//
} //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params);

141
crypto777/iguana_utils.c

@ -1146,3 +1146,144 @@ void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen)
vcalc_sha256(0,hash.bytes,data,datalen);
calc_rmd160(0,rmd160,hash.bytes,sizeof(hash));
}
char *cmc_ticker(char *base)
{
char url[512];
sprintf(url,"https://api.coinmarketcap.com/v1/ticker/%s/",base);
return(issue_curl(url));
}
char *bittrex_orderbook(char *base,char *rel,int32_t maxdepth)
{
char market[64],url[512];
sprintf(market,"%s-%s",rel,base);
sprintf(url,"http://bittrex.com/api/v1.1/public/getorderbook?market=%s&type=both&depth=%d",market,maxdepth);
return(issue_curl(url));
}
double calc_theoretical(double weighted,double CMC_average,double changes[3])
{
double adjusted = 0.,theoretical = 0.;
if ( weighted > SMALLVAL && CMC_average > SMALLVAL )
{
theoretical = (weighted + CMC_average) * 0.5;
if ( changes[0] > SMALLVAL && changes[1] > SMALLVAL && changes[2] > SMALLVAL )
{
if ( changes[0] > changes[1] && changes[1] > changes[2] ) // breakout
{
adjusted = theoretical * (1. - (changes[0] + changes[1]) * .005);
}
}
else if ( changes[1] < -SMALLVAL && changes[2] < -SMALLVAL ) //changes[0] < -SMALLVAL &&
{
if ( (1) )//&& changes[0] < changes[1] && changes[1] < changes[2] ) // waterfall
{
adjusted = theoretical * (1. - (changes[0] + changes[1]) * .005);
}
}
if ( adjusted != 0. && theoretical != 0. )
theoretical = (theoretical + adjusted) * 0.5;
}
printf("adjusted %.8f theoretical %.8f (%.8f + wt %.8f)\n",adjusted,theoretical,CMC_average,weighted);
return(theoretical);
}
double calc_weighted(double *avebidp,double *aveaskp,double *bids,double *bidvols,int32_t numbids,double *asks,double *askvols,int32_t numasks,double limit)
{
int32_t i; double weighted = 0.,bidsum = 0., asksum = 0.,totalbids = 0.,totalasks = 0.;
bidsum = bids[0] * bidvols[0], totalbids = bidvols[0];
asksum = asks[0] * askvols[0], totalasks = askvols[0];
for (i=1; i<numbids; i++)
{
if ( totalbids > limit )
break;
bidsum += bids[i] * bidvols[i];
totalbids += bidvols[i];
}
for (i=1; i<numasks; i++)
{
if ( totalasks > limit )
break;
asksum += asks[i] * askvols[i];
totalasks += askvols[i];
}
if ( totalbids != 0. && totalasks != 0. )
{
*avebidp = (bidsum / totalbids);
*aveaskp = (asksum / totalasks);
weighted = (*avebidp + *aveaskp) * 0.5;
}
//printf("weighted %f\n",weighted);
return(weighted);
}
double weighted_orderbook(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,char *orderbookstr,double limit)
{
cJSON *bookjson,*bid,*ask,*resobj,*item; int32_t i,numbids,numasks; double bidvols[50],bids[50],askvols[50],asks[50],weighted = 0.;
if ( orderbookstr != 0 )
{
if ( (bookjson= cJSON_Parse(orderbookstr)) != 0 )
{
if ( (resobj= jobj(bookjson,"result")) != 0 )
{
bid = jarray(&numbids,resobj,"buy");
if ( numbids > sizeof(bids)/sizeof(*bids) )
numbids = (int32_t)(sizeof(bids)/sizeof(*bids));
ask = jarray(&numasks,resobj,"sell");
if ( numasks > sizeof(asks)/sizeof(*asks) )
numasks = (int32_t)(sizeof(asks)/sizeof(*asks));
if ( bid != 0 && ask != 0 )
{
for (i=0; i<numbids; i++)
{
item = jitem(bid,i);
bidvols[i] = jdouble(item,"Quantity");
bids[i] = jdouble(item,"Rate");
}
for (i=0; i<numasks; i++)
{
item = jitem(ask,i);
askvols[i] = jdouble(item,"Quantity");
asks[i] = jdouble(item,"Rate");
}
*highbidp = bids[0];
*lowaskp = asks[0];
weighted = calc_weighted(avebidp,aveaskp,bids,bidvols,numbids,asks,askvols,numasks,limit);
//printf("weighted %.8f (%.8f %.8f)\n",weighted,*highbidp,*lowaskp);
}
}
free_json(bookjson);
}
}
return(weighted);
}
double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,double *CMC_averagep,double changes[3],char *name,char *base,char *rel)
{
static int32_t counter;
char *cmcstr; cJSON *cmcjson,*item; double weighted,theoretical = 0.;
*avebidp = *aveaskp = *highbidp = *lowaskp = *CMC_averagep = 0.;
if ( (cmcstr= cmc_ticker(name)) != 0 )
{
if ( (cmcjson= cJSON_Parse(cmcstr)) != 0 )
{
if ( is_cJSON_Array(cmcjson) == 0 )
item = cmcjson;
else item = jitem(cmcjson,0);
*CMC_averagep = jdouble(item,"price_btc");
changes[0] = jdouble(item,"percent_change_1h");
changes[1] = jdouble(item,"percent_change_24h");
changes[2] = jdouble(item,"percent_change_7d");
weighted = weighted_orderbook(avebidp,aveaskp,highbidp,lowaskp,bittrex_orderbook(base,rel,25),1./(*CMC_averagep));
if ( *CMC_averagep > SMALLVAL && weighted > SMALLVAL )
theoretical = calc_theoretical(weighted,*CMC_averagep,changes);
if ( counter++ == 0 )
printf("HBLA.[%.8f %.8f] AVE.[%.8f %.8f] (%s) CMC %f %f %f %f\n",*highbidp,*lowaskp,*avebidp,*aveaskp,jprint(item,0),*CMC_averagep,changes[0],changes[1],changes[2]);
free_json(cmcjson);
}
free(cmcstr);
}
return(theoretical);
}

4
iguana/dpow/dpow_prices.c

@ -1450,7 +1450,7 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
}
if ( 1 )
{
double avebid,aveask,bidvol,askvol; //struct exchange_quote sortbuf[512]; struct supernet_info *myinfo = SuperNET_MYINFO(0); cJSON *argjson = cJSON_Parse("{}");
double avebid,aveask,bidvol,askvol,highbid,lowask,CMC_average,changes[3]; //struct exchange_quote sortbuf[512]; struct supernet_info *myinfo = SuperNET_MYINFO(0); cJSON *argjson = cJSON_Parse("{}");
//aveask = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&askvol,"KMD","BTC",1,argjson);
//avebid = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&bidvol,"KMD","BTC",-1,argjson);
if ( 0 && avebid > SMALLVAL && aveask > SMALLVAL )
@ -1460,6 +1460,8 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
printf("set KMD price %f\n",price);
dp->KMDBTC = price;
}
else if ( (dp->KMDBTC= get_theoretical(&avebid,&aveask,&highbid,&lowask,&CMC_average,changes,"komodo","KMD","BTC")) > SMALLVAL )
*kmdbtcp = dp->KMDBTC;
else
{
for (iter=1; iter<2; iter++)

18
iguana/exchanges/bittrex.c

@ -194,8 +194,13 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha
char *ORDERSTATUS(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson)
{
char payload[1024],*retstr = 0; cJSON *json;
sprintf(payload,"https://bittrex.com/api/v1.1/account/getorder?apikey=%s&nonce=%llu&uuid=%llu",exchange->apikey,(long long)exchange_nonce(exchange),(long long)quoteid);
char payload[1024],*orderstr=0,orderbuf[512],*retstr = 0; cJSON *json;
if ( argjson != 0 )
orderstr = jstr(argjson,"uuid");//, printf("status.(%s)\n",jprint(argjson,0));
if ( orderstr == 0 )
sprintf(orderbuf,"%llu",(long long)quoteid);
else strcpy(orderbuf,jstr(argjson,"uuid"));
sprintf(payload,"https://bittrex.com/api/v1.1/account/getorder?apikey=%s&nonce=%llu&uuid=%s",exchange->apikey,(long long)exchange_nonce(exchange),orderbuf);
if ( (json= SIGNPOST(&exchange->cHandle,1,&retstr,exchange,payload,payload)) != 0 )
{
free_json(json);
@ -205,8 +210,13 @@ char *ORDERSTATUS(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson
char *CANCELORDER(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson)
{
char payload[1024],*retstr = 0; cJSON *json;
sprintf(payload,"https://bittrex.com/api/v1.1/market/cancel?apikey=%s&nonce=%llu&uuid=%llu",exchange->apikey,(long long)exchange_nonce(exchange),(long long)quoteid);
char payload[1024],*orderstr,orderbuf[512],*retstr = 0; cJSON *json;
if ( argjson != 0 )
orderstr = jstr(argjson,"uuid");//, printf("cancel.(%s)\n",jprint(argjson,0));
if ( orderstr == 0 )
sprintf(orderbuf,"%llu",(long long)quoteid);
else strcpy(orderbuf,jstr(argjson,"uuid"));
sprintf(payload,"https://bittrex.com/api/v1.1/market/cancel?apikey=%s&nonce=%llu&uuid=%s",exchange->apikey,(long long)exchange_nonce(exchange),orderbuf);
if ( (json= SIGNPOST(&exchange->cHandle,1,&retstr,exchange,payload,payload)) != 0 )
{
free_json(json);

25
iguana/iguana_exchanges.c

@ -995,6 +995,7 @@ char *exchanges777_Qrequest(struct exchange_info *exchange,int32_t func,char *ba
safecopy(req->rel,rel,sizeof(req->rel));
req->retstrp = calloc(1,sizeof(void *));
req->orderid = orderid;
req->argjson = jduplicate(argjson);
//printf("Qrequest\n");
return(exchanges777_submit(exchange,req,func,maxseconds));
}
@ -1244,26 +1245,42 @@ TWO_STRINGS(InstantDEX,balance,exchange,base)
TWO_STRINGS(InstantDEX,orderstatus,exchange,orderid)
{
struct exchange_info *ptr;
struct exchange_info *ptr; cJSON *argjson; char *retstr; uint64_t num = 0;
if ( remoteaddr == 0 )
{
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 )
return(exchanges777_Qrequest(ptr,'P',0,0,juint(json,"maxseconds"),calc_nxt64bits(orderid),0,0,json));
{
argjson = cJSON_CreateObject();
jaddstr(argjson,"uuid",orderid);
if ( is_decimalstr(orderid) != 0 )
num = calc_nxt64bits(orderid);
retstr = exchanges777_Qrequest(ptr,'P',0,0,juint(json,"maxseconds"),num,0,0,argjson);
free_json(argjson);
return(retstr);
}
else return(clonestr("{\"error\":\"cant find or create exchange\"}"));
} else return(clonestr("{\"error\":\"no remote for this API\"}"));
}
TWO_STRINGS(InstantDEX,cancelorder,exchange,orderid)
{
struct exchange_info *ptr;
struct exchange_info *ptr; cJSON *argjson; char *retstr; uint64_t num = 0;
if ( remoteaddr == 0 )
{
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 )
return(exchanges777_Qrequest(ptr,'C',0,0,juint(json,"maxseconds"),calc_nxt64bits(orderid),0,0,json));
{
argjson = cJSON_CreateObject();
jaddstr(argjson,"uuid",orderid);
if ( is_decimalstr(orderid) != 0 )
num = calc_nxt64bits(orderid);
retstr = exchanges777_Qrequest(ptr,'C',0,0,juint(json,"maxseconds"),num,0,0,argjson);
free_json(argjson);
return(retstr);
}
else return(clonestr("{\"error\":\"cant find or create exchange\"}"));
} else return(clonestr("{\"error\":\"no remote for this API\"}"));
}

43
iguana/iguana_notary.c

@ -771,6 +771,7 @@ TWO_STRINGS(dex,listspent,symbol,address)
TWO_STRINGS(dex,getbalance,symbol,address)
{
char url[512],*retstr; cJSON *retjson; uint64_t val;
if ( myinfo->DEXEXPLORER != 0 )
{
if ( symbol != 0 && address != 0 && (coin= iguana_coinfind(symbol)) != 0 && coin->DEXEXPLORER != 0 )
@ -779,8 +780,48 @@ TWO_STRINGS(dex,getbalance,symbol,address)
coin->DEXEXPLORER = myinfo->DEXEXPLORER * myinfo->IAMNOTARY * (iguana_isnotarychain(coin->symbol) >= 0);
}
if ( symbol != 0 && address != 0 )
{
if ( strcmp(symbol,"BTC") == 0 )
{
sprintf(url,"https://api.blocktrail.com/v1/btc/address/%s?api_key=e5ddfdceb58fa6c1bf9411aaeff4b6ee28cbc370",address);
if ( (retstr= issue_curl(url)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (val= j64bits(retjson,"balance")) != 0 )
{
jdelete(retjson,"balance");
jaddnum(retjson,"balance",dstr(val));
}
if ( (val= j64bits(retjson,"sent")) != 0 )
{
jdelete(retjson,"sent");
jaddnum(retjson,"sent",dstr(val));
}
if ( (val= j64bits(retjson,"received")) != 0 )
{
jdelete(retjson,"received");
jaddnum(retjson,"received",dstr(val));
}
if ( (val= j64bits(retjson,"unconfirmed_sent")) != 0 )
{
jdelete(retjson,"unconfirmed_sent");
jaddnum(retjson,"unconfirmed_sent",dstr(val));
}
if ( (val= j64bits(retjson,"unconfirmed_received")) != 0 )
{
jdelete(retjson,"unconfirmed_received");
jaddnum(retjson,"unconfirmed_received",dstr(val));
}
//printf("(%s) -> (%s)\n",retstr,jprint(retjson,0));
free(retstr);
retstr = jprint(retjson,1);
}
}
return(retstr);
}
return(_dex_getbalance(myinfo,symbol,address));
else return(clonestr("{\"error\":\"dex getbalance null symbol, address or coin\"}"));
} else return(clonestr("{\"error\":\"dex getbalance null symbol, address or coin\"}"));
}
STRING_ARG(dex,explorer,symbol)

17
iguana/iguana_rpc.c

@ -1100,11 +1100,18 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz
}
else
{
//printf("ARGJSON.(%s)\n",jprint(argjson,0));
coin = iguana_coinchoose(myinfo,symbol,argjson,port);
if ( userpass != 0 && jstr(argjson,"userpass") == 0 )
jaddstr(argjson,"userpass",userpass);
retstr = SuperNET_JSON(myinfo,coin,argjson,remoteaddr,port);
cJSON *arg;
if ( jstr(argjson,"agent") != 0 && strcmp(jstr(argjson,"agent"),"bitcoinrpc") != 0 && jobj(argjson,"params") != 0 )
{
arg = jobj(argjson,"params");
if ( is_cJSON_Array(arg) != 0 && cJSON_GetArraySize(arg) == 1 )
arg = jitem(arg,0);
} else arg = argjson;
//printf("ARGJSON.(%s)\n",jprint(arg,0));
coin = iguana_coinchoose(myinfo,symbol,arg,port);
if ( userpass != 0 && jstr(arg,"userpass") == 0 )
jaddstr(arg,"userpass",userpass);
retstr = SuperNET_JSON(myinfo,coin,arg,remoteaddr,port);
}
free_json(argjson);
free_json(json);

4
iguana/m_osx

@ -3,6 +3,6 @@
rm ../agents/iguana *.o
git pull
cd secp256k1; ./m_unix; cd ..
gcc -g -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -Wno-address-of-packed-member -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lcurl -lssl -lcrypto -lpthread -lz -lm
gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm

2
iguana/tests/dexlistunspent2

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent2\",\"address\":\"R9eW4hVmhGYCExBSJ15vX61fEoENgDvHhj\",\"symbol\":\"KMD\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent2\",\"address\":\"RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc\",\"symbol\":\"KMD\"}"

1
iguana/tests/mm

@ -0,0 +1 @@
./marketmaker "{\"passphrase\":\"<yourstrongpassphrasehere>\",\"base\":\"KMD\",\"rel\":\"BTC\",\"name\":\"komodo\",\"exchange\":\"bittrex\",\"apikey\":\"<yourbittrexapikey>\",\"apisecret\":\"<yourbittrexapisecret>\",\"profitmargin\":0.001,\"maxexposure\":0.1,\"lotratio\":0.02,\"start_rel\":0.1,\"start_base\":1000}"

2
includes/iguana_globals.h

@ -64,7 +64,7 @@ CONDEXTERN int32_t Showmode,Autofold,PANGEA_MAXTHREADS,QUEUEITEMS;
CONDEXTERN struct gecko_chain *Categories;
//CONDEXTERN struct iguana_info *Allcoins;
CONDEXTERN char Userhome[512];
CONDEXTERN int32_t USE_JAY,FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel,IGUANA_BIGENDIAN;
CONDEXTERN int32_t FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel,IGUANA_BIGENDIAN;
CONDEXTERN uint32_t prices777_NXTBLOCK;
CONDEXTERN queue_t helperQ,JSON_Q,FINISHED_Q,bundlesQ,emitQ;
CONDEXTERN struct supernet_info MYINFO,**MYINFOS;

Loading…
Cancel
Save