diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 769d5a840..192a7632a 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -206,23 +206,55 @@ cJSON *LP_NXT_decrypt(uint64_t txnum,char *account,char *data,char *nonce,char * return(retjson); } +int64_t NXTventure_qty(uint64_t assetid) +{ + char url[1024],*retstr; uint64_t qty=0; cJSON *retjson; + sprintf(url,"http://127.0.0.1:7876/nxt?requestType=getAccounts&accountRS=NXT-XRK4-5HYK-5965-9FH4Z"); + if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 ) + { + printf("NXT_venture_qty(%s)\n",retstr); + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + free_json(retjson); + } + free(retstr); + } + return(qty); +} + void NXTventure_liquidation() { - char *retstr,url[1024],*account; uint64_t qty; cJSON *array,*item,*retjson; int32_t i,n=0; + uint64_t assetids[] = + { + + }; + char *retstr,url[1024],*account; uint64_t qty,qtyA,assetid; double ratio; cJSON *array,*item,*retjson; int32_t i,j,numassetids=(int32_t)(sizeof(assetids)/sizeof(*assetids)),n=0; + char *passphrase = ""; sprintf(url,"http://127.0.0.1:7876/nxt?requestType=getAssetAccounts&asset=16212446818542881180"); // {"quantityQNT":"380910","accountRS":"NXT-74VC-NKPE-RYCA-5LMPT","unconfirmedQuantityQNT":"380910","asset":"16212446818542881180","account":"4383817337783094122"} + NXTventure_qty(0); + return; if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 ) { if ( (retjson= cJSON_Parse(retstr)) != 0 ) { if ( (array= jarray(&n,retjson,"accountAssets")) != 0 ) { - for (i=0; i 1 ) + { + printf("%s %.6f\n",account,(double)qty / 1000000.); + sprintf(url,"http://127.0.0.1:7876/nxt?requestType=transferAsset&secretPhrase=%s&recipient=%s&asset=%llu&quantityQNT=%llu&feeNQT=100000000",passphrase,account,(long long)assetid,(long long)(qtyA * ratio)); + } + } } } free_json(retjson);