amore / index.html
niku09uddin26's picture
naltra colonna sotto al PNL , lo voglio a due scelte BUY/ SELL - Initial Deployment
8813198 verified
Raw History Blame Contribute Delete
26.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trading Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.fade-enter-active, .fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
.calendar-day:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
@media (max-width: 640px) {
.calendar-header {
font-size: 0.75rem;
}
.calendar-day {
padding: 0.25rem;
font-size: 0.75rem;
}
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div id="app">
<!-- Main Dashboard -->
<div v-if="currentView === 'dashboard'" class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-8">
<h1 class="text-3xl font-bold text-gray-800">Trading Dashboard</h1>
<div class="flex items-center space-x-4">
<div class="bg-white rounded-lg shadow p-3">
<span class="text-gray-600">Total PNL:</span>
<span class="font-bold ml-2 text-green-500">${{ calculateTotalPNL() }}</span>
</div>
<button @click="showConfig = true" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-cog mr-2"></i> Config
</button>
</div>
</div>
<div class="bg-white rounded-xl shadow-lg overflow-hidden mb-8">
<div class="p-6 border-b border-gray-200">
<div class="flex justify-between items-center">
<h2 class="text-xl font-semibold text-gray-800">{{ currentMonthName }} {{ currentYear }}</h2>
<div class="flex space-x-2">
<button @click="previousMonth" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-chevron-left text-gray-600"></i>
</button>
<button @click="nextMonth" class="p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-chevron-right text-gray-600"></i>
</button>
</div>
</div>
</div>
<div class="grid grid-cols-7 gap-1 p-4 calendar-header">
<div v-for="day in daysOfWeek" :key="day" class="text-center font-medium text-gray-500 py-2">
{{ day }}
</div>
</div>
<div class="grid grid-cols-7 gap-1 p-4">
<div v-for="n in startingDayOfWeek" :key="'empty-' + n" class="h-24"></div>
<button
v-for="day in daysInMonth"
:key="day"
@click="viewDayDetails(day)"
class="calendar-day bg-white border border-gray-200 rounded-lg p-2 h-24 transition-all duration-200 cursor-pointer hover:border-blue-300"
:class="{
'bg-green-50 border-green-200': getDayData(day)?.PNL,
'bg-red-50 border-red-200': getDayData(day)?.PNL && getDayData(day).PNL.startsWith('-$')
}"
>
<div class="flex justify-between">
<span class="font-medium">{{ day }}</span>
<span v-if="getDayData(day)?.PNL"
class="text-xs px-1 rounded"
:class="getDayData(day).PNL.startsWith('-$') ? 'bg-red-100 text-red-800' : 'bg-green-100 text-green-800'">
{{ getDayData(day).PNL }}
</span>
</div>
<div v-if="getDayData(day)?.notes" class="text-xs mt-1 truncate text-gray-600">
<i class="fas fa-sticky-note text-yellow-500"></i> {{ truncateNotes(getDayData(day).notes) }}
</div>
</button>
</div>
</div>
<div class="bg-white rounded-xl shadow-lg p-6">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Monthly Summary</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-green-50 p-4 rounded-lg border border-green-200">
<h3 class="text-sm font-medium text-green-800">Profitable Days</h3>
<p class="text-2xl font-bold text-green-600">{{ profitableDaysCount() }}</p>
</div>
<div class="bg-red-50 p-4 rounded-lg border border-red-200">
<h3 class="text-sm font-medium text-red-800">Losing Days</h3>
<p class="text-2xl font-bold text-red-600">{{ losingDaysCount() }}</p>
</div>
<div class="bg-blue-50 p-4 rounded-lg border border-blue-200">
<h3 class="text-sm font-medium text-blue-800">Avg Daily PNL</h3>
<p class="text-2xl font-bold text-blue-600">${{ calculateAveragePNL() }}</p>
</div>
</div>
</div>
<div class="bg-white rounded-xl shadow-lg p-6 mt-8">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Performance Analytics</h2>
<div class="mb-8">
<h3 class="text-lg font-medium text-gray-700 mb-2">Equity Curve</h3>
<div class="h-64 bg-gray-50 rounded-lg p-4">
<canvas id="equityChart"></canvas>
</div>
</div>
<div>
<h3 class="text-lg font-medium text-gray-700 mb-2">Win/Loss Ratio</h3>
<div class="h-48 bg-gray-50 rounded-lg p-4">
<canvas id="winLossChart"></canvas>
</div>
</div>
</div>
</div>
<!-- Day Details View -->
<div v-if="currentView === 'dayDetails'" class="container mx-auto px-4 py-8">
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<div class="p-6 border-b border-gray-200 flex justify-between items-center">
<h2 class="text-2xl font-semibold text-gray-800">
<button @click="backToDashboard" class="mr-4 text-blue-600 hover:text-blue-800">
<i class="fas fa-arrow-left"></i>
</button>
Trading Details - {{ selectedDate }}
</h2>
<button @click="saveDayData" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-save mr-2"></i> Save
</button>
</div>
<div class="p-6">
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-1">PNL ($)</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-sm">$</span>
</div>
<input v-model="currentDayData.PNL" type="text" class="focus:ring-blue-500 focus:border-blue-500 block w-full pl-7 pr-12 sm:text-sm border-gray-300 rounded-md p-2 border" placeholder="0.00">
<div class="absolute inset-y-0 right-0 flex items-center">
<select v-model="currentDayData.PNLType" class="focus:ring-blue-500 focus:border-blue-500 h-full py-0 pl-2 pr-7 border-transparent bg-transparent text-gray-500 sm:text-sm rounded-r-md">
<option value="positive">Profit</option>
<option value="negative">Loss</option>
</select>
</div>
</div>
</div>
<div class="grid grid-cols-2 gap-4 mb-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Prezzo di Entrata</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-sm">$</span>
</div>
<input v-model="currentDayData.entryPrice" type="text" class="focus:ring-blue-500 focus:border-blue-500 block w-full pl-7 sm:text-sm border-gray-300 rounded-md p-2 border" placeholder="0.00">
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Prezzo di Uscita</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<span class="text-gray-500 sm:text-sm">$</span>
</div>
<input v-model="currentDayData.exitPrice" type="text" class="focus:ring-blue-500 focus:border-blue-500 block w-full pl-7 sm:text-sm border-gray-300 rounded-md p-2 border" placeholder="0.00">
</div>
</div>
</div>
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-1">Asset</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-chart-line text-gray-500"></i>
</div>
<input v-model="currentDayData.asset" type="text" class="focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 pr-12 sm:text-sm border-gray-300 rounded-md p-2 border" placeholder="ES, NQ, CL...">
</div>
</div>
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-1">Lotti</label>
<div class="relative rounded-md shadow-sm">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-layer-group text-gray-500"></i>
</div>
<input v-model="currentDayData.lots" type="text" class="focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 sm:text-sm border-gray-300 rounded-md p-2 border" placeholder="1, 2, 3...">
</div>
</div>
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
<textarea v-model="currentDayData.notes" rows="4" class="shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border border-gray-300 rounded-md p-2" placeholder="Setup, mistakes, observations..."></textarea>
</div>
</div>
</div>
</div>
<!-- Configuration Modal -->
<div v-if="showConfig" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50">
<div class="bg-white rounded-xl shadow-xl w-full max-w-2xl">
<div class="p-6 border-b border-gray-200 flex justify-between items-center">
<h3 class="text-xl font-semibold text-gray-800">Configuration</h3>
<button @click="showConfig = false" class="text-gray-400 hover:text-gray-500">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<h4 class="font-medium text-gray-700 mb-4">Framer Setup Instructions</h4>
<ol class="list-decimal list-inside space-y-3 text-gray-700">
<li>Create a "Frame" for the main page (replicate the table with Table component or manual grid)</li>
<li>Add links to cells: select a cell → "Add Link" → link to a new frame (detail page)</li>
<li>Use variables:
<pre class="bg-gray-100 p-2 rounded mt-2 text-sm">dailyData = [
{ date: "6", PNL: "$664.80", volume: "26M", notes: "Scalping ES" },
{ date: "7", PNL: "-$120.50", volume: "15M", notes: "Bad entry" }
]</pre>
</li>
<li>In the detail page, add input fields that update dailyData</li>
<li>Sync data:
<pre class="bg-gray-100 p-2 rounded mt-2 text-sm">In main page cells, use: {dailyData.find(d => d.date === "6").PNL}</pre>
</li>
</ol>
</div>
<div class="p-4 border-t border-gray-200 flex justify-end">
<button @click="showConfig = false" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
Close
</button>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@3.2.47/dist/vue.global.min.js"></script>
<script>
const { createApp, ref, computed, onMounted, watch } = Vue;
createApp({
setup() {
const currentView = ref('dashboard');
const showConfig = ref(false);
const currentDate = new Date();
const currentMonth = ref(currentDate.getMonth());
const currentYear = ref(currentDate.getFullYear());
const selectedDay = ref(null);
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const dailyData = ref([
{ date: '6', PNL: '$664.80', asset: 'ES', lots: '2', notes: 'Scalping, good entries', trades: 12, winRate: '75%', PNLType: 'positive' },
{ date: '7', PNL: '-$120.50', asset: 'NQ', lots: '1', notes: 'Bad entry, revenge trading', trades: 8, winRate: '50%', PNLType: 'negative' },
{ date: '10', PNL: '$902.54', asset: 'CL', lots: '3', notes: 'Perfect day, followed plan', trades: 18, winRate: '83%', PNLType: 'positive' },
{ date: '15', PNL: '$450.20', asset: 'ES', lots: '2', notes: 'Slow session, took what market gave', trades: 10, winRate: '70%', PNLType: 'positive' },
{ date: '20', PNL: '-$75.30', asset: 'NQ', lots: '1', notes: 'Missed morning setup, forced trades', trades: 5, winRate: '40%', PNLType: 'negative' }
]);
const currentDayData = ref({
date: '',
PNL: '',
volume: '',
notes: '',
trades: '',
winRate: '',
PNLType: 'positive'
});
const currentMonthName = computed(() => {
return new Date(currentYear.value, currentMonth.value).toLocaleString('default', { month: 'long' });
});
const daysInMonth = computed(() => {
return new Date(currentYear.value, currentMonth.value + 1, 0).getDate();
});
const startingDayOfWeek = computed(() => {
return new Date(currentYear.value, currentMonth.value, 1).getDay();
});
const selectedDate = computed(() => {
return `${currentMonthName.value} ${selectedDay.value}, ${currentYear.value}`;
});
function previousMonth() {
if (currentMonth.value === 0) {
currentMonth.value = 11;
currentYear.value--;
} else {
currentMonth.value--;
}
}
function nextMonth() {
if (currentMonth.value === 11) {
currentMonth.value = 0;
currentYear.value++;
} else {
currentMonth.value++;
}
}
function viewDayDetails(day) {
selectedDay.value = day;
const existingData = dailyData.value.find(d => d.date === day.toString());
if (existingData) {
currentDayData.value = { ...existingData };
} else {
currentDayData.value = {
date: day.toString(),
PNL: '',
asset: '',
lots: '',
notes: '',
trades: '',
winRate: '',
PNLType: 'positive'
};
}
currentView.value = 'dayDetails';
}
function backToDashboard() {
currentView.value = 'dashboard';
}
function saveDayData() {
// Format PNL with $ sign
if (currentDayData.value.PNL && !currentDayData.value.PNL.startsWith('$') && !currentDayData.value.PNL.startsWith('-')) {
if (currentDayData.value.PNLType === 'negative') {
currentDayData.value.PNL = `-$${currentDayData.value.PNL}`;
} else {
currentDayData.value.PNL = `$${currentDayData.value.PNL}`;
}
}
const index = dailyData.value.findIndex(d => d.date === currentDayData.value.date);
if (index !== -1) {
dailyData.value[index] = { ...currentDayData.value };
} else {
dailyData.value.push({ ...currentDayData.value });
}
backToDashboard();
}
function getDayData(day) {
return dailyData.value.find(d => d.date === day.toString());
}
function truncateNotes(notes) {
return notes.length > 20 ? notes.substring(0, 20) + '...' : notes;
}
function profitableDaysCount() {
return dailyData.value.filter(d => d.PNL && !d.PNL.startsWith('-')).length;
}
function losingDaysCount() {
return dailyData.value.filter(d => d.PNL && d.PNL.startsWith('-')).length;
}
function calculateTotalPNL() {
let total = 0;
dailyData.value.forEach(day => {
if (day.PNL) {
const value = parseFloat(day.PNL.replace(/[^0-9.-]/g, ''));
total += value;
}
});
return total.toFixed(2);
}
function calculateAveragePNL() {
const daysWithPNL = dailyData.value.filter(d => d.PNL);
if (daysWithPNL.length === 0) return '0.00';
let total = 0;
daysWithPNL.forEach(day => {
const value = parseFloat(day.PNL.replace(/[^0-9.-]/g, ''));
total += value;
});
return (total / daysWithPNL.length).toFixed(2);
}
const equityChart = ref(null);
const winLossChart = ref(null);
function renderCharts() {
// Equity Curve Chart
const equityCtx = document.getElementById('equityChart');
if (equityChart.value) equityChart.value.destroy();
const equityData = [];
let runningTotal = 0;
for (let day = 1; day <= daysInMonth.value; day++) {
const dayData = getDayData(day);
if (dayData?.PNL) {
const value = parseFloat(dayData.PNL.replace(/[^0-9.-]/g, ''));
runningTotal += value;
equityData.push({ day, value: runningTotal });
} else {
equityData.push({ day, value: runningTotal });
}
}
equityChart.value = new Chart(equityCtx, {
type: 'line',
data: {
labels: equityData.map(d => d.day),
datasets: [{
label: 'Cumulative PNL ($)',
data: equityData.map(d => d.value),
borderColor: '#3b82f6',
backgroundColor: 'rgba(59, 130, 246, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: false
}
}
}
});
// Win/Loss Ratio Chart
const winLossCtx = document.getElementById('winLossChart');
if (winLossChart.value) winLossChart.value.destroy();
const profitableDays = profitableDaysCount();
const losingDays = losingDaysCount();
winLossChart.value = new Chart(winLossCtx, {
type: 'doughnut',
data: {
labels: ['Wins', 'Losses'],
datasets: [{
data: [profitableDays, losingDays],
backgroundColor: [
'#10b981',
'#ef4444'
],
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'bottom'
}
}
}
});
}
onMounted(() => {
renderCharts();
});
watch([currentMonth, dailyData], () => {
renderCharts();
});
return {
currentView,
showConfig,
currentMonth,
currentYear,
selectedDay,
daysOfWeek,
dailyData,
currentDayData,
currentMonthName,
daysInMonth,
startingDayOfWeek,
selectedDate,
previousMonth,
nextMonth,
viewDayDetails,
backToDashboard,
saveDayData,
getDayData,
truncateNotes,
profitableDaysCount,
losingDaysCount,
calculateTotalPNL,
calculateAveragePNL,
renderCharts
};
}
}).mount('#app');
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=niku09uddin26/amore" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>