fetch crypto and stock portfolio values
This commit is contained in:
parent
356546558e
commit
a5e30dfc1c
100
static/app.js
100
static/app.js
@ -2827,64 +2827,70 @@ function updateSelectedMsg(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// get stock portfolio values
|
||||
function getStockSymbol(value) {
|
||||
let stock_symbol = value;
|
||||
const stock_thing = document.getElementById("inputText3");
|
||||
// const the_msg = document.getElementById("inputText14");
|
||||
// const t_color = document.getElementById("inputScrollSpeed16");
|
||||
// const b_color = document.getElementById("inputScrollSpeed19");
|
||||
// const t_size = document.getElementById("inputScrollSpeed17");
|
||||
const stock_shares = document.getElementById("inputText8");
|
||||
const stock_cost = document.getElementById("inputText9");
|
||||
const stock_date = document.getElementById("inputText10");
|
||||
const stock_portfolio_check = document.getElementById("flexCheckChecked4");
|
||||
stock_thing.value = stock_symbol;
|
||||
|
||||
// fetch("/fetchCustomMsg", {
|
||||
// method: "POST",
|
||||
// body: JSON.stringify(messaged),
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// // Update the elements with the retrieved information
|
||||
// the_msg.value = data.text;
|
||||
// t_color.value = data.text_colour;
|
||||
// b_color.value = data.background_colour;
|
||||
// t_size.value = data.size;
|
||||
// theIndexOfMsg = data.index;
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error('Error:', error);
|
||||
// });
|
||||
}
|
||||
|
||||
if (stock_portfolio_check.checked) {
|
||||
fetch("/fetchStockPortfolio", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(stock_symbol),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (JSON.stringify(data) !== '{}') {
|
||||
// Update the elements with the retrieved information
|
||||
stock_shares.value = data.shares;
|
||||
stock_cost.value = data.cost;
|
||||
stock_date.value = data.day;
|
||||
} else {
|
||||
stock_shares.value = '';
|
||||
stock_cost.value = '';
|
||||
stock_date.value = '';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}}
|
||||
|
||||
|
||||
// get crypto portfolio values
|
||||
function getCryptoSymbol(value) {
|
||||
let crypto_symbol = value;
|
||||
const crypto_thing = document.getElementById("inputText4");
|
||||
// const the_msg = document.getElementById("inputText14");
|
||||
// const t_color = document.getElementById("inputScrollSpeed16");
|
||||
// const b_color = document.getElementById("inputScrollSpeed19");
|
||||
// const t_size = document.getElementById("inputScrollSpeed17");
|
||||
const crypto_shares = document.getElementById("cryptoshares");
|
||||
const crypto_cost = document.getElementById("cryptocost");
|
||||
const crypto_date = document.getElementById("cryptodate");
|
||||
const crypto_portfolio_check = document.getElementById("crypto_portfolio_checkbox");
|
||||
|
||||
crypto_thing.value = crypto_symbol;
|
||||
|
||||
// fetch("/fetchCustomMsg", {
|
||||
// method: "POST",
|
||||
// body: JSON.stringify(messaged),
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// // Update the elements with the retrieved information
|
||||
// the_msg.value = data.text;
|
||||
// t_color.value = data.text_colour;
|
||||
// b_color.value = data.background_colour;
|
||||
// t_size.value = data.size;
|
||||
// theIndexOfMsg = data.index;
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error('Error:', error);
|
||||
// });
|
||||
}
|
||||
if (crypto_portfolio_check.checked) {
|
||||
fetch("/fetchCryptoPortfolio", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(crypto_symbol),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (JSON.stringify(data) !== '{}') {
|
||||
// Update the elements with the retrieved information
|
||||
crypto_shares.value = data.shares;
|
||||
crypto_cost.value = data.cost;
|
||||
crypto_date.value = data.day;
|
||||
} else {
|
||||
crypto_shares.value = '';
|
||||
crypto_cost.value = '';
|
||||
crypto_date.value = '';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user