|
@ -293,23 +293,14 @@ static char *assetids[][3] = |
|
|
{ "10524562908394749924", "MGW", "1" }, |
|
|
{ "10524562908394749924", "MGW", "1" }, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
void prices_loop(void *ignore) |
|
|
void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp) |
|
|
{ |
|
|
|
|
|
char *retstr; cJSON *retjson,*bid,*ask; uint64_t bidsatoshis,asksatoshis; int32_t i; double nxtkmd,price; struct LP_priceinfo *btcpp,*kmdpp,*fiatpp,*nxtpp; void *ctx = bitcoin_ctx(); |
|
|
|
|
|
while ( 1 ) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( (btcpp= LP_priceinfofind("BTC")) == 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
sleep(60); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if ( LP_autoprices != 0 ) |
|
|
|
|
|
{ |
|
|
{ |
|
|
|
|
|
char *retstr; cJSON *retjson,*bid,*ask; uint64_t bidsatoshis,asksatoshis; int32_t i; double nxtkmd,price; struct LP_priceinfo *kmdpp,*fiatpp,*nxtpp; |
|
|
if ( (retstr= issue_curlt("https://bittrex.com/api/v1.1/public/getmarketsummaries",LP_HTTP_TIMEOUT*10)) == 0 ) |
|
|
if ( (retstr= issue_curlt("https://bittrex.com/api/v1.1/public/getmarketsummaries",LP_HTTP_TIMEOUT*10)) == 0 ) |
|
|
{ |
|
|
{ |
|
|
printf("error getting marketsummaries\n"); |
|
|
printf("error getting marketsummaries\n"); |
|
|
sleep(60); |
|
|
sleep(60); |
|
|
continue; |
|
|
return; |
|
|
} |
|
|
} |
|
|
nxtkmd = LP_pricesparse(ctx,1,retstr,btcpp); |
|
|
nxtkmd = LP_pricesparse(ctx,1,retstr,btcpp); |
|
|
free(retstr); |
|
|
free(retstr); |
|
@ -317,7 +308,7 @@ void prices_loop(void *ignore) |
|
|
{ |
|
|
{ |
|
|
printf("error getting marketsummaries\n"); |
|
|
printf("error getting marketsummaries\n"); |
|
|
sleep(60); |
|
|
sleep(60); |
|
|
continue; |
|
|
return; |
|
|
} |
|
|
} |
|
|
LP_pricesparse(ctx,0,retstr,btcpp); |
|
|
LP_pricesparse(ctx,0,retstr,btcpp); |
|
|
free(retstr); |
|
|
free(retstr); |
|
@ -364,9 +355,22 @@ void prices_loop(void *ignore) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void prices_loop(void *ignore) |
|
|
|
|
|
{ |
|
|
|
|
|
char *buycoin,*sellcoin,*retstr; struct iguana_info *buy,*sell; cJSON *retjson; struct LP_priceinfo *btcpp; void *ctx = bitcoin_ctx(); |
|
|
|
|
|
while ( 1 ) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("prices_loop\n"); |
|
|
|
|
|
if ( (btcpp= LP_priceinfofind("BTC")) == 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
sleep(60); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if ( LP_autoprices != 0 ) |
|
|
|
|
|
LP_autoprice_iter(ctx,btcpp); |
|
|
if ( LP_autofills > 0 ) |
|
|
if ( LP_autofills > 0 ) |
|
|
{ |
|
|
{ |
|
|
char *buycoin,*sellcoin; struct iguana_info *buy,*sell; |
|
|
|
|
|
if ( (retstr= LP_portfolio()) != 0 ) |
|
|
if ( (retstr= LP_portfolio()) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|
|
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|
@ -379,7 +383,7 @@ void prices_loop(void *ignore) |
|
|
} |
|
|
} |
|
|
free(retstr); |
|
|
free(retstr); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else printf("LP_autofills.%d\n",LP_autofills); |
|
|
sleep(60); |
|
|
sleep(60); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|