Browse Source

Test

etomic
jl777 7 years ago
parent
commit
fc1d374ed1
  1. 10
      iguana/exchanges/LP_RTmetrics.c
  2. 6
      iguana/exchanges/LP_tradebots.c

10
iguana/exchanges/LP_RTmetrics.c

@ -184,28 +184,28 @@ double _LP_RTmetric_calc(struct LP_metricinfo *mp,double bestprice,double maxpri
metric = origmetric;
if ( mp->numutxos == 0 || relvolume == 0. || mp->maxvol == 0. || mp->balance == 0. )
{
printf("skip i.%d as no info\n",mp->ind);
//printf("skip i.%d as no info\n",mp->ind);
return(metric * 100.);
}
if ( relvolume < mp->minvol )
{
metric *= (mp->minvol / relvolume);
printf("relvolume < minvol %.8f\n",(mp->minvol / relvolume));
//printf("relvolume < minvol %.8f\n",(mp->minvol / relvolume));
}
else if ( relvolume > mp->maxvol )
{
metric *= (relvolume / mp->maxvol);
printf("relvolume > minvol %.8f\n",(relvolume / mp->maxvol));
//printf("relvolume > minvol %.8f\n",(relvolume / mp->maxvol));
}
if ( relvolume < mp->balance/LP_MINVOL )
{
metric *= (mp->balance / relvolume);
printf("relvolume < balance %.8f\n",(mp->balance / relvolume));
//printf("relvolume < balance %.8f\n",(mp->balance / relvolume));
}
else if ( relvolume > mp->balance/mp->numutxos )
{
metric *= (relvolume / (mp->balance/mp->numutxos));
printf("relvolume < ave %.8f\n",(relvolume / (mp->balance/mp->numutxos)));
//printf("relvolume < ave %.8f\n",(relvolume / (mp->balance/mp->numutxos)));
}
if ( mp->age > LP_ORDERBOOK_DURATION*0.8 )
metric *= 2;

6
iguana/exchanges/LP_tradebots.c

@ -273,6 +273,7 @@ void LP_tradebot_timeslice(void *ctx,struct LP_tradebot *bot)
printf("try autobuy %s/%s remaining %.8f maxprice %.8f\n",bot->base,bot->rel,remaining,bot->maxprice);
tradeid = rand();
for (i=1; i<=maxiters; i++)
{
if ( (retstr= LP_autobuy(ctx,LP_myipaddr,LP_mypubsock,bot->base,bot->rel,bot->maxprice,remaining/i,0,0,G.gui,0,destpubkey,tradeid)) != 0 )
{
if ( (retjson2= cJSON_Parse(retstr)) != 0 )
@ -284,12 +285,13 @@ void LP_tradebot_timeslice(void *ctx,struct LP_tradebot *bot)
bot->dead = (uint32_t)time(NULL);
else if ( (bot->pendrelsum+bot->relsum) >= 0.99*bot->totalrelvolume-SMALLVAL || (bot->basesum+bot->pendbasesum) >= 0.99*bot->totalbasevolume-SMALLVAL )
bot->pause = (uint32_t)time(NULL);
} else printf("didnt get any trade pending %s %s\n\n",bot->name,retstr);
} else printf("iter.%d/%d %.8f didnt get any trade pending %s %s\n\n",i,maxiters,remaining/i,bot->name,retstr);
free_json(retjson2);
} else printf("iter.%d/%d %s\n",i,maxiters,retstr);
} else printf("iter.%d/%d %.8f %s\n",i,maxiters,remaining/i,retstr);
free(retstr);
}
}
}
free_json(retjson);
}
free(liststr);

Loading…
Cancel
Save