Add support for USD price lookup of any altcoin

-Market sync now sets the last USD price based on the default market pair even if it is not BTC
-Removed the coindesk api which was only really useful for getting the USD price of BTC
-Added a couple coingecko apis which are used to get the current USD value of the default market pair
-Updated the readme, settings file comments and info/api page with better verbiage regarding the market price which was previously only measured in BTC
This commit is contained in:
joeuhren
2021-05-29 20:40:35 -06:00
parent 975a34f192
commit 460ca331b6
8 changed files with 114 additions and 62 deletions
+14 -7
View File
@@ -572,13 +572,20 @@ function remove_sync_message() {
}
function get_last_usd_price() {
// Get the last usd price for coinstats
db.get_last_usd_price(function(retVal) {
// update markets_last_updated value
db.update_last_updated_stats(settings.coin.name, { markets_last_updated: Math.floor(new Date() / 1000) }, function (cb) {
console.log('market sync complete');
exit();
});
// get the last usd price for coinstats
db.get_last_usd_price(function(err) {
// check for errors
if (err == null) {
// update markets_last_updated value
db.update_last_updated_stats(settings.coin.name, { markets_last_updated: Math.floor(new Date() / 1000) }, function (cb) {
console.log('market sync complete');
exit();
});
} else {
// display error msg
console.log('error: %s', err);
exit();
}
});
}