Calculator Tools Calculator Tools
Create

Investor Risk Profile Calculator

Apr 23, 2024

About this app

An interactive tool to determine your investment risk profile and suggest portfolio allocation.

Investor Risk Profile Calculator

Related apps

Put this on your site

Source

                    <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Investor Risk Profile Calculator</title>
<meta name="description" content="An interactive tool to determine your investment risk profile and suggest portfolio allocation.">
<meta name="keywords" content="Investment, Risk Assessment, Portfolio Allocation, Financial Tool">
<style>
body {
font-family: 'Roboto', sans-serif;
background: linear-gradient(135deg, #e0eafc, #cfdef3);
color: #333;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
padding: 20px;
box-sizing: border-box;
}
.container {
background: #fff;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
max-width: 600px;
width: 100%;
}
.progress-bar {
background: #f0f0f0;
padding: 10px;
position: relative;
}
.progress-bar::after {
content: '';
display: block;
height: 5px;
background: #4caf50;
width: 0%;
transition: width 0.3s ease-in-out;
}
.questionnaire {
padding: 20px;
}
.question {
margin-bottom: 20px;
}
.question label {
display: block;
margin-bottom: 5px;
}
.options {
margin-bottom: 20px;
}
.options input {
margin-right: 5px;
}
button {
background-color: #5cb85c;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
.result {
display: none;
text-align: center;
padding: 20px;
}
.result p {
font-size: 18px;
margin: 10px 0;
}
@media screen and (max-width: 768px) {
body {
padding: 10px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="progress-bar" id="progressBar"></div>
<div class="questionnaire" id="questionnaire">
<!-- Questions will be dynamically added here -->
</div>
<div class="result" id="result">
<p id="profileType"></p>
<p id="allocationSuggestion"></p>
</div>
</div>

<script>
const questions = [
{ text: "What is your investment goal?", options: [{text: "Preserve my wealth", risk: 2}, {text: "Balance growth with safety", risk: 6}, {text: "Maximize growth", risk: 10}] },
{ text: "How experienced are you with investments?", options: [{text: "Beginner", risk: 3}, {text: "Intermediate", risk: 7}, {text: "Expert", risk: 11}] },
// Additional questions go here...
];
const questionnaire = document.getElementById('questionnaire');
const progressBar = document.getElementById('progressBar').style;
const result = document.getElementById('result');
const profileType = document.getElementById('profileType');
const allocationSuggestion = document.getElementById('allocationSuggestion');
let currentQuestionIndex = 0;
let totalRisk = 0;

function renderQuestion() {
if (currentQuestionIndex < questions.length) {
const question = questions[currentQuestionIndex];
let questionHTML = `<div class="question"><label>${question.text}</label>`;
question.options.forEach((option, index) => {
questionHTML += `<div class="options"><input type="radio" name="question${currentQuestionIndex}" id="option${index}" value="${option.risk}"><label for="option${index}">${option.text}</label></div>`;
});
questionHTML += '</div>';
questionnaire.innerHTML = questionHTML;
progressBar.width = (currentQuestionIndex + 1) / questions.length * 100 + '%';
} else {
displayResult();
}
}

function nextQuestion(selectedRisk) {
totalRisk += parseInt(selectedRisk);
currentQuestionIndex++;
renderQuestion();
}

function displayResult() {
questionnaire.style.display = 'none';
result.style.display = 'block';
let profile = "Conservative";
if (totalRisk > 30) profile = "Balanced";
if (totalRisk > 60) profile = "Growth";
if (totalRisk > 90) profile = "Aggressive";
profileType.textContent = `Your Risk Profile: ${profile}`;
allocationSuggestion.textContent = 'Based on your risk profile, we suggest a portfolio allocation that is...'; // Add logic for allocation suggestion
}

questionnaire.addEventListener('click', (e) => {
if (e.target.type === 'radio') {
nextQuestion(e.target.value);
}
});

renderQuestion();
</script>
</body>
</html>