-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
115 lines (106 loc) · 5.26 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>FarmFolio</title>
</head>
<body>
<h1>Protfolio Planner</h1>
<div class="container">
<form>
<div class="row">
<div class="col-sm-4">
<h2>Investment Amount</h2>
<div class="form-floating">
<input type="number" class="form-control" id="fiatAmount" aria-describedby="FiatAmountHelp" value="100">
<label for="fiatAmount" class="form-label" placeholder="How much are you investing?">Fiat Amount</label>
</div>
</div>
<div class="col-sm-8">
<h2>Risk Appetite</h2>
<div class="row">
<div class="col-sm-3">
<div class="form-floating">
<input type="number" class="form-control" id="raLow" aria-describedby="raLowHelp" value="50">
<label for="raLow" class="form-label" placeholder="Low">Low %</label>
</div>
<p id="raLowAmount"></p>
</div>
<div class="col-sm-3">
<div class="form-floating">
<input type="number" class="form-control" id="raMedium" aria-describedby="raMediumHelp" value="20">
<label for="raMedium" class="form-label" placeholder="Medium">Medium %</label>
</div>
<p id="raMediumAmount"></p>
</div>
<div class="col-sm-3">
<div class="form-floating">
<input type="number" class="form-control" id="raHigh" aria-describedby="raHighHelp" value="15">
<label for="raHigh" class="form-label" placeholder="High">High %</label>
</div>
<p id="raHighAmount"></p>
</div>
<div class="col-sm-3">
<div class="form-floating">
<input type="number" class="form-control" id="raDegen" aria-describedby="raDegenHelp" value="15">
<label for="raDegen" class="form-label" placeholder="Degen">Degen %</label>
</div>
<p id="raDegenAmount"></p>
</div>
</div>
</div>
</div>
<button onclick="calcRiskPortfolio()">Calculate </button>
</form>
</div>
<!-- Risk Appetite calculator START-->
<script>
//<!-- calculate a percentage-->
function percentage(num, per)
{
return (num/100)*per;
}
function calcRiskPortfolio() {
//<!-- get the fiat amount -->
var fiatAmount = document.getElementById("fiatAmount").value;
//<!-- get the risk percentage Low -->
var raLow = document.getElementById("raLow").value;
//<!-- get the risk percentage Medium -->
var raMedium = document.getElementById("raMedium").value;
//<!-- get the risk percentage High -->
var raHigh = document.getElementById("raHigh").value;
//<!-- get the risk percentage Degen -->
var raDegen = document.getElementById("raDegen").value;
//<!-- calculate fiat x Low -->
var raLowAmount = Math.round(((fiatAmount / 100) * raLow)) +"%";
//<!-- calculate fiat x Medium -->
var raMediumAmount = Math.round(((fiatAmount / 100) * raMedium)) +"%";
//<!-- calculate fiat x High -->
var raHighAmount = Math.round(((fiatAmount / 100) * raHigh)) +"%";
//<!-- calculate fiat x Degen -->
var raDegenAmount = Math.round(((fiatAmount / 100) * raDegen)) +"%";
// <!-- Print fiat amount to invest for Low -->
document.getElementById("raLowAmount").innerHTML = raLowAmount;
//<!-- Print fiat amount to invest for Medium -->
document.getElementById("raMediumAmount").innerHTML = raMediumAmount;
//<!-- Print fiat amount to invest for High -->
document.getElementById("raHighAmount").innerHTML = raHighAmount;
//<!-- Print fiat amount to invest for Degen -->
document.getElementById("raDegenAmount").innerHTML = raDegenAmount;
//<!-- confirm all investment amounts add up to initial fiat amount -->
}
</script>
<!-- Risk Appetite calculator END-->
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
-->
</body>
</html>