Browse Source

Test

etomic
jl777 8 years ago
parent
commit
76ce1d0944
  1. 2
      iguana/exchanges/LP_commands.c
  2. 2
      iguana/exchanges/LP_network.c
  3. 7
      iguana/exchanges/mm.c

2
iguana/exchanges/LP_commands.c

@ -393,7 +393,7 @@ int32_t LP_priceping(int32_t pubsock,struct LP_utxoinfo *utxo,char *rel,double p
int32_t LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen,double profitmargin) int32_t LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen,double profitmargin)
{ {
char *method,*base,*rel,*retstr,pairstr[512]; cJSON *retjson; double price; bits256 privkey,txid; struct LP_utxoinfo *utxo; int32_t retval = -1,DEXselector = 0; uint64_t destvalue; struct basilisk_request R; struct LP_quoteinfo Q; char *method,*base,*rel,*retstr,pairstr[512]; cJSON *retjson; double price; bits256 privkey,txid; struct LP_utxoinfo *utxo; int32_t retval = -1,DEXselector = 0; uint64_t destvalue; struct basilisk_request R; struct LP_quoteinfo Q;
if ( (method= jstr(argjson,"method")) != 0 ) if ( IAMCLIENT == 0 && (method= jstr(argjson,"method")) != 0 )
{ {
txid = jbits256(argjson,"txid"); txid = jbits256(argjson,"txid");
if ( (utxo= LP_utxofind(txid,jint(argjson,"vout"))) != 0 && strcmp(utxo->ipaddr,mypeer->ipaddr) == 0 && utxo->port == mypeer->port && (base= jstr(argjson,"base")) != 0 && (rel= jstr(argjson,"rel")) != 0 && strcmp(base,utxo->coin) == 0 ) if ( (utxo= LP_utxofind(txid,jint(argjson,"vout"))) != 0 && strcmp(utxo->ipaddr,mypeer->ipaddr) == 0 && utxo->port == mypeer->port && (base= jstr(argjson,"base")) != 0 && (rel= jstr(argjson,"rel")) != 0 && strcmp(base,utxo->coin) == 0 )

2
iguana/exchanges/LP_network.c

@ -29,7 +29,7 @@ int32_t LP_send(int32_t sock,char *msg,int32_t freeflag)
int32_t sentbytes,len,i; struct nn_pollfd pfd; int32_t sentbytes,len,i; struct nn_pollfd pfd;
if ( sock < 0 ) if ( sock < 0 )
{ {
printf("LP_send to illegal socket\n"); printf("LP_send.(%s) to illegal socket\n",msg);
if ( freeflag != 0 ) if ( freeflag != 0 )
free(msg); free(msg);
return(-1); return(-1);

7
iguana/exchanges/mm.c

@ -836,9 +836,9 @@ int main(int argc, const char * argv[])
free(retstr); free(retstr);
} }
incr = 100.; incr = 100.;
while ( 1 ) while ( IAMCLIENT != 0 )
{ {
theoretical = marketmaker_updateprice("komodo","KMD","BTC",theoretical,&incr); theoretical = marketmaker_updateprice("komodo","REVS","KMD",theoretical,&incr);
sleep(3); sleep(3);
LP_privkey_updates(0,-1,passphrase,1); LP_privkey_updates(0,-1,passphrase,1);
if ( jint(retjson,"client") != 0 ) if ( jint(retjson,"client") != 0 )
@ -846,12 +846,13 @@ int main(int argc, const char * argv[])
struct LP_utxoinfo *utxo,*utmp; struct LP_utxoinfo *utxo,*utmp;
HASH_ITER(hh,LP_utxoinfos,utxo,utmp) HASH_ITER(hh,LP_utxoinfos,utxo,utmp)
{ {
if ( (matchjson= LP_autotrade(utxo,"KMD",0.)) != 0 ) if ( strcmp(utxo->coin,"REVS") == 0 && (matchjson= LP_autotrade(utxo,"KMD",0.)) != 0 )
printf("bestprice (%s)\n",jprint(matchjson,1)); printf("bestprice (%s)\n",jprint(matchjson,1));
} }
} }
sleep(1000); sleep(1000);
} }
getchar();
profitmargin = jdouble(retjson,"profitmargin"); profitmargin = jdouble(retjson,"profitmargin");
minask = jdouble(retjson,"minask"); minask = jdouble(retjson,"minask");
maxbid = jdouble(retjson,"maxbid"); maxbid = jdouble(retjson,"maxbid");

Loading…
Cancel
Save