-
Manual changes saved
-
add this page // --- Shared PHI Engine ---
window.PHI = {
thresholds: { compression: 30, recovery: 50, expansion: 70 },
getPhase(score) {
const t = this.thresholds;
if (score < t.compression) return 'Compression';
if (score < t.recovery) return 'Recovery';
if (score < t.expansion) return 'Expansion';
return 'Exhaustion';
},
getRegime(score) {
if (score < 30) return 'Risk-off';
if (score < 50) return 'Neutral';
if (score < 70) return 'Risk-on';
return 'Extreme';
},
store(data) {
localStorage.setItem('cryptoPulseData', JSON.stringify(data));
localStorage.setItem('cryptoPulseTimestamp', Date.now());
},
read() {
return JSON.parse(localStorage.getItem('cryptoPulseData') || 'null');
},
isStale(minutes = 5) {
const ts = parseInt(localStorage.getItem('cryptoPulseTimestamp') || '0');
return !ts || (Date.now() - ts > minutes * 60000);
}
};
console.log('PHI engine loaded:', typeof PHI); -
Manual changes saved
-
please make the following changes to the site
Below are all three final files, ready to paste directly into VS Code.
They synchronize PHI logic, ensure consistent “phase” readings, and fix silent JS errors.
1. phiEngine.js
(Shared logic — must be loaded before any page script.)
<script>
window.PHI = {
thresholds: {
compression: 30,
recovery: 50,
expansion: 70
},
getPhase(score) {
const t = this.thresholds;
if (score < t.compression) return 'Compression';
if (score < t.recovery) return 'Recovery';
if (score < t.expansion) return 'Expansion';
return 'Exhaustion';
},
getRegime(score) {
if (score < 30) return 'Risk-off';
if (score < 50) return 'Neutral';
if (score < 70) return 'Risk-on';
return 'Extreme';
},
store(data) {
localStorage.setItem('cryptoPulseData', JSON.stringify(data));
localStorage.setItem('cryptoPulseTimestamp', Date.now());
},
read() {
return JSON.parse(localStorage.getItem('cryptoPulseData') || 'null');
},
isStale(minutes = 5) {…