From 51e042bca9373f2d3fd3b34362e55b2bde9d2ce8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 17 Oct 2017 21:26:05 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 5 ++--- iguana/exchanges/LP_portfolio.c | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 5c159e440..d50f4893a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -18,13 +18,12 @@ // LP_nativeDEX.c // marketmaker // -// autoprice based on formula // sign critical api calls (pubkey reg, listunspent, orders?) -// stats using KV opreturn +// stats using local files // deal with offline pubkeys, reputations, etc. // dPoW security -> 2: KMD notarized, 3: BTC notarized // add interest to KMD withdraw -// verify portfolio, pricearray, withdraw +// verify portfolio, pricearray // dICO allocation // alice only coins GAME UNO BTM ANC: GAME BTCD PPC RDD XZC POT EAC FTC BASH SPR WDC UNO XPM XCN BELA CHC DIME MEC NAUT MED AUR MAX DGC RIC EB3 DOT BTM GEO ANC CANN ICASH WBB SRC PTC ADZ TIPS EQT START EFL FST FJC NYC GCN diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index bf7d37b33..43e3ab4ae 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -290,7 +290,7 @@ void LP_autopriceset(void *ctx,int32_t dir,struct LP_priceinfo *basepp,struct LP //printf("min %.8f %s/%s %.8f dir.%d margin %.8f (%.8f %.8f)\n",basepp->minprices[relpp->ind],relpp->symbol,basepp->symbol,price,dir,margin,1. / (price * (1. - margin)),(price * (1. + margin))); if ( dir > 0 ) 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 ) @@ -380,8 +380,8 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf //printf("have trex: iter.%d trexflag.%d %s %.8f %.8f\n",iter,trexflag,symbol,coinpp->bid[1],coinpp->ask[1]); continue; } - LP_autopriceset(ctx,-1,coinpp,refpp,price,0,0); - LP_autopriceset(ctx,1,refpp,coinpp,price,0,0); + LP_autopriceset(ctx,1,coinpp,refpp,price,0,0); + LP_autopriceset(ctx,-1,refpp,coinpp,price,0,0); } } } @@ -440,8 +440,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) { //printf("(%s %.8f %.8f) ",CURRENCIES[i],jdouble(retjson,"price"),jdouble(retjson,"invprice")); price = jdouble(retjson,"price"); - LP_autopriceset(ctx,-1,fiatpp,kmdpp,price,0,0); - LP_autopriceset(ctx,1,kmdpp,fiatpp,price,0,0); + LP_autopriceset(ctx,1,fiatpp,kmdpp,price,0,0); + LP_autopriceset(ctx,-1,kmdpp,fiatpp,price,0,0); free_json(retjson); } } @@ -464,8 +464,8 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) if ( bidsatoshis != 0 && asksatoshis != 0 ) price = 0.5 * dstr(bidsatoshis + asksatoshis) * nxtkmd; } - LP_autopriceset(ctx,-1,nxtpp,kmdpp,price,0,0); - LP_autopriceset(ctx,1,kmdpp,nxtpp,price,0,0); + LP_autopriceset(ctx,1,nxtpp,kmdpp,price,0,0); + LP_autopriceset(ctx,-1,kmdpp,nxtpp,price,0,0); //printf("%s %s -> (%s) nxtkmd %.8f %.8f %.8f\n",assetids[i][1],assetids[i][0],jprint(retjson,0),nxtkmd,0.5*dstr(bidsatoshis + asksatoshis),price); free_json(retjson); }