commit 6340f11221fb2ac6d567ecc2ceba0c5fc60c3de5
Author: root <root@hub.scroll.pub> Date: 2024-12-27 14:45:48 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..37a0880 --- /dev/null +++ b/body.html @@ -0,0 +1,37 @@ +<header class="hero"> + <div class="container"> + <h1>DividendFolio</h1> + <p class="tagline">Craft & Analyze Your Perfect Dividend Portfolio</p> + </div> +</header> + +<main class="container"> + <section class="portfolio-builder"> + <h2>Build Your Portfolio</h2> + <div class="filters"> + <label> + <input type="checkbox" id="low-volatility"> Low Volatility + </label> + <label> + <input type="checkbox" id="high-dividend"> High Dividend + </label> + <label> + <input type="checkbox" id="high-quality"> High Quality + </label> + </div> + <div class="stock-grid" id="stock-grid"></div> + </section> + + <section class="portfolio-viewer"> + <h2>Your Portfolio</h2> + <div class="selected-stocks" id="selected-stocks"></div> + <button class="btn-backtest" id="backtest-btn">Backtest Portfolio</button> + <div class="results" id="results"></div> + </section> +</main> + +<footer> + <div class="container"> + <p>Empowering investors to make informed dividend decisions</p> + </div> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..c91a2b6 --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://dividendfolio.scroll.pub +metaTags +editButton /edit.html +title DividendFolio - Build & Backtest Your Dividend Portfolio +style.css +body.html +script.js \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..e5c16fb --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# dividendfolio.scroll.pub +Website generated by DeepSeek from prompt: 我想做一个投资网站,网站让客户专门挑选红利组合。网站提供给各种个股三个维度的标签,是否是低波、是否是高股息、是否质量较高,投资者可以选择任意股票作为一个组合,然后回测收益。 \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..db0cae5 --- /dev/null +++ b/script.js @@ -0,0 +1,88 @@ +// Sample stock data +const stocks = [ + { name: 'Apple', ticker: 'AAPL', lowVol: true, highDiv: false, highQual: true }, + { name: 'Microsoft', ticker: 'MSFT', lowVol: true, highDiv: false, highQual: true }, + { name: 'AT&T', ticker: 'T', lowVol: true, highDiv: true, highQual: false }, + { name: 'Coca-Cola', ticker: 'KO', lowVol: true, highDiv: true, highQual: true }, + { name: 'Exxon', ticker: 'XOM', lowVol: false, highDiv: true, highQual: false }, + { name: 'Johnson & Johnson', ticker: 'JNJ', lowVol: true, highDiv: true, highQual: true }, + { name: 'Procter & Gamble', ticker: 'PG', lowVol: true, highDiv: true, highQual: true }, + { name: 'Verizon', ticker: 'VZ', lowVol: true, highDiv: true, highQual: false } +]; + +const stockGrid = document.getElementById('stock-grid'); +const selectedStocks = document.getElementById('selected-stocks'); +const backtestBtn = document.getElementById('backtest-btn'); +const resultsDiv = document.getElementById('results'); +const portfolio = new Set(); + +function renderStocks() { + stockGrid.innerHTML = ''; + const lowVol = document.getElementById('low-volatility').checked; + const highDiv = document.getElementById('high-dividend').checked; + const highQual = document.getElementById('high-quality').checked; + + stocks.filter(stock => { + return (!lowVol || stock.lowVol) && + (!highDiv || stock.highDiv) && + (!highQual || stock.highQual); + }).forEach(stock => { + const card = document.createElement('div'); + card.className = 'stock-card'; + card.innerHTML = ` + <h3>${stock.name}</h3> + <p>${stock.ticker}</p> + `; + card.addEventListener('click', () => toggleStock(stock)); + stockGrid.appendChild(card); + }); +} + +function toggleStock(stock) { + if (portfolio.has(stock)) { + portfolio.delete(stock); + } else { + portfolio.add(stock); + } + renderSelectedStocks(); +} + +function renderSelectedStocks() { + selectedStocks.innerHTML = ''; + portfolio.forEach(stock => { + const chip = document.createElement('div'); + chip.className = 'stock-chip'; + chip.textContent = `${stock.name} (${stock.ticker})`; + selectedStocks.appendChild(chip); + }); +} + +function backtestPortfolio() { + if (portfolio.size === 0) { + resultsDiv.textContent = 'Please select at least one stock to backtest.'; + return; + } + + // Simulate backtest results + const portfolioArray = Array.from(portfolio); + const returns = portfolioArray.map(() => (Math.random() * 30).toFixed(2)); + + resultsDiv.innerHTML = ` + <h3>Backtest Results</h3> + <ul> + ${portfolioArray.map((stock, i) => ` + <li>${stock.name} (${stock.ticker}): ${returns[i]}%</li> + `).join('')} + </ul> + <p>Portfolio Average Return: ${(returns.reduce((a,b) => +a + +b, 0) / returns.length).toFixed(2)}%</p> + `; +} + +document.querySelectorAll('.filters input').forEach(input => { + input.addEventListener('change', renderStocks); +}); + +backtestBtn.addEventListener('click', backtestPortfolio); + +// Initial render +renderStocks(); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..10dac68 --- /dev/null +++ b/style.css @@ -0,0 +1,130 @@ +:root { + --primary: #2c3e50; + --secondary: #3498db; + --accent: #e67e22; + --background: #ecf0f1; + --text: #2c3e50; + --white: #ffffff; +} + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: 'Segoe UI', system-ui, sans-serif; + line-height: 1.6; + color: var(--text); + background-color: var(--background); +} + +.container { + max-width: 1200px; + margin: 0 auto; + padding: 0 20px; +} + +.hero { + background: linear-gradient(135deg, var(--primary), var(--secondary)); + color: var(--white); + padding: 4rem 0; + text-align: center; + margin-bottom: 2rem; +} + +.hero h1 { + font-size: 3rem; + margin-bottom: 1rem; +} + +.tagline { + font-size: 1.2rem; + opacity: 0.9; +} + +.filters { + display: flex; + gap: 1rem; + margin-bottom: 2rem; + flex-wrap: wrap; +} + +.filters label { + display: flex; + align-items: center; + gap: 0.5rem; + background: var(--white); + padding: 0.5rem 1rem; + border-radius: 25px; + cursor: pointer; + transition: all 0.3s ease; +} + +.filters label:hover { + transform: translateY(-2px); + box-shadow: 0 4px 6px rgba(0,0,0,0.1); +} + +.stock-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + gap: 1rem; + margin-bottom: 2rem; +} + +.stock-card { + background: var(--white); + padding: 1rem; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); + transition: all 0.3s ease; + cursor: pointer; +} + +.stock-card:hover { + transform: translateY(-3px); + box-shadow: 0 4px 8px rgba(0,0,0,0.15); +} + +.selected-stocks { + display: flex; + gap: 1rem; + flex-wrap: wrap; + margin-bottom: 2rem; +} + +.btn-backtest { + background: var(--accent); + color: var(--white); + border: none; + padding: 1rem 2rem; + border-radius: 25px; + cursor: pointer; + font-size: 1rem; + transition: all 0.3s ease; +} + +.btn-backtest:hover { + background: #d35400; + transform: translateY(-2px); +} + +.results { + margin-top: 2rem; + padding: 1rem; + background: var(--white); + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +@media (max-width: 768px) { + .hero h1 { + font-size: 2rem; + } + + .stock-grid { + grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); + } +} \ No newline at end of file