Browse Source

Test

etomic
jl777 8 years ago
parent
commit
d664b5b563
  1. 12
      iguana/exchanges/mm.c

12
iguana/exchanges/mm.c

@ -42,6 +42,14 @@ char CURRENCIES[][8] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD",
double PAXPRICES[sizeof(CURRENCIES)/sizeof(*CURRENCIES)];
uint32_t PAXACTIVE;
char *DEX_swapstatus()
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"basilisk\",\"method\":\"swapstatus\"}");
return(bitcoind_RPC(0,"basilisk",url,0,"swapstatus",postdata));
}
char *DEX_amlp(char *blocktrail)
{
char url[512],postdata[1024];
@ -567,7 +575,7 @@ int32_t marketmaker_spread(char *exchange,char *base,char *rel,double bid,double
void marketmaker(double minask,double maxbid,char *baseaddr,char *reladdr,double start_BASE,double start_REL,double profitmargin,double maxexposure,double ratioincr,char *exchange,char *name,char *base,char *rel)
{
static uint32_t counter;
cJSON *fiatjson; double bid,ask,start_DEXbase,start_DEXrel,USD_average=0.,DEX_base = 0.,DEX_rel = 0.,balance_base=0.,balance_rel=0.,mmbid,mmask,usdprice=0.,CMC_average=0.,aveprice,incr,pendingbids,pendingasks,buyvol,sellvol,bidincr,askincr,filledprice,avebid=0.,aveask=0.,val,changes[3],highbid=0.,lowask=0.,theoretical = 0.; uint32_t lasttime = 0;
cJSON *fiatjson; char *retstr; double bid,ask,start_DEXbase,start_DEXrel,USD_average=0.,DEX_base = 0.,DEX_rel = 0.,balance_base=0.,balance_rel=0.,mmbid,mmask,usdprice=0.,CMC_average=0.,aveprice,incr,pendingbids,pendingasks,buyvol,sellvol,bidincr,askincr,filledprice,avebid=0.,aveask=0.,val,changes[3],highbid=0.,lowask=0.,theoretical = 0.; uint32_t lasttime = 0;
incr = maxexposure * ratioincr;
buyvol = sellvol = 0.;
start_DEXbase = dex_balance(base,baseaddr);
@ -646,6 +654,8 @@ void marketmaker(double minask,double maxbid,char *baseaddr,char *reladdr,double
}
marketmaker_volumeset(&bidincr,&askincr,incr,buyvol,pendingbids,sellvol,pendingasks,maxexposure);
printf("AVE.(%.8f %.8f) hbla %.8f %.8f bid %.8f ask %.8f theory %.8f buys.(%.6f %.6f) sells.(%.6f %.6f) incr.(%.6f %.6f) balances.(%.8f + %.8f, %.8f + %.8f) test %f\n",avebid,aveask,highbid,lowask,mmbid,mmask,theoretical,buyvol,pendingbids,sellvol,pendingasks,bidincr,askincr,balance_base,DEX_base,balance_rel,DEX_rel,(aveask - avebid)/aveprice);
if ( (retstr= DEX_swapstatus()) != 0 )
printf("%s\n",retstr), free(retstr);
if ( (aveask - avebid)/aveprice > profitmargin )
bid = highbid * (1 - profitmargin), ask = lowask * (1 + profitmargin);
else bid = avebid - profitmargin*aveprice, ask = avebid + profitmargin*aveprice;

Loading…
Cancel
Save