getglobalstocksymbol function
This commit is contained in:
parent
f435cbd9bb
commit
fd782c6fbe
@ -3484,6 +3484,40 @@ function getStockSymbol(value) {
|
||||
}}
|
||||
|
||||
|
||||
// get global stock portfolio values
|
||||
function getGlobalStockSymbol(value) {
|
||||
let globalstock_symbol = value;
|
||||
const globalstock_thing = document.getElementById("globalstocks_symbol");
|
||||
const globalstock_shares = document.getElementById("globalstocks_port_shares");
|
||||
const globalstock_cost = document.getElementById("globalstocks_port_cost");
|
||||
const globalstock_date = document.getElementById("globalstocks_port_date");
|
||||
const globalstock_portfolio_check = document.getElementById("globalstocks_portfolio");
|
||||
globalstock_thing.value = globalstock_symbol;
|
||||
|
||||
if (globalstock_portfolio_check.checked) {
|
||||
fetch("/fetchGlobalStockPortfolio", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(globalstock_symbol),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (JSON.stringify(data) !== '{}') {
|
||||
// Update the elements with the retrieved information
|
||||
globalstock_shares.value = data.shares;
|
||||
globalstock_cost.value = data.cost;
|
||||
globalstock_date.value = data.day;
|
||||
} else {
|
||||
globalstock_shares.value = '';
|
||||
globalstock_cost.value = '';
|
||||
globalstock_date.value = '';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}}
|
||||
|
||||
|
||||
// get crypto portfolio values
|
||||
function getCryptoSymbol(value) {
|
||||
let crypto_symbol = value;
|
||||
|
Loading…
Reference in New Issue
Block a user