From bcdbb31c274f11492252a794f32f9883331d7697 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 1 Nov 2017 14:04:27 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_tradebots.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iguana/exchanges/LP_tradebots.c b/iguana/exchanges/LP_tradebots.c index f5111f6ac..1eab5a419 100644 --- a/iguana/exchanges/LP_tradebots.c +++ b/iguana/exchanges/LP_tradebots.c @@ -113,6 +113,8 @@ double LP_pricevol_invert(double *basevolumep,double maxprice,double relvolume) cJSON *LP_tradebot_tradejson(struct LP_tradebot_trade *tp,int32_t dispflag) { double price,basevol; cJSON *item = cJSON_CreateObject(); + if ( tp == 0 ) + return(cJSON_Parse("{}")); jaddnum(item,"requestid",tp->requestid); jaddnum(item,"quoteid",tp->quoteid); if ( tp->basevol > SMALLVAL && tp->relvol > SMALLVAL ) @@ -272,12 +274,15 @@ void LP_tradebot_timeslice(struct LP_tradebot *bot) { bot->relsum += relvol; bot->basesum += v; + bot->completed++; } else { bot->pendrelsum += relvol; bot->pendbasesum += v; + bot->numpending++; } + bot->numtrades++; if ( bot->relsum >= bot->totalrelvolume-SMALLVAL || bot->basesum >= bot->totalbasevolume-SMALLVAL ) bot->dead = (uint32_t)time(NULL); else if ( (bot->pendrelsum+bot->relsum) >= bot->totalrelvolume-SMALLVAL || (bot->basesum+bot->pendbasesum) >= bot->totalbasevolume-SMALLVAL )