Browse Source

Price 0 to clear auto ref

jl777
jl777 7 years ago
parent
commit
19a5cc6ee7
  1. 1
      iguana/exchanges/LP_include.h
  2. 19
      iguana/exchanges/LP_portfolio.c
  3. 1
      iguana/exchanges/LP_prices.c

1
iguana/exchanges/LP_include.h

@ -556,6 +556,7 @@ uint16_t LP_randpeer(char *destip);
void LP_tradebot_pauseall();
int32_t LP_etomic_pub2addr(char *coinaddr,uint8_t pub64[64]);
void LP_portfolio_reset();
int32_t LP_autoref_clear(char *base,char *rel);
int32_t bitcoin_addr2rmd160(char *symbol,uint8_t taddr,uint8_t *addrtypep,uint8_t rmd160[20],char *coinaddr);
struct LP_pubkey_info *LP_pubkeyadd(bits256 pubkey);
uint32_t LP_atomic_locktime(char *base,char *rel);

19
iguana/exchanges/LP_portfolio.c

@ -455,6 +455,23 @@ double LP_tickered_price(int32_t bidask,char *base,char *rel,double price,cJSON
return(price);
}
int32_t LP_autoref_clear(char *base,char *rel)
{
int32_t i; char *base,*rel;
for (i=0; i<num_LP_autorefs; i++)
{
rel = LP_autorefs[i].rel;
base = LP_autorefs[i].base;
if ( (strcmp(rel,LP_autorefs[i].rel) == 0 && strcmp(base,LP_autorefs[i].base) == 0) ||
(strcmp(base,LP_autorefs[i].rel) == 0 && strcmp(rel,LP_autorefs[i].base) == 0) )
{
memset(&LP_autorefs[i],0,sizeof(LP_autorefs[i]));
return(i);
}
}
return(-1);
}
void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
{
static cJSON *tickerjson; static uint32_t lasttime;
@ -540,6 +557,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
{
rel = LP_autorefs[i].rel;
base = LP_autorefs[i].base;
if ( rel[0] == 0 || base[0] == 0 )
continue;
buymargin = LP_autorefs[i].buymargin;
sellmargin = LP_autorefs[i].sellmargin;
offset = LP_autorefs[i].offset;

1
iguana/exchanges/LP_prices.c

@ -532,6 +532,7 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
relpp->sellmargins[basepp->ind] = 0.;
relpp->offsets[basepp->ind] = 0.;
relpp->factors[basepp->ind] = 0.;
LP_autoref_clear(base,rel);
margin = 0.;
}
else if ( (minprice= basepp->minprices[relpp->ind]) > SMALLVAL && price < minprice )

Loading…
Cancel
Save