feat: remove asset convertor
This commit is contained in:
parent
281664acf8
commit
02930ec54f
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
// curl https://api.coingecko.com/api/v3/coins/list
|
// curl https://api.coingecko.com/api/v3/coins/list
|
||||||
static const struct wallet_s {
|
static const struct wallet_s {
|
||||||
char *id; char *fmt; float value;
|
char *id; char *fmt;
|
||||||
} WALLET[] = {
|
} WALLET[] = {
|
||||||
{"bitcoin", "BTC", 1.00000000},
|
{"bitcoin", "BTC"},
|
||||||
{0},
|
{0},
|
||||||
};
|
};
|
||||||
|
10
crypto.c
10
crypto.c
@ -71,18 +71,18 @@ int main(void)
|
|||||||
{
|
{
|
||||||
char response[BUF_SIZE];
|
char response[BUF_SIZE];
|
||||||
int err = perform_request(response);
|
int err = perform_request(response);
|
||||||
float price, current, sum = 0;
|
float price;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
error(1, errno, "cannot init curl");
|
error(1, errno, "cannot init curl");
|
||||||
}
|
}
|
||||||
err = get_next_symbol(response + 1, &price);
|
err = get_next_symbol(response + 1, &price);
|
||||||
for (size_t i = 0; !err && WALLET[i].id; i++) {
|
for (size_t i = 0; !err && WALLET[i].id; i++) {
|
||||||
current = price * WALLET[i].value;
|
if (i) {
|
||||||
printf(FMT " ", WALLET[i].fmt, current);
|
printf(" ");
|
||||||
sum += current;
|
}
|
||||||
|
printf(FMT, WALLET[i].fmt, price);
|
||||||
err = get_next_symbol(NULL, &price);
|
err = get_next_symbol(NULL, &price);
|
||||||
}
|
}
|
||||||
printf(FMT, "TOT", sum);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user