undefined / analysis.html
Waaryaabdul1's picture
# Msonjo Trade - Fundamental Bias Dashboard (Full Package)
3137d1b verified
Raw History Blame Contribute Delete
46.6 kB
<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Analysis | Pinky Forecasters</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@3.0.1/build/global/luxon.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.2.0/dist/chartjs-adapter-luxon.min.js"></script>
</head>
<body class="bg-white font-sans antialiased">
<div id="app" class="min-h-screen flex flex-col">
<!-- Navigation -->
<nav class="bg-white border-b border-pink-100 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<div class="flex-shrink-0 flex items-center">
<i data-feather="trending-up" class="h-8 w-8 text-primary-500"></i>
<span class="ml-2 text-xl font-bold text-gray-900">Pinky Forecasters</span>
</div>
</div>
<div class="hidden sm:ml-6 sm:flex sm:items-center">
<a href="dashboard.html" class="px-3 py-2 rounded-md text-sm font-medium text-gray-500 hover:text-gray-700">Dashboard</a>
<a href="fundamentals.html" class="px-3 py-2 rounded-md text-sm font-medium text-gray-500 hover:text-gray-700 ml-4">Fundamentals</a>
<a href="analysis.html" class="px-3 py-2 rounded-md text-sm font-medium text-primary-600 bg-pink-50 ml-4">Analysis</a>
<button class="ml-4 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary-500 hover:bg-primary-600 focus:outline-none">
<i data-feather="user" class="mr-2 h-4 w-4"></i> Sign In
</button>
</div>
<div class="-mr-2 flex items-center sm:hidden">
<button @click="mobileMenuOpen = !mobileMenuOpen" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none">
<i :data-feather="mobileMenuOpen ? 'x' : 'menu'" class="h-6 w-6"></i>
</button>
</div>
</div>
</div>
<!-- Mobile menu -->
<div v-show="mobileMenuOpen" class="sm:hidden border-t border-pink-100">
<div class="pt-2 pb-3 space-y-1">
<a href="dashboard.html" class="block px-3 py-2 rounded-md text-base font-medium text-gray-500 hover:text-gray-700">Dashboard</a>
<a href="fundamentals.html" class="block px-3 py-2 rounded-md text-base font-medium text-gray-500 hover:text-gray-700">Fundamentals</a>
<a href="analysis.html" class="block px-3 py-2 rounded-md text-base font-medium text-primary-600 bg-pink-50">Analysis</a>
<button class="w-full mt-2 inline-flex justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary-500 hover:bg-primary-600 focus:outline-none">
<i data-feather="user" class="mr-2 h-4 w-4"></i> Sign In
</button>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="flex-grow">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="text-center mb-12">
<h1 class="text-4xl font-extrabold text-gray-900 sm:text-5xl">
<span class="text-primary-500">Advanced</span> Market Analysis
</h1>
<p class="mt-3 max-w-2xl mx-auto text-xl text-gray-500">
In-depth technical, fundamental and sentiment indicators
</p>
</div>
<!-- Asset Selector -->
<div class="bg-white shadow rounded-lg p-6 mb-8">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Select Asset</label>
<select v-model="selectedAsset" @change="loadAssetData" class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<option v-for="asset in assets" :value="asset.symbol">{{ asset.name }} ({{ asset.symbol }})</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Timeframe</label>
<select v-model="selectedTimeframe" @change="loadAssetData" class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<option value="1m">1 Month</option>
<option value="3m">3 Months</option>
<option value="6m">6 Months</option>
<option value="1y">1 Year</option>
</select>
</div>
</div>
</div>
<!-- Score Summary -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<!-- Overall Score -->
<div class="bg-white shadow rounded-lg p-6 border-l-4" :class="getScoreBorderClass(assetData.overall_score)">
<div class="flex items-center">
<div class="rounded-full p-3 mr-4" :class="getScoreBgClass(assetData.overall_score)">
<i data-feather="activity" class="h-6 w-6 text-white"></i>
</div>
<div>
<p class="text-sm text-gray-500">Overall Score</p>
<h3 class="text-2xl font-bold" :class="getScoreTextClass(assetData.overall_score)">
{{ assetData.overall_score || '--' }}
</h3>
</div>
</div>
</div>
<!-- Fundamental Score -->
<div class="bg-white shadow rounded-lg p-6 border-l-4" :class="getScoreBorderClass(assetData.fundamental_score)">
<div class="flex items-center">
<div class="rounded-full p-3 mr-4" :class="getScoreBgClass(assetData.fundamental_score)">
<i data-feather="layers" class="h-6 w-6 text-white"></i>
</div>
<div>
<p class="text-sm text-gray-500">Fundamental</p>
<h3 class="text-2xl font-bold" :class="getScoreTextClass(assetData.fundamental_score)">
{{ assetData.fundamental_score || '--' }}
</h3>
</div>
</div>
</div>
<!-- Technical Score -->
<div class="bg-white shadow rounded-lg p-6 border-l-4" :class="getScoreBorderClass(assetData.technical_score)">
<div class="flex items-center">
<div class="rounded-full p-3 mr-4" :class="getScoreBgClass(assetData.technical_score)">
<i data-feather="trending-up" class="h-6 w-6 text-white"></i>
</div>
<div>
<p class="text-sm text-gray-500">Technical</p>
<h3 class="text-2xl font-bold" :class="getScoreTextClass(assetData.technical_score)">
{{ assetData.technical_score || '--' }}
</h3>
</div>
</div>
</div>
</div>
<!-- Charts Section -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
<!-- Price Chart -->
<div class="bg-white shadow rounded-lg p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium text-gray-900">Price Action</h3>
<div class="flex space-x-2">
<button @click="setChartType('line')" class="px-2 py-1 text-sm rounded" :class="chartType === 'line' ? 'bg-primary-100 text-primary-600' : 'text-gray-500 hover:bg-gray-100'">
Line
</button>
<button @click="setChartType('candlestick')" class="px-2 py-1 text-sm rounded" :class="chartType === 'candlestick' ? 'bg-primary-100 text-primary-600' : 'text-gray-500 hover:bg-gray-100'">
Candles
</button>
</div>
</div>
<div class="h-80">
<canvas ref="priceChart"></canvas>
</div>
</div>
<!-- Volume Chart -->
<div class="bg-white shadow rounded-lg p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Volume & Open Interest</h3>
<div class="h-80">
<canvas ref="volumeChart"></canvas>
</div>
</div>
</div>
<!-- Indicators Section -->
<div class="bg-white shadow rounded-lg p-6 mb-8">
<h3 class="text-lg font-medium text-gray-900 mb-6">Key Indicators</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<!-- Macro Indicators -->
<div>
<h4 class="text-md font-medium text-gray-900 mb-3 flex items-center">
<i data-feather="globe" class="h-4 w-4 mr-2 text-primary-500"></i>
Macro Indicators
</h4>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">GDP Growth</span>
<span class="font-medium" :class="getChangeClass(assetData.gdp_change)">{{ assetData.gdp_change || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + assetData.gdp_change * 10)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Inflation</span>
<span class="font-medium" :class="getChangeClass(assetData.inflation)">{{ assetData.inflation || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, assetData.inflation * 10)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Interest Rate</span>
<span class="font-medium">{{ assetData.interest_rate || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, assetData.interest_rate * 10)) + '%' }"></div>
</div>
</div>
</div>
</div>
<!-- Technical Indicators -->
<div>
<h4 class="text-md font-medium text-gray-900 mb-3 flex items-center">
<i data-feather="bar-chart-2" class="h-4 w-4 mr-2 text-primary-500"></i>
Technical Indicators
</h4>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">RSI (14)</span>
<span class="font-medium" :class="getRsiClass(assetData.rsi)">{{ assetData.rsi || '--' }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-yellow-500 h-2 rounded-full" :style="{ width: assetData.rsi || 0 + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">MACD</span>
<span class="font-medium" :class="getMacdClass(assetData.macd)">{{ assetData.macd || '--' }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-red-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + (assetData.macd * 10))) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Volatility</span>
<span class="font-medium">{{ assetData.volatility || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-pink-500 h-2 rounded-full" :style="{ width: Math.min(100, assetData.volatility || 0 * 2) + '%' }"></div>
</div>
</div>
</div>
</div>
<!-- Sentiment Indicators -->
<div>
<h4 class="text-md font-medium text-gray-900 mb-3 flex items-center">
<i data-feather="users" class="h-4 w-4 mr-2 text-primary-500"></i>
Sentiment Indicators
</h4>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">COT Net Position</span>
<span class="font-medium" :class="getChangeClass(assetData.cot_net)">{{ assetData.cot_net || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-indigo-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + assetData.cot_net)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Put/Call Ratio</span>
<span class="font-medium">{{ assetData.put_call || '--' }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-teal-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, assetData.put_call * 100)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Social Sentiment</span>
<span class="font-medium" :class="getChangeClass(assetData.sentiment)">{{ assetData.sentiment || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-400 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + assetData.sentiment)) + '%' }"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Recommendations -->
<div class="bg-white shadow rounded-lg p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Trading Recommendations</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<div class="rounded-full p-2 mr-3" :class="getBiasBgClass(assetData.bias)">
<i data-feather="alert-circle" class="h-5 w-5 text-white"></i>
</div>
<h4 class="text-md font-medium">Current Bias</h4>
</div>
<p class="text-sm text-gray-600">
{{ assetData.bias_analysis || 'Loading analysis...' }}
</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<div class="rounded-full p-2 mr-3 bg-blue-100">
<i data-feather="target" class="h-5 w-5 text-blue-500"></i>
</div>
<h4 class="text-md font-medium">Key Levels</h4>
</div>
<div class="grid grid-cols-2 gap-2 text-sm">
<div>
<p class="text-gray-500">Resistance</p>
<p class="font-medium">{{ assetData.resistance || '--' }}</p>
</div>
<div>
<p class="text-gray-500">Support</p>
<p class="font-medium">{{ assetData.support || '--' }}</p>
</div>
<div>
<p class="text-gray-500">Pivot</p>
<p class="font-medium">{{ assetData.pivot || '--' }}</p>
</div>
<div>
<p class="text-gray-500">ATR</p>
<p class="font-medium">{{ assetData.atr || '--' }}</p>
</div>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<div class="rounded-full p-2 mr-3 bg-green-100">
<i data-feather="calendar" class="h-5 w-5 text-green-500"></i>
</div>
<h4 class="text-md font-medium">Seasonality</h4>
</div>
<p class="text-sm text-gray-600">
{{ assetData.seasonality || 'Loading seasonality data...' }}
</p>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-white border-t border-pink-100 mt-auto">
<div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
<div class="space-y-8 xl:col-span-1">
<div class="flex items-center">
<i data-feather="trending-up" class="h-8 w-8 text-primary-500"></i>
<span class="ml-2 text-xl font-bold text-gray-900">Pinky Forecasters</span>
</div>
<p class="text-gray-500 text-base">
Making financial forecasting fun and accessible.
</p>
<div class="flex space-x-6">
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="twitter" class="h-6 w-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="facebook" class="h-6 w-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="instagram" class="h-6 w-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="linkedin" class="h-6 w-6"></i>
</a>
</div>
</div>
<div class="mt-12 grid grid-cols-2 gap-8 xl:mt-0 xl:col-span-2">
<div class="md:grid md:grid-cols-2 md:gap-8">
<div>
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Products
</h3>
<div class="mt-4 space-y-4">
<a href="index.html" class="text-base text-gray-500 hover:text-gray-900 block">
Market Forecasts
</a>
<a href="fundamentals.html" class="text-base text-gray-500 hover:text-gray-900 block">
Fundamental Analysis
</a>
<a href="analysis.html" class="text-base text-gray-500 hover:text-gray-900 block">
Advanced Tools
</a>
</div>
</div>
<div class="mt-12 md:mt-0">
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Resources
</h3>
<div class="mt-4 space-y-4">
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Documentation
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Guides
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Blog
</a>
</div>
</div>
</div>
<div class="md:grid md:grid-cols-2 md:gap-8">
<div>
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Company
</h3>
<div class="mt-4 space-y-4">
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
About
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Careers
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Contact
</a>
</div>
</div>
<div class="mt-12 md:mt-0">
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Legal
</h3>
<div class="mt-4 space-y-4">
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Privacy
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Terms
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Compliance
</a>
</div>
</div>
</div>
</div>
</div>
<div class="mt-12 border-t border-gray-200 pt-8">
<p class="text-base text-gray-400 text-center">
&copy; 2023 Pinky Finance Forecasters. All rights reserved.
</p>
</div>
</div>
</footer>
</div>
<script>
feather.replace();
const { createApp, ref, onMounted, watch } = Vue;
createApp({
setup() {
const mobileMenuOpen = ref(false);
const selectedAsset = ref('EURUSD');
const selectedTimeframe = ref('1m');
const chartType = ref('line');
const priceChart = ref(null);
const volumeChart = ref(null);
let priceChartInstance = null;
let volumeChartInstance = null;
const assets = ref([
{ symbol: 'EURUSD', name: 'Euro/Dollar', icon: 'dollar-sign' },
{ symbol: 'USDJPY', name: 'Dollar/Yen', icon: 'dollar-sign' },
{ symbol: 'XAUUSD', name: 'Gold', icon: 'award' },
{ symbol: 'CL1!', name: 'Crude Oil', icon: 'droplet' },
{ symbol: 'SPX500', name: 'S&P 500', icon: 'bar-chart-2' },
{ symbol: 'NDX', name: 'Nasdaq 100', icon: 'bar-chart-2' }
]);
const assetData = ref({
overall_score: null,
fundamental_score: null,
technical_score: null,
bias: 'Neutral',
bias_analysis: '',
gdp_change: null,
inflation: null,
interest_rate: null,
rsi: null,
macd: null,
volatility: null,
cot_net: null,
put_call: null,
sentiment: null,
resistance: null,
support: null,
pivot: null,
atr: null,
seasonality: '',
price_history: [],
volume_history: []
});
const loadAssetData = async () => {
try {
// Fetch asset data from APIs
const [fundamentals, technicals, sentiment] = await Promise.all([
fetchFundamentalData(),
fetchTechnicalData(),
fetchSentimentData()
]);
// Calculate overall score
const overallScore = Math.round(
fundamentals.score * 0.4 +
technicals.score * 0.4 +
sentiment.score * 0.2
);
// Update asset data
assetData.value = {
overall_score: overallScore,
fundamental_score: fundamentals.score,
technical_score: technicals.score,
bias: getBiasFromScore(overallScore),
bias_analysis: getBiasAnalysis(overallScore),
gdp_change: fundamentals.gdp_change,
inflation: fundamentals.inflation,
interest_rate: fundamentals.interest_rate,
rsi: technicals.rsi,
macd: technicals.macd,
volatility: technicals.volatility,
cot_net: sentiment.cot_net,
put_call: sentiment.put_call,
sentiment: sentiment.social_sentiment,
resistance: technicals.resistance,
support: technicals.support,
pivot: technicals.pivot,
atr: technicals.atr,
seasonality: getSeasonalityAnalysis(),
price_history: technicals.price_history,
volume_history: technicals.volume_history
};
// Update charts
updateCharts();
} catch (error) {
console.error('Error loading asset data:', error);
}
};
const fetchFundamentalData = async () => {
try {
const response = await fetch(`https://api.marketdata.com/v3/fundamentals/${selectedAsset.value}`);
const data = await response.json();
return {
score: data.overall_score,
gdp_change: data.gdp_change,
inflation: data.inflation_rate,
interest_rate: data.interest_rate
};
} catch (error) {
console.error('Error fetching fundamental data:', error);
return {
score: 50,
gdp_change: 0,
inflation: 0,
interest_rate: 0
};
}
};
const fetchTechnicalData = async () => {
try {
const response = await fetch(`https://api.marketdata.com/v3/technicals/${selectedAsset.value}?timeframe=${selectedTimeframe.value}`);
const data = await response.json();
return {
score: data.overall_score,
rsi: data.rsi,
macd: data.macd,
volatility: data.volatility,
resistance: data.resistance,
support: data.support,
pivot: data.pivot,
atr: data.atr,
price_history: data.price_history,
volume_history: data.volume_history
};
} catch (error) {
console.error('Error fetching technical data:', error);
return {
score: 50,
rsi: 50,
macd: 0,
volatility: 0,
resistance: 0,
support: 0,
pivot: 0,
atr: 0,
price_history: [],
volume_history: []
};
}
};
const fetchSentimentData = async () => {
try {
const response = await fetch(`https://api.marketdata.com/v3/sentiment/${selectedAsset.value}`);
const data = await response.json();
return {
score: data.overall_score,
cot_net: data.cot_net_position,
put_call: data.put_call_ratio,
social_sentiment: data.social_sentiment
};
} catch (error) {
console.error('Error fetching sentiment data:', error);
return {
score: 50,
cot_net: 0,
put_call: 0,
social_sentiment: 0
};
}
};
const getBiasFromScore = (score) => {
if (score > 60) return 'Bullish';
if (score < 40) return 'Bearish';
return 'Neutral';
};
const getBiasAnalysis = (score) => {
if (score > 60) return 'Strong bullish fundamentals with positive technical indicators suggest potential upside.';
if (score > 40) return 'Moderately bullish conditions with mixed signals. Favor long positions with tight stops.';
if (score > 30) return 'Neutral to slightly bearish. Consider range-bound strategies or staying sidelined.';
return 'Strong bearish signals across indicators. Short opportunities may be favorable.';
};
const getSeasonalityAnalysis = () => {
const month = new Date().getMonth();
const seasonalPatterns = {
'EURUSD': month > 3 && month < 9 ? 'Typically weaker in summer months' : 'Historically stronger in Q4',
'USDJPY': 'Tends to strengthen in risk-off environments',
'XAUUSD': 'Strongest performance in Q1 and Q4',
'CL1!': 'Summer driving season typically supports prices',
'SPX500': 'Historically strong November-April period',
'NDX': 'Tech often outperforms in Q4'
};
return seasonalPatterns[selectedAsset.value] || 'No strong seasonal pattern detected';
};
const setChartType = (type) => {
chartType.value = type;
updateCharts();
};
const updateCharts = () => {
// Destroy existing charts if they exist
if (priceChartInstance) priceChartInstance.destroy();
if (volumeChartInstance) volumeChartInstance.destroy();
// Create new price chart
const priceCtx = priceChart.value.getContext('2d');
priceChartInstance = new Chart(priceCtx, {
type: chartType.value === 'line' ? 'line' : 'candlestick',
data: {
labels: assetData.value.price_history.map((_, i) => `Day ${i+1}`),
datasets: chartType.value === 'line' ? [
{
label: 'Price',
data: assetData.value.price_history.map(p => p.close),
borderColor: '#3b82f6',
backgroundColor: 'rgba(59, 130, 246, 0.1)',
borderWidth: 2,
tension: 0.1,
fill: true
}
] : [
{
label: 'Candles',
data: assetData.value.price_history.map(p => ({
x: p.date,
o: p.open,
h: p.high,
l: p.low,
c: p.close
})),
color: {
up: '#10b981',
down: '#ef4444',
unchanged: '#64748b',
}
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
text: `${selectedAsset.value} Price Action`,
font: {
size: 16
}
},
legend: {
display: false
}
},
scales: {
x: {
type: 'time',
time: {
unit: 'day'
}
},
y: {
beginAtZero: false
}
}
}
});
// Create new volume chart
const volumeCtx = volumeChart.value.getContext('2d');
volumeChartInstance = new Chart(volumeCtx, {
type: 'bar',
data: {
labels: assetData.value.volume_history.map((_, i) => `Day ${i+1}`),
datasets: [
{
label: 'Volume',
data: assetData.value.volume_history.map(v => v.volume),
backgroundColor: 'rgba(99, 102, 241, 0.7)',
borderColor: 'rgba(99, 102, 241, 1)',
borderWidth: 1
},
{
label: 'Open Interest',
data: assetData.value.volume_history.map(v => v.open_interest),
backgroundColor: 'rgba(236, 72, 153, 0.7)',
borderColor: 'rgba(236, 72, 153, 1)',
borderWidth: 1,
type: 'line'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
text: 'Volume & Open Interest',
font: {
size: 16
}
}
},
scales: {
x: {
stacked: true
},
y: {
stacked: false,
beginAtZero: true
}
}
}
});
};
// Helper methods for styling
const getScoreBorderClass = (score) => {
if (!score) return 'border-gray-300';
if (score > 60) return 'border-green-500';
if (score < 40) return 'border-red-500';
return 'border-yellow-500';
};
const getScoreBgClass = (score) => {
if (!score) return 'bg-gray-300';
if (score > 60) return 'bg-green-500';
if (score < 40) return 'bg-red-500';
return 'bg-yellow-500';
};
const getScoreTextClass = (score) => {
if (!score) return 'text-gray-900';
if (score > 60) return 'text-green-600';
if (score < 40) return 'text-red-600';
return 'text-yellow-600';
};
const getBiasBgClass = (bias) => {
switch(bias) {
case 'Bullish': return 'bg-green-500';
case 'Bearish': return 'bg-red-500';
default: return 'bg-yellow-500';
}
};
const getChangeClass = (value) => {
if (!value) return '';
return value > 0 ? 'text-green-600' : value < 0 ? 'text-red-600' : '';
};
const getRsiClass = (value) => {
if (!value) return '';
if (value > 70) return 'text-red-600';
if (value < 30) return 'text-green-600';
return '';
};
const getMacdClass = (value) => {
if (!value) return '';
return value > 0 ? 'text-green-600' : 'text-red-600';
};
// Initial load
onMounted(() => {
loadAssetData();
});
// Watch for asset changes
watch([selectedAsset, selectedTimeframe], () => {
loadAssetData();
});
return {
mobileMenuOpen,
assets,
selectedAsset,
selectedTimeframe,
chartType,
priceChart,
volumeChart,
assetData,
loadAssetData,
setChartType,
getScoreBorderClass,
getScoreBgClass,
getScoreTextClass,
getBiasBgClass,
getChangeClass,
getRsiClass,
getMacdClass
};
}
}).mount('#app');
</script>
</body>
</html>