Browse Source

Test

etomic
jl777 8 years ago
parent
commit
80cf618f4d
  1. 7
      iguana/exchanges/LP_nativeDEX.c
  2. 3
      iguana/exchanges/LP_rpc.c
  3. 9
      iguana/exchanges/mm.c

7
iguana/exchanges/LP_nativeDEX.c

@ -654,6 +654,7 @@ uint64_t LP_privkey_init(struct LP_peerinfo *mypeer,int32_t mypubsock,char *symb
char tmpstr[128];
bitcoin_priv2wif(tmpstr,privkey,coin->wiftype);
printf("%s coinaddr.%s %d wif.(%s)\n",symbol,coinaddr,coin->pubtype,tmpstr);
LP_importaddress(coin->symbol,tmpstr);
}
bitcoin_addr2rmd160(&tmptype,rmd160,coinaddr);
LP_privkeyadd(privkey,rmd160);
@ -705,7 +706,7 @@ uint64_t LP_privkey_init(struct LP_peerinfo *mypeer,int32_t mypubsock,char *symb
return(total);
}
void LPinit(uint16_t myport,uint16_t mypull,uint16_t mypub,double profitmargin)
void LPinit(uint16_t myport,uint16_t mypull,uint16_t mypub,double profitmargin,char *passphrase)
{
char *myipaddr=0,*retstr; long filesize,n; int32_t len,timeout,maxsize,recvsize,nonz,i,lastn,pullsock=-1,pubsock=-1; struct LP_peerinfo *peer,*tmp,*mypeer=0; char pushaddr[128],subaddr[128]; void *ptr; cJSON *argjson;
portable_mutex_init(&LP_peermutex);
@ -772,8 +773,8 @@ void LPinit(uint16_t myport,uint16_t mypull,uint16_t mypub,double profitmargin)
exit(-1);
}
LP_coinfind("BTC"); LP_coinfind("LTC"); LP_coinfind("KMD"); LP_coinfind("USD"); LP_coinfind("REVS"); LP_coinfind("JUMBLR");
LP_privkey_init(mypeer,pubsock,"BTC","test","");
LP_privkey_init(mypeer,pubsock,"KMD","test","");
LP_privkey_init(mypeer,pubsock,"BTC",passphrase,"");
LP_privkey_init(mypeer,pubsock,"KMD",passphrase,"");
printf("utxos.(%s)\n",LP_utxos(mypeer,"",10000));
while ( 1 )
{

3
iguana/exchanges/LP_rpc.c

@ -133,7 +133,10 @@ int32_t LP_importaddress(char *symbol,char *address)
return(0); // success
sprintf(buf,"[\"%s\", \"%s\", false]",address,address);
if ( (retstr= bitcoind_passthru(symbol,coin->serverport,coin->userpass,"importaddress",buf)) != 0 )
{
printf("importaddress.(%s %s) -> (%s)\n",symbol,address,retstr);
free(retstr);
} else printf("importaddress.(%s %s)\n",symbol,address);
return(1);
}

9
iguana/exchanges/mm.c

@ -798,8 +798,8 @@ void marketmaker(double minask,double maxbid,char *baseaddr,char *reladdr,double
void LP_main(void *ptr)
{
double profitmargin = *(double *)ptr;
LPinit(7779,7780,7781,profitmargin);
double profitmargin = 0.01; char *passphrase = ptr;
LPinit(7779,7780,7781,profitmargin,passphrase);
}
int main(int argc, const char * argv[])
@ -812,7 +812,9 @@ int main(int argc, const char * argv[])
minask = jdouble(retjson,"minask");
maxbid = jdouble(retjson,"maxbid");
profitmargin = jdouble(retjson,"profitmargin");
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_main,(void *)&profitmargin) != 0 )
if ( (passphrase= jstr(retjson,"passphrase")) == 0 )
passphrase = "test";
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_main,(void *)passphrase) != 0 )
{
printf("error launching LP_main %f\n",profitmargin);
exit(-1);
@ -821,7 +823,6 @@ int main(int argc, const char * argv[])
incrratio = jdouble(retjson,"lotratio");
start_base = jdouble(retjson,"start_base");
start_rel = jdouble(retjson,"start_rel");
passphrase = jstr(retjson,"passphrase");
apikey = jstr(retjson,"apikey");
apisecret = jstr(retjson,"apisecret");
base = jstr(retjson,"base");

Loading…
Cancel
Save