Browse Source

Test

etomic
jl777 7 years ago
parent
commit
cb2075379c
  1. 6
      iguana/exchanges/LP_portfolio.c
  2. 2
      iguana/exchanges/LP_prices.c

6
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);
}
}
}
}

2
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);

Loading…
Cancel
Save