Browse Source

test

etomic
jl777 8 years ago
parent
commit
65ea597fcd
  1. 7
      basilisk/basilisk_MSG.c
  2. 2
      basilisk/basilisk_tradebot.c
  3. 14
      iguana/iguana_exchanges.c
  4. 2
      iguana/iguana_payments.c
  5. 2
      iguana/main.c

7
basilisk/basilisk_MSG.c

@ -285,14 +285,15 @@ HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr)
jdelete(vals,"msgid");
jaddnum(vals,"msgid",msgid);
}
if ( myinfo->NOTARY.RELAYID >= 0 || myinfo->dexsock >= 0 )
if ( myinfo->NOTARY.RELAYID >= 0 || myinfo->dexsock >= 0 || myinfo->subsock >= 0 )
{
channel = juint(vals,"channel");
width = juint(vals,"width");
retstr = basilisk_iterate_MSG(myinfo,channel,msgid,jbits256(vals,"srchash"),jbits256(vals,"desthash"),width);
//printf("getmessage.(%s)\n",retstr);
return(retstr);
}
//printf("getmessage not relay.%d\n",myinfo->NOTARY.RELAYID);
//printf("getmessage not relay.%d dexsock.%d subsock.%d\n",myinfo->NOTARY.RELAYID,myinfo->dexsock,myinfo->subsock);
return(basilisk_standardservice("MSG",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,1));
}
@ -300,7 +301,7 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
{
int32_t keylen,datalen; uint8_t key[BASILISK_KEYSIZE],space[16384],space2[16384],*data,*ptr = 0; char *retstr=0;
data = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,&space[BASILISK_KEYSIZE],sizeof(space)-BASILISK_KEYSIZE,hexstr);
if ( myinfo->dexsock >= 0 || (myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0) )
if ( myinfo->subsock >= 0 || myinfo->dexsock >= 0 || (myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0) )
{
keylen = basilisk_messagekey(key,juint(vals,"channel"),juint(vals,"msgid"),jbits256(vals,"srchash"),jbits256(vals,"desthash"));
if ( data != 0 )

2
basilisk/basilisk_tradebot.c

@ -447,7 +447,7 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk
{
if ( minamount != 0 && maxamount > minamount && time(NULL) > BASILISK_DEXDURATION/2 )
{
printf("automatch quoteid.%u triggered %.8f > %.8f\n",list[maxi].quoteid,dstr(maxamount),dstr(minamount));
printf("automatch[%d] quoteid.%u triggered %.8f > %.8f\n",maxi,list[maxi].quoteid,dstr(maxamount),dstr(minamount));
*issueR = list[maxi];
if ( minamount > 0 )
metric = (dstr(maxamount) / dstr(minamount)) - 1.;

14
iguana/iguana_exchanges.c

@ -22,7 +22,7 @@
//char *Exchange_names[] = { "poloniex", "bittrex", "btc38", "huobi", "bitstamp", "bitfinex", "btce", "coinbase", "okcoin", "lakebtc", "quadriga", "truefx", "ecb", "instaforex", "fxcm", "yahoo" };
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,double offset)
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,double offset,double factor)
{
int32_t i; struct exchange_quote *quote;
//printf("instantdex_updatesources.%s update dir.%d numquotes.%d offset %.6f\n",exchange->name,dir,numquotes,offset);
@ -33,6 +33,8 @@ int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_
{
//printf("%s n.%d ind.%d i.%d dir.%d price %.8f vol %.8f offset %.6f\n",exchange->name,n,ind,i,dir,quote->price+offset,quote->volume,offset);
quote->price += offset;
quote->price /= factor;
quote->volume *= factor;
quote->satoshis = quote->price * SATOSHIDEN;
sortbuf[n] = *quote;
sortbuf[n].val = ind;
@ -47,7 +49,7 @@ int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_
double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *sortbuf,int32_t max,double *totalvolp,char *base,char *rel,double basevolume,cJSON *argjson)
{
char *str; double totalvol,pricesum,hblas[64][2],refbid,refask; uint32_t timestamp;
char *str; double totalvol,pricesum,hblas[64][2],refbid,refask,factor = 1.; uint32_t timestamp;
struct exchange_quote quote; int32_t i,n,dir,num,depth = 100;
struct exchange_info *exchange; struct exchange_request *req,*active[64];
if ( myinfo == 0 )
@ -66,6 +68,10 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s
memset(sortbuf,0,sizeof(*sortbuf) * max);
if ( base != 0 && rel != 0 && basevolume > SMALLVAL )
{
if ( strcmp(base,"KMD") == 0 )
base = "BTCD", factor = 50;
else if ( strcmp(rel,"KMD") == 0 )
rel = "BTCD", factor = 0.02;
for (i=num=0; i<myinfo->numexchanges && num < sizeof(active)/sizeof(*active); i++)
{
if ( (exchange= myinfo->tradingexchanges[i]) != 0 )
@ -117,9 +123,9 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s
for (i=n=0; i<num; i++)
{
if ( dir < 0 && active[i]->numbids > 0 )
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,1,active[i]->bidasks,active[i]->numbids,hblas[i][0]);
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,1,active[i]->bidasks,active[i]->numbids,hblas[i][0],factor);
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,hblas[i][1]);
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,-1,&active[i]->bidasks[1],active[i]->numasks,hblas[i][1],factor);
}
//printf("numexchanges.%d dir.%d %s/%s numX.%d n.%d\n",myinfo->numexchanges,dir,base,rel,num,n);
if ( dir < 0 )

2
iguana/iguana_payments.c

@ -1256,7 +1256,7 @@ cJSON *iguana_listunspents(struct supernet_info *myinfo,struct iguana_info *coin
{
array = iguana_getaddressesbyaccount(myinfo,coin,"*");
flag = 1;
printf("listunspent.(%s)\n",jprint(array,0));
//printf("listunspent.(%s)\n",jprint(array,0));
}
if ( minconf == 0 )
minconf = 1;

2
iguana/main.c

@ -1621,7 +1621,7 @@ void iguana_main(void *arg)
#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("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);

Loading…
Cancel
Save