From 0547baa1f2398291140ace4b89feb4158f465fe5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 14 Aug 2016 10:12:05 -0300 Subject: [PATCH] test --- iguana/iguana777.h | 1 + iguana/iguana_exchanges.c | 6 +- iguana/main.c | 26 ++++---- iguana/peggy.c | 118 ++++++++++++++++++++-------------- iguana/peggy.h | 8 ++- iguana/peggy_price.c | 26 ++++++-- iguana/peggy_update.c | 17 ++--- iguana/tests/PAX | 1 + includes/iguana_apideclares.h | 1 + 9 files changed, 121 insertions(+), 83 deletions(-) create mode 100755 iguana/tests/PAX diff --git a/iguana/iguana777.h b/iguana/iguana777.h index fcf904ead..9e844484c 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -74,6 +74,7 @@ struct supernet_info struct basilisk_relay relays[BASILISK_MAXRELAYS]; struct basilisk_spend *spends; int32_t numspends; int32_t numrelays,RELAYID; + struct peggy_info *PEGS; // compatibility bits256 pangea_category,instantdex_category; uint8_t logs[256],exps[510]; diff --git a/iguana/iguana_exchanges.c b/iguana/iguana_exchanges.c index 67ce84509..77a897b80 100755 --- a/iguana/iguana_exchanges.c +++ b/iguana/iguana_exchanges.c @@ -720,8 +720,8 @@ void exchanges777_loop(void *ptr) myinfo = SuperNET_MYINFO(0); if ( strcmp(exchange->name,"PAX") == 0 ) { - PEGS = calloc(1,sizeof(*PEGS)); - PAX_init(PEGS); + PEGS = myinfo->PEGS; //calloc(1,sizeof(*PEGS)); + //PAX_init(PEGS); exchange->privatedata = PEGS; peggyflag = 1; _crypto_update(PEGS,PEGS->cryptovols,&PEGS->data,1,peggyflag); @@ -934,7 +934,7 @@ char *exchanges777_Qprices(struct exchange_info *exchange,char *base,char *rel,i else { req->func = 'M'; - printf("Monitor.%s (%s %s) invert.%d\n",exchange->name,base,rel,req->invert); + //printf("Monitor.%s (%s %s) invert.%d\n",exchange->name,base,rel,req->invert); queue_enqueue("pricesQ",&exchange->pricesQ,&req->DL,0); return(clonestr("{\"result\":\"start monitoring\"}")); } diff --git a/iguana/main.c b/iguana/main.c index faffb51cb..97ac43f1e 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1576,19 +1576,19 @@ void iguana_main(void *arg) iguana_urlinit(myinfo,ismainnet,usessl); //category_init(myinfo); #if LIQUIDITY_PROVIDER - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("bitcoin",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("poloniex",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("bittrex",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("btc38",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("huobi",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("instaforex",0); - //myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("bitfinex",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("coinbase",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("lakebtc",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("quadriga",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("okcoin",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("btce",0); - myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create("bitstamp",0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0); + //myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("instaforex"),0); + //myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitfinex"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("lakebtc"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("quadriga"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("okcoin"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btce"),0); + myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitstamp"),0); #endif //argjson = arg != 0 ? cJSON_Parse(arg) : cJSON_Parse("{}"); //iguana_coinadd("BTC",argjson); dont do this here, coin args not set diff --git a/iguana/peggy.c b/iguana/peggy.c index 2d5073a03..c56c0a98d 100755 --- a/iguana/peggy.c +++ b/iguana/peggy.c @@ -280,7 +280,7 @@ struct peggy *peggy_createpair(struct peggy_info *PEGS,int64_t quorum,int64_t de return(PEG); } -struct peggy_info *peggy_init(char *path,int32_t maxdays,char *maincurrency,uint64_t maincurrencyunitsize,uint64_t quorum,uint64_t decisionthreshold,struct price_resolution spread,uint32_t dailyrate,int32_t interesttenths,int32_t posboost,int32_t negpenalty,int32_t feediv,int32_t feemult,uint32_t firsttimestamp,uint32_t BTCD_price0) +struct peggy_info *peggy_init(int32_t maxdays,char *maincurrency,uint64_t maincurrencyunitsize,uint64_t quorum,uint64_t decisionthreshold,struct price_resolution spread,uint32_t dailyrate,int32_t interesttenths,int32_t posboost,int32_t negpenalty,int32_t feediv,int32_t feemult,uint32_t firsttimestamp,uint32_t BTCD_price0) { //struct peggy_limits limits = { { PERCENTAGE(10), PERCENTAGE(25), PERCENTAGE(33), PERCENTAGE(50) }, SATOSHIDEN * 10000, SATOSHIDEN * 1000, { 0, 30, 90, 180 }, 4 }; struct peggy_lock default_lockparms = { 7, 365, 7, 0, 180, 0, -1 }; @@ -288,7 +288,7 @@ struct peggy_info *peggy_init(char *path,int32_t maxdays,char *maincurrency,uint //if ( default_limits != 0 ) // limits = *default_limits; spread.Pval = PERCENTAGE(1); - OS_ensure_directory(path); + //OS_ensure_directory(path); strcpy(PEGS->maincurrency,maincurrency); PEGS->mainbits = stringbits(maincurrency), PEGS->mainunitsize = maincurrencyunitsize, PEGS->quorum = quorum, PEGS->decisionthreshold = decisionthreshold; PEGS->default_lockparms = default_lockparms, PEGS->default_lockparms.maxlockdays = maxdays; @@ -324,48 +324,11 @@ long hdecode_varint(uint64_t *valp,uint8_t *ptr,long offset,long mappedsize) return(offset); } -struct peggy_info *peggy_genesis(int32_t lookbacks[OPRETURNS_CONTEXTS],struct peggy_info *PEGS,char *path,uint32_t firsttimestamp,char *opreturnstr) +void peggy_priceinits(struct peggy_info *PEGS,uint32_t firsttimestamp,uint32_t *allprices) { - //struct peggy_limits limits = { { PERCENTAGE(10), PERCENTAGE(25), PERCENTAGE(33), PERCENTAGE(50) }, SATOSHIDEN * 10000, SATOSHIDEN * 1000, { 0, 30, 90, 180 }, 4 }; - char name[64],base[64],rel[64]; uint8_t opret[1024]; struct peggy_tx Ptx; struct peggy *PEG; - struct price_resolution mindenom,spread,price; uint64_t len; long offset; uint64_t maxsupply=0,maxnetbalance=0; - int32_t i,c,baseid,relid,peggymils=0,signedcount,datalen,n=0,maxmargin=0,numprices,err=-1; uint32_t pval = 0; - numprices = 1; - datalen = (int32_t)strlen(opreturnstr) / 2; - decode_hex(opret,datalen,opreturnstr); - printf("peggy_genesis(%s)\n",opreturnstr); - if ( opret[0] == OP_RETURN_OPCODE ) - { - offset = hdecode_varint(&len,opret,1,sizeof(opret)); - if ( opret[offset] == 'P' && opret[offset+1] == 'A' && opret[offset+2] == 'X' ) - { - printf("deser\n"); - if ( (n= serdes777_deserialize(&signedcount,&Ptx,firsttimestamp,opret+offset+3,(int32_t)len-3)) > 0 ) - { - err = 0; - for (i=0; iaccts = accts777_init(path,0); - PEGS->genesis = opreturnstr, opreturnstr = 0; - } - } else printf("i.%d vs %d\n",i,Ptx.details.price.num); - } else printf("deser got n.%d\n",n); - } else printf("illegal opret.(%c%c%c)\n",opret[offset],opret[offset+1],opret[offset+2]); - } else printf("opret[0] %d\n",opret[0]); - if ( err < 0 || PEGS == 0 ) - return(0); + char name[64],base[64],rel[64]; struct peggy *PEG; + struct price_resolution mindenom,spread,price; uint64_t maxsupply=0,maxnetbalance=0; + int32_t i,c,baseid,relid,peggymils=0,n=0,maxmargin=0; uint32_t pval = 0; mindenom.Pval = PRICE_RESOLUTION; spread.Pval = PERCENTAGE(1); for (i=1; icontracts[baseid]->peggymils * 10000) / PEGS->contracts[relid]->peggymils; if ( strcmp(PEGS->contracts[baseid]->name.base,base) == 0 && strcmp(PEGS->contracts[relid]->name.base,rel) == 0 ) - price.Pval = (PRICE_RESOLUTION * Ptx.details.price.feed[baseid]) / Ptx.details.price.feed[relid]; + price.Pval = (PRICE_RESOLUTION * allprices[baseid]) / allprices[relid]; else printf("mismatched %p base.(%s) baseid.%d (%s) or %p rel.(%s) relid.%d (%s)\n",PEGS->contracts[baseid],PEGS->contracts[baseid]->name.base,baseid,base,PEGS->contracts[relid],PEGS->contracts[relid]->name.base,relid,rel); pval = (uint32_t)price.Pval; } else printf("peggy_genesis RAN out of space\n"); - if ( (PEG= peggy_createpair(PEGS,0,0,name,base,rel,maxsupply,maxnetbalance,0,SATOSHIDEN*10,PEGGY_RATE_777,firsttimestamp,&price,numprices,spread,maxmargin,mindenom,i,i 0 ) + { + err = 0; + for (i=0; iaccts = accts777_init(path,0); + PEGS->genesis = opreturnstr, opreturnstr = 0; + } + } else printf("i.%d vs %d\n",i,Ptx.details.price.num); + } else printf("deser got n.%d\n",n); + } else printf("illegal opret.(%c%c%c)\n",opret[offset],opret[offset+1],opret[offset+2]); + } else printf("opret[0] %d\n",opret[0]); + if ( err < 0 || PEGS == 0 ) + return(0); + peggy_priceinits(PEGS,firsttimestamp,Ptx.details.price.feed); printf("genesis prices t%u vs %u\n",Ptx.timestamp,firsttimestamp); return(PEGS); } @@ -662,7 +669,7 @@ struct peggy_info *peggy_lchain(struct txinds777_info *opreturns,char *path) int32_t peggy_init_contexts(struct txinds777_info *opreturns,uint32_t RTblocknum,uint32_t RTblocktimestamp,char *path,void *globals[OPRETURNS_CONTEXTS],int32_t lookbacks[OPRETURNS_CONTEXTS],int32_t maxcontexts) { - double startmilli; char buf[512]; struct price_resolution spread; struct peggy_info *PEGS=0,*PEGS2=0; +/* double startmilli; char buf[512]; struct price_resolution spread; struct peggy_info *PEGS=0,*PEGS2=0; if ( maxcontexts != 2 ) { printf("peggy needs 2 contexts\n"); @@ -684,6 +691,17 @@ int32_t peggy_init_contexts(struct txinds777_info *opreturns,uint32_t RTblocknum globals[1] = PEGS2 = peggy_init(buf,PEGGY_MAXLOCKDAYS,"BTCD",SATOSHIDEN/100,1,1,spread,PEGGY_RATE_777,40,10,2,5,2,PEGS->genesistime,PEGS->BTCD_price0); startmilli = OS_milliseconds(); peggy_clone(buf,PEGS2,PEGS); - printf("cloned %d in %.3f millis per opreturn\n",PEGS->numopreturns,(OS_milliseconds() - startmilli)/PEGS->numopreturns); sleep(3); + printf("cloned %d in %.3f millis per opreturn\n",PEGS->numopreturns,(OS_milliseconds() - startmilli)/PEGS->numopreturns); sleep(3);*/ return(2); } + +void peggy_indsinit() +{ + if ( sizeof(Peggy_inds)/sizeof(*Peggy_inds) != PEGGY_NUMCOEFFS ) + { + peggy_geninds(); + printf("need to update Peggy_inds with above\n"); + exit(-1); + } + peggy_dailyrates(); +} diff --git a/iguana/peggy.h b/iguana/peggy.h index c53b219f7..96b9d0823 100755 --- a/iguana/peggy.h +++ b/iguana/peggy.h @@ -235,7 +235,7 @@ struct peggy_info int32_t default_dailyrate,interesttenths,posboost,negpenalty,feediv,feemult; int32_t numpegs,numpairedpegs,numpricedpegs,numopreturns,numvoters; struct accts777_info *accts; - struct PAX_data data,tmp; double cryptovols[2][8][2],btcusd,btcdbtc,cnyusd; + struct PAX_data data,tmp; double cryptovols[2][9][2],btcusd,btcdbtc,cnyusd; char path[512],*genesis; uint32_t genesistime,BTCD_price0,lastupdate; struct PAX_spline splines[128]; struct peggy_vote votes[PEGGY_MAXPRICEDPEGS][PEGGY_MAXVOTERS]; @@ -307,13 +307,13 @@ extern int32_t MINDENOMS[],Peggy_inds[],dailyrates[]; struct price_resolution peggy_scaleprice(struct price_resolution price,int64_t peggymils); char *peggy_tx(char *jsonstr); -void _crypto_update(struct peggy_info *PEGS,double cryptovols[2][8][2],struct PAX_data *dp,int32_t selector,int32_t peggyflag); +void _crypto_update(struct peggy_info *PEGS,double cryptovols[2][9][2],struct PAX_data *dp,int32_t selector,int32_t peggyflag); int32_t PAX_idle(struct peggy_info *PEGS,int32_t peggyflag,int32_t idlegap); int32_t PAX_genspline(struct PAX_spline *spline,int32_t splineid,char *name,uint32_t *utc32,double *splinevals,int32_t maxsplines,double *refvals); int32_t PAX_contractnum(char *base,char *rel); int32_t PAX_basenum(char *base); int32_t PAX_ispair(char *base,char *rel,char *contract); -void PAX_init(struct peggy_info *PEGS); +struct peggy_info *PAX_init(); uint32_t peggy_mils(int32_t i); void calc_smooth_code(int32_t smoothwidth,int32_t _maxprimes); struct peggy *peggy_find(struct peggy_entry *entry,struct peggy_info *PEGS,char *name,int32_t polarity); @@ -368,10 +368,12 @@ int32_t peggy_init_contexts(struct txinds777_info *opreturns,uint32_t blocknum,u uint32_t peggy_clone(char *path,void *dest,void *src); void *peggy_replay(char *path,struct txinds777_info *opreturns,void *_PEGS,uint32_t blocknum,char *opreturnstr,uint8_t *data,int32_t datalen); uint32_t peggy_currentblock(void *globals); +struct peggy_info *peggy_init(int32_t maxdays,char *maincurrency,uint64_t maincurrencyunitsize,uint64_t quorum,uint64_t decisionthreshold,struct price_resolution spread,uint32_t dailyrate,int32_t interesttenths,int32_t posboost,int32_t negpenalty,int32_t feediv,int32_t feemult,uint32_t firsttimestamp,uint32_t BTCD_price0); struct peggy_unit *peggy_match(struct accts777_info *accts,int32_t peg,uint64_t nxt64bits,bits256 lockhash,uint16_t lockdays); int32_t peggy_addunit(struct accts777_info *accts,struct peggy_unit *U,bits256 lockhash); FILE *myfopen(char *fname,char *mode); int32_t myfclose(FILE *fp); +void peggy_priceinits(struct peggy_info *PEGS,uint32_t firsttimestamp,uint32_t *allprices); #endif diff --git a/iguana/peggy_price.c b/iguana/peggy_price.c index cf8997b59..d4dbe2846 100755 --- a/iguana/peggy_price.c +++ b/iguana/peggy_price.c @@ -76,7 +76,7 @@ short Currency_contractothers[NUM_CURRENCIES+1][NUM_CURRENCIES] = // buggy! int32_t MINDENOMS[] = { 1000, 1000, 100000, 1000, 1000, 1000, 1000, 1000, // major currencies 10000, 100000, 10000, 1000, 100000, 10000, 1000, 10000, 1000, 10000, 10000, 10000, 10000, 100000, 1000, 1000000, 1000, 10000, 1000, 1000, 10000, 1000, 10000000, 10000, // end of currencies 1, 100, 1, 1, // metals, gold must be first - 1, 10, 100000, 100, 100, 10000000, 10000, 1000, 1000, 1000, 100000, 100000, 1000000 // cryptos + 100, 1, 10000, 100, 100, 1000, 100000, 1000, 1000, 1000 }; int32_t PAX_mindenomination(int32_t base) @@ -195,14 +195,14 @@ uint32_t peggy_mils(int32_t i) minmils = 10; else if ( strcmp(peggy_bases[i],"BUND") == 0 || strcmp(peggy_bases[i],"UKOIL") == 0 || strcmp(peggy_bases[i],"USOIL") == 0 ) minmils = 100; - else if ( strncmp(peggy_bases[i],"LTC",3) == 0 || strcmp(peggy_bases[i],"SuperNET") == 0 || strncmp(peggy_bases[i],"XAG",3) == 0 || strncmp(peggy_bases[i],"ETH",3) == 0 || strncmp(peggy_bases[i],"XCP",3) == 0 ) + else if ( strncmp(peggy_bases[i],"ETC",3) == 0 || strcmp(peggy_bases[i],"SuperNET") == 0 || strncmp(peggy_bases[i],"XAG",3) == 0 || strncmp(peggy_bases[i],"ETH",3) == 0 || strncmp(peggy_bases[i],"XCP",3) == 0 ) minmils = 1000; else if ( strncmp(peggy_bases[i],"XMR",3) == 0 ) minmils = 10000; else if ( strncmp(peggy_bases[i],"NXT",3) == 0 || strncmp(peggy_bases[i],"BTS",3) == 0 ) minmils = 1000000; - else if ( strncmp(peggy_bases[i],"DOGE",3) == 0 ) - minmils = 100000000; + else if ( strncmp(peggy_bases[i],"STEEM",5) == 0 ) + minmils = 1000; else minmils = 10000; } return(minmils); @@ -825,13 +825,27 @@ double PAX_getprice(char *retbuf,char *base,char *rel,char *contract,struct pegg #include "../includes/iguana_apidefs.h" #include "../includes/iguana_apideclares.h" -void PAX_init(struct peggy_info *PEGS) +struct peggy_info *PAX_init() { - double commission = 0.; + void peggy_indsinit(); + struct peggy_info *PEGS; struct price_resolution spread; double commission = 0.; init_Currencymasks(); + //calc_smooth_code(127,7); + peggy_indsinit(); tradebot_monitorall(0,0,0,0,"fxcm",commission); tradebot_monitorall(0,0,0,0,"truefx",commission); tradebot_monitorall(0,0,0,0,"instaforex",commission); + spread.Pval = PERCENTAGE(1); + PEGS = peggy_init(PEGGY_MAXLOCKDAYS,"BTCD",SATOSHIDEN/100,100,10,spread,PEGGY_RATE_777,40,10,2,5,2,0,0); + exchange_create("PAX",0); + //peggy_priceinits(PEGS,(uint32_t)time(NULL),allprices); + return(PEGS); +} + +ZERO_ARGS(pax,start) +{ + myinfo->PEGS = PAX_init(); + return(clonestr("{\"result\":\"success\"}")); } #include "../includes/iguana_apiundefs.h" diff --git a/iguana/peggy_update.c b/iguana/peggy_update.c index fa3caff34..c2545236f 100755 --- a/iguana/peggy_update.c +++ b/iguana/peggy_update.c @@ -47,7 +47,7 @@ static char *Yahoo_metals[] = { YAHOO_METALS }; char CURRENCIES[][8] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", // end of currencies "XAU", "XAG", "XPT", "XPD", // metals, gold must be first - "BTCD", "BTC", "NXT", "LTC", "ETH", "DOGE", "BTS", "MAID", "XCP", "XMR" // cryptos + "BTCD", "BTC", "NXT", "ETC", "ETH", "STEEM", "BTS", "MAID", "XCP", "XMR" // cryptos }; char CONTRACTS[][16] = { "NZDUSD", "NZDCHF", "NZDCAD", "NZDJPY", "GBPNZD", "EURNZD", "AUDNZD", "CADJPY", "CADCHF", "USDCAD", "EURCAD", "GBPCAD", "AUDCAD", "USDCHF", "CHFJPY", "EURCHF", "GBPCHF", "AUDCHF", "EURUSD", "EURAUD", "EURJPY", "EURGBP", "GBPUSD", "GBPJPY", "GBPAUD", "USDJPY", "AUDJPY", "AUDUSD", "USDCNY", "USDHKD", "USDMXN", "USDZAR", "USDTRY", "EURTRY", "TRYJPY", "USDSGD", "EURNOK", "USDNOK","USDSEK","USDDKK","EURSEK","EURDKK","NOKJPY","SEKJPY","USDPLN","EURPLN","USDILS", // no more currencies @@ -518,12 +518,12 @@ double blend_price(double *volp,double wtA,cJSON *jsonA,double wtB,cJSON *jsonB) return(price); } -void _crypto_update(struct peggy_info *PEGS,double cryptovols[2][8][2],struct PAX_data *dp,int32_t selector,int32_t peggyflag) +void _crypto_update(struct peggy_info *PEGS,double cryptovols[2][9][2],struct PAX_data *dp,int32_t selector,int32_t peggyflag) { char *cryptonatorA = "https://www.cryptonator.com/api/full/%s-%s"; //unity-btc char *cryptocoinchartsB = "http://api.cryptocoincharts.info/tradingPair/%s_%s"; //bts_btc - char *cryptostrs[9] = { "btc", "nxt", "unity", "eth", "ltc", "xmr", "bts", "xcp", "etc" }; - int32_t iter,i,j; double btcusd,btcdbtc,cnyusd,prices[8][2],volumes[8][2]; + char *cryptostrs[9] = { "btc", "nxt", "unity", "eth", "steem", "xmr", "bts", "xcp", "etc" }; + int32_t iter,i,j; double btcusd,btcdbtc,cnyusd,prices[9][2],volumes[9][2]; char base[16],rel[16],url[512],*str; cJSON *jsonA,*jsonB; if ( peggyflag != 0 ) { @@ -541,12 +541,13 @@ void _crypto_update(struct peggy_info *PEGS,double cryptovols[2][8][2],struct PA for (j=0; j SMALLVAL ) break; i = 3; - } else i = j; + } else*/ + i = j; for (iter=0; iter<1; iter++) { if ( i == 0 && iter == 0 ) @@ -582,9 +583,9 @@ void _crypto_update(struct peggy_info *PEGS,double cryptovols[2][8][2],struct PA } } -void PAX_RTupdate(struct peggy_info *PEGS,double cryptovols[2][8][2],double RTmetals[4],double *RTprices,struct PAX_data *dp) +void PAX_RTupdate(struct peggy_info *PEGS,double cryptovols[2][9][2],double RTmetals[4],double *RTprices,struct PAX_data *dp) { - char *cryptostrs[8] = { "btc", "nxt", "unity", "eth", "ltc", "xmr", "bts", "xcp" }; + char *cryptostrs[9] = { "btc", "nxt", "unity", "eth", "etc", "steem", "xmr", "bts", "xcp" }; int32_t iter,i,c,baserel,basenum,relnum; double cnyusd,btcusd,btcdbtc,bid,ask,price,vol,prices[8][2],volumes[8][2]; char base[16],rel[16]; PAX_update(PEGS,&btcusd,&btcdbtc); diff --git a/iguana/tests/PAX b/iguana/tests/PAX new file mode 100755 index 000000000..f4d6950e8 --- /dev/null +++ b/iguana/tests/PAX @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"pax\",\"method\":\"start\"}" diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index 041aae0f2..94fdf8039 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -13,6 +13,7 @@ * * ******************************************************************************/ +ZERO_ARGS(pax,start); INT_AND_ARRAY(iguana,rates,unused,quotes); TWO_STRINGS(iguana,rate,base,rel); THREE_STRINGS_AND_THREE_INTS(iguana,prices,exchange,base,rel,period,start,end);