Browse Source

Test

etomic
jl777 8 years ago
parent
commit
1d99f9d69e
  1. 6
      iguana/exchanges/LP_tradebots.c

6
iguana/exchanges/LP_tradebots.c

@ -340,7 +340,7 @@ char *LP_tradebot_limitbuy(void *ctx,int32_t pubsock,cJSON *argjson)
char *LP_tradebot_limitsell(void *ctx,int32_t pubsock,cJSON *argjson) char *LP_tradebot_limitsell(void *ctx,int32_t pubsock,cJSON *argjson)
{ {
double relvolume,maxprice,price,basevolume; char *base,*rel; double relvolume,maxprice,price,basevolume,p,v; char *base,*rel;
base = jstr(argjson,"base"); base = jstr(argjson,"base");
rel = jstr(argjson,"rel"); rel = jstr(argjson,"rel");
price = jdouble(argjson,"minprice"); price = jdouble(argjson,"minprice");
@ -348,7 +348,9 @@ char *LP_tradebot_limitsell(void *ctx,int32_t pubsock,cJSON *argjson)
if ( LP_priceinfofind(base) != 0 && LP_priceinfofind(rel) != 0 && price > SMALLVAL && price < SATOSHIDEN && basevolume > 0.0001 && basevolume < SATOSHIDEN ) if ( LP_priceinfofind(base) != 0 && LP_priceinfofind(rel) != 0 && price > SMALLVAL && price < SATOSHIDEN && basevolume > 0.0001 && basevolume < SATOSHIDEN )
{ {
maxprice = 1. / price; maxprice = 1. / price;
relvolume = (maxprice * basevolume); relvolume = (price * basevolume);
p = LP_pricevol_invert(&v,maxprice,relvolume);
printf("minprice %.8f basevolume %.8f -> (%.8f %.8f) -> (%.8f %.8f)\n",price,basevolume,maxprice,relvolume,p,v);
return(LP_tradebot_buy(-1,rel,base,maxprice,relvolume)); return(LP_tradebot_buy(-1,rel,base,maxprice,relvolume));
} }
return(clonestr("{\"error\":\"invalid parameter\"}")); return(clonestr("{\"error\":\"invalid parameter\"}"));

Loading…
Cancel
Save