update crypto position

This commit is contained in:
Justin 2023-07-11 18:47:24 +08:00 committed by GitHub
parent 4c0fff8b33
commit a8d3b16006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2933,3 +2933,37 @@ function updateStockPorftolio() {
stockValidate();
}
}
// update crypto portfolio position with new values
function updateCryptoPorftolio() {
let update_crypto_cost = document.getElementById('cryptocost').value;
let update_crypto_shares = document.getElementById('cryptoshares').value;
let update_crypto_symbol = document.getElementById('inputText4').value;
let update_crypto_days = document.getElementById('cryptodate').value;
let update_crypto_settings = {
shares:update_crypto_shares,
cost:update_crypto_cost,
symbol:update_crypto_symbol,
days:update_crypto_days,
};
if ((update_crypto_shares !== '') && (update_crypto_cost !== '') && (update_crypto_days !== '') && (update_crypto_symbol !== '')) {
fetch("/savePortfolioCryptoSettings", {
method: "POST",
body: JSON.stringify(update_crypto_settings),
});
document.getElementById('updated-crypto-p').style.display = "block";
setTimeout(function hideElement() {
document.getElementById('updated-crypto-p').style.display = "none";
}, 5000);
} else {
cryptoValidate();
}
}