diff --git a/.gitignore b/.gitignore index 147479f20..9a74236cc 100755 --- a/.gitignore +++ b/.gitignore @@ -262,3 +262,7 @@ iguana/DB/SWAPS/3606847984-2574036327 iguana/DB/SWAPS/2384443255-1263480722 iguana/DB/SWAPS/845549832-3630913950 + +iguana/DB/SWAPS/2050938501-203733478 + +iguana/DB/SWAPS/3434672913-3981690962 diff --git a/basilisk/tradebots_liquidity.c b/basilisk/tradebots_liquidity.c index 66fd27944..c0f232942 100755 --- a/basilisk/tradebots_liquidity.c +++ b/basilisk/tradebots_liquidity.c @@ -1142,7 +1142,7 @@ void _default_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_s void tradebot_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob) { - printf("balancing trade\n"); + printf(">>>>>>>>>>>>>>>>>> balancing trade\n"); return; if ( swap->balancingtrade == 0 ) _default_swap_balancingtrade(myinfo,swap,iambob); diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index 69502f02f..a90bbef8a 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -571,7 +571,7 @@ void marketmaker(double minask,double maxbid,char *baseaddr,char *reladdr,double start_DEXrel = dex_balance(rel,reladdr); while ( 1 ) { - if ( time(NULL) > lasttime+300 ) + if ( time(NULL) > lasttime+10 ) { if ( (val= get_theoretical(&avebid,&aveask,&highbid,&lowask,&CMC_average,changes,name,base,rel,&USD_average)) != 0. ) { @@ -634,19 +634,23 @@ void marketmaker(double minask,double maxbid,char *baseaddr,char *reladdr,double if ( (1) ) { if ( mmbid >= lowask || (maxbid > SMALLVAL && mmbid > maxbid) ) //mmbid < highbid || + { + printf("clear mmbid %.8f lowask %.8f maxbid %.8f\n",mmbid,lowask,maxbid); mmbid = 0.; + } if ( mmask <= highbid || (minask > SMALLVAL && mmask < minask) ) // mmask > lowask || mmask = 0.; } 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 ( (aveask - avebid)/aveprice > 4*profitmargin ) - bid = highbid * (1 - 4*profitmargin), ask = lowask * (1 + 4*profitmargin); + if ( (aveask - avebid)/aveprice > profitmargin ) + bid = highbid * (1 - profitmargin), ask = lowask * (1 + profitmargin); else bid = avebid - profitmargin*aveprice, ask = avebid + profitmargin*aveprice; marketmaker_spread("DEX",base,rel,bid,incr,ask,incr,profitmargin*aveprice*0.5); if ( (pendingbids + buyvol) > (pendingasks + sellvol) ) { - bidincr *= (double)(pendingasks + sellvol) / ((pendingbids + buyvol) + (pendingasks + sellvol)); + bidincr *= sqrt((double)(pendingasks + sellvol) / ((pendingbids + buyvol) + (pendingasks + sellvol))); + //printf("bidincr %f buy.(%f + %f) sell.(%f + %f)\n",bidincr,pendingbids,buyvol,pendingasks,sellvol); if ( bidincr < 0.1*incr ) bidincr = 0.1*incr; if ( bidincr > 1. ) @@ -660,9 +664,9 @@ void marketmaker(double minask,double maxbid,char *baseaddr,char *reladdr,double if ( askincr > 1. ) askincr = (int32_t)askincr + 0.777; } - //printf("mmbid %.8f %.6f, mmask %.8f %.6f\n",mmbid,bidincr,mmask,askincr); - //marketmaker_spread(exchange,base,rel,mmbid,bidincr,mmask,askincr,profitmargin*aveprice*0.5); - sleep(6000); + printf("mmbid %.8f %.6f, mmask %.8f %.6f\n",mmbid,bidincr,mmask,askincr); + marketmaker_spread(exchange,base,rel,mmbid,bidincr,mmask,askincr,profitmargin*aveprice*0.5); + sleep(60); } } }