From cb2075379c8cb15a0ed1b540d09c6cb64c0ed675 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 30 Oct 2017 14:07:11 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_portfolio.c | 6 +++++- iguana/exchanges/LP_prices.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 457a53ef1..4d4ef3485 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -266,6 +266,7 @@ int32_t LP_autoprice(char *base,char *rel,cJSON *argjson) void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP_priceinfo *relpp,double price,char *refbase,char *refrel) { + static uint32_t lasttime; double margin,minprice,newprice,oppomargin,factor,offset; double bid,ask; int32_t changed; margin = basepp->margins[relpp->ind]; oppomargin = relpp->margins[basepp->ind]; @@ -298,8 +299,11 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP { LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); //printf("changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,price); - if ( changed != 0 ) + if ( changed != 0 || time(NULL) > lasttime+LP_ORDERBOOK_DURATION*.777) + { + lasttime = (uint32_t)time(NULL); LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,relpp->symbol,basepp->symbol,newprice); + } } } } diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index 2e9ab63f1..6228e6e9a 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -487,7 +487,7 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price) if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { - if ( fabs(basepp->myprices[relpp->ind] - price) > SMALLVAL ) + if ( fabs(basepp->myprices[relpp->ind] - price)/price > 0.001 ) *changedp = 1; basepp->myprices[relpp->ind] = price; // ask //printf("LP_mypriceset base.%s rel.%s <- price %.8f\n",base,rel,price);