update stock portfolio position function
This commit is contained in:
@@ -2900,3 +2900,36 @@ function getCryptoSymbol(value) {
|
|||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// update stock portfolio position with new values
|
||||||
|
function updateStockPorftolio() {
|
||||||
|
|
||||||
|
let update_stock_cost = document.getElementById('inputText9').value;
|
||||||
|
let update_stock_shares = document.getElementById('inputText8').value;
|
||||||
|
let update_symbol = document.getElementById('inputText3').value;
|
||||||
|
let update_stock_days = document.getElementById('inputText10').value;
|
||||||
|
|
||||||
|
let update_stock_settings = {
|
||||||
|
shares:update_stock_shares,
|
||||||
|
cost:update_stock_cost,
|
||||||
|
symbol:update_symbol,
|
||||||
|
days:update_stock_days,
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((update_stock_shares !== '') && (update_stock_cost !== '') && (update_stock_days !== '') && (update_symbol !== '')) {
|
||||||
|
fetch("/savePortfolioSettings", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(update_stock_settings),
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('updated-stock-p').style.display = "block";
|
||||||
|
setTimeout(function hideElement() {
|
||||||
|
document.getElementById('updated-stock-p').style.display = "none";
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
stockValidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user