|
@ -293,12 +293,10 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP |
|
|
if ( dir > 0 ) |
|
|
if ( dir > 0 ) |
|
|
newprice = (1. / price) * (1. + margin); |
|
|
newprice = (1. / price) * (1. + margin); |
|
|
else newprice = (price * (1. + margin)); |
|
|
else newprice = (price * (1. + margin)); |
|
|
|
|
|
|
|
|
//newprice = 1. / (price * (1. - margin));
|
|
|
|
|
|
if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) |
|
|
if ( (minprice= basepp->minprices[relpp->ind]) == 0. || price >= minprice ) |
|
|
{ |
|
|
{ |
|
|
LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); |
|
|
LP_mypriceset(&changed,relpp->symbol,basepp->symbol,newprice); |
|
|
printf("autoprice changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,price); |
|
|
//printf("autoprice changed.%d %s/%s <- %.8f\n",changed,basepp->symbol,relpp->symbol,price);
|
|
|
if ( changed != 0 || time(NULL) > lasttime+LP_ORDERBOOK_DURATION*.777) |
|
|
if ( changed != 0 || time(NULL) > lasttime+LP_ORDERBOOK_DURATION*.777) |
|
|
{ |
|
|
{ |
|
|
lasttime = (uint32_t)time(NULL); |
|
|
lasttime = (uint32_t)time(NULL); |
|
@ -469,8 +467,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
relpp = LP_priceinfofind(LP_autorefs[i].rel); |
|
|
relpp = LP_priceinfofind(LP_autorefs[i].rel); |
|
|
if ( basepp != 0 && relpp != 0 ) |
|
|
if ( basepp != 0 && relpp != 0 ) |
|
|
{ |
|
|
{ |
|
|
printf("check ref-autoprice %s/%s\n",LP_autorefs[i].refbase,LP_autorefs[i].refrel); |
|
|
//printf("check ref-autoprice %s/%s\n",LP_autorefs[i].refbase,LP_autorefs[i].refrel);
|
|
|
LP_autopriceset(ctx,1,basepp,relpp,0,LP_autorefs[i].refbase,LP_autorefs[i].refrel); |
|
|
LP_autopriceset(ctx,1,basepp,relpp,0.,LP_autorefs[i].refbase,LP_autorefs[i].refrel); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -600,6 +598,7 @@ void prices_loop(void *ctx) |
|
|
LP_tradebots_timeslice(ctx); |
|
|
LP_tradebots_timeslice(ctx); |
|
|
if ( (btcpp= LP_priceinfofind("BTC")) == 0 ) |
|
|
if ( (btcpp= LP_priceinfofind("BTC")) == 0 ) |
|
|
{ |
|
|
{ |
|
|
|
|
|
printf("prices_loop BTC not in LP_priceinfofind\n"); |
|
|
sleep(60); |
|
|
sleep(60); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|