-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
148 lines (127 loc) · 4.36 KB
/
index.html
File metadata and controls
148 lines (127 loc) · 4.36 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aave Leverage Gain</title>
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(to bottom right, #5f3473, #71c1d6);
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
color: white;
text-align: center;
}
.title {
font-size: 2rem;
font-weight: bold;
margin-top: 15px;
margin-bottom: 10px;
padding: 0 10px;
}
.subtitle {
font-size: 1rem;
margin-bottom: 20px;
line-height: 1.5;
padding: 0 15px;
}
.container {
width: 100%;
max-width: 600px; /* Adjust container for larger screens */
padding: 10px 15px; /* Padding for better spacing */
box-sizing: border-box;
}
.input-group {
display: flex;
flex-direction: column; /* Stack elements vertically for smaller screens */
align-items: stretch;
margin-bottom: 15px;
}
.input-group label {
font-size: 1rem;
margin-bottom: 5px; /* Space between label and input */
text-align: left;
}
.input-group input {
padding: 10px;
border: 1px solid #fff;
border-radius: 5px;
background: rgba(255, 255, 255, 0.2);
color: white;
font-size: 1rem;
}
.result {
font-size: 1.5rem;
font-weight: bold;
margin-top: 20px;
padding: 10px;
background: rgba(0, 0, 0, 0.3);
border-radius: 8px;
color: #ffd700;
}
@media (max-width: 600px) {
.title {
font-size: 1.8rem; /* Slightly smaller for smaller screens */
}
.subtitle {
font-size: 0.9rem;
line-height: 1.4;
}
.input-group input {
font-size: 1rem; /* Adjust font size for better readability */
padding: 8px;
}
.result {
font-size: 1.2rem; /* Reduce size on smaller devices */
}
}
</style>
</head>
<body>
<div class="title">Aave Leverage Gain</div>
<div class="subtitle">
Calculate the leverage gain at the end of the investment, with<br> health factor, desired performance of collateral, and debt rate.
</div>
<div class="container">
<div class="input-group">
<label for="hr">Health factor / Health ratio</label>
<input type="number" id="hr" step="any" value="2.5">
</div>
<div class="input-group">
<label for="r">Desired performance of collateral <br> at end of the investment (%)</label>
<input type="number" id="r" step="any" value="100">
</div>
<div class="input-group">
<label for="i">Borrow interest rate / Debt APY (%)</label>
<input type="number" id="i" step="any" value="10">
</div>
<div class="result">Leverage gain at end of investment = <span id="result">0%</span></div>
</div>
<script>
const hrInput = document.getElementById('hr');
const rInput = document.getElementById('r');
const iInput = document.getElementById('i');
const resultSpan = document.getElementById('result');
function calculateG() {
const hr = parseFloat(hrInput.value) || 0;
const r = (parseFloat(rInput.value) || 0) / 100;
const i = (parseFloat(iInput.value) || 0) / 100;
if (hr !== 1) {
const G = ((hr * (1 + r) - (1 + i)) / ((hr - 1) * (1 + r))) - 1;
resultSpan.textContent = (G * 100).toFixed(1) + '%';
} else {
resultSpan.textContent = 'Error';
}
}
hrInput.addEventListener('input', calculateG);
rInput.addEventListener('input', calculateG);
iInput.addEventListener('input', calculateG);
calculateG();
</script>
</body>
</html>