Changes to cryptocalc1.scroll.pub

ffff:103.240.233.144
ffff:103.240.233.144
22 days ago
updated index.scroll
index.scroll
Changed around line 1
- baseUrl https://cryptocalc.scroll.pub
+ baseUrl https://cryptococaine.scroll.pub
root
root
22 days ago
Initial commit
body.html
Changed around line 1
+
+

Crypto Futures Calculator

+

Advanced position sizing and PNL calculations for traders

+
+
+
+
+
+

Position Details

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Trade Entries

+
+
+
+
+
+
+
+
+
+
+
+

Results

+
+
+
+ 0.00
+
+
+
+ 0.00
+
+
+
+ 0.00
+
+
+
+
+

PNL Calculator

+
+
+
+
+
+ 0.00
+ 0.00%
+
+
+
+
+
+
+
+

Built for crypto traders by traders

+
index.scroll
Changed around line 1
+ buildHtml
+ baseUrl https://cryptocalc.scroll.pub
+ metaTags
+ editButton /edit.html
+ title Crypto Futures Calculator | Position Size, PNL & Liquidation
+ style.css
+ body.html
+ script.js
prompt.json
Changed around line 1
+ {
+ "id": "msg_01HnQDsheteMdsFueRZ6zhec",
+ "type": "message",
+ "role": "assistant",
+ "model": "claude-3-5-sonnet-20241022",
+ "content": [
+ {
+ "type": "text",
+ "text": "I'll suggest a domain and create the crypto futures calculator website.\n\n---domain---\ncryptocalc.scroll.pub\n\n---index.scroll---\nbuildHtml\nbaseUrl https://cryptocalc.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Crypto Futures Calculator | Position Size, PNL & Liquidation\nstyle.css\nbody.html\nscript.js\n\n---body.html---\n
\n

Crypto Futures Calculator

\n

Advanced position sizing and PNL calculations for traders

\n
\n\n
\n
\n
\n

Position Details

\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n\n
\n

Trade Entries

\n
\n
\n \n \n \n
\n
\n \n
\n\n
\n

Results

\n
\n
\n \n 0.00\n
\n
\n \n 0.00\n
\n
\n \n 0.00\n
\n
\n\n
\n

PNL Calculator

\n
\n \n \n
\n
\n 0.00\n 0.00%\n
\n
\n
\n
\n
\n\n
\n

Built for crypto traders by traders

\n
\n\n---style.css---\n:root {\n --primary-color: #6c5ce7;\n --secondary-color: #a8a4e6;\n --background: #f8f9fd;\n --text-color: #2d3436;\n --border-radius: 12px;\n --shadow: 0 8px 30px rgba(0,0,0,0.12);\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n background: var(--background);\n color: var(--text-color);\n line-height: 1.6;\n}\n\nheader {\n text-align: center;\n padding: 3rem 1rem;\n background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));\n color: white;\n}\n\nh1 {\n font-size: 2.5rem;\n margin-bottom: 0.5rem;\n}\n\n.tagline {\n font-size: 1.1rem;\n opacity: 0.9;\n}\n\n.calculator-container {\n max-width: 1000px;\n margin: 2rem auto;\n padding: 2rem;\n background: white;\n border-radius: var(--border-radius);\n box-shadow: var(--shadow);\n}\n\n.input-section, .trades-section, .results-section {\n margin-bottom: 2rem;\n}\n\nh2 {\n color: var(--primary-color);\n margin-bottom: 1.5rem;\n}\n\n.input-group {\n margin-bottom: 1rem;\n}\n\nlabel {\n display: block;\n margin-bottom: 0.5rem;\n font-weight: 500;\n}\n\ninput {\n width: 100%;\n padding: 0.8rem;\n border: 2px solid #e1e1e1;\n border-radius: var(--border-radius);\n font-size: 1rem;\n transition: border-color 0.3s ease;\n}\n\ninput:focus {\n border-color: var(--primary-color);\n outline: none;\n}\n\n.trade-entry {\n display: grid;\n grid-template-columns: 1fr 1fr auto;\n gap: 1rem;\n margin-bottom: 1rem;\n}\n\n.remove-trade {\n background: #ff7675;\n color: white;\n border: none;\n border-radius: var(--border-radius);\n width: 40px;\n cursor: pointer;\n font-size: 1.2rem;\n}\n\n.action-button {\n background: var(--primary-color);\n color: white;\n border: none;\n padding: 0.8rem 1.5rem;\n border-radius: var(--border-radius);\n cursor: pointer;\n font-size: 1rem;\n transition: transform 0.2s ease;\n}\n\n.action-button:hover {\n transform: translateY(-2px);\n}\n\n.result-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n gap: 1.5rem;\n margin-bottom: 2rem;\n}\n\n.result-item {\n background: var(--background);\n padding: 1.5rem;\n border-radius: var(--border-radius);\n text-align: center;\n}\n\n.result-item label {\n font-size: 0.9rem;\n color: #636e72;\n}\n\n.result-item span {\n display: block;\n font-size: 1.5rem;\n font-weight: 600;\n color: var(--primary-color);\n}\n\n.pnl-calculator {\n background: var(--background);\n padding: 1.5rem;\n border-radius: var(--border-radius);\n}\n\n.pnl-result {\n display: flex;\n justify-content: center;\n gap: 2rem;\n margin-top: 1rem;\n font-size: 1.5rem;\n font-weight: 600;\n}\n\nfooter {\n text-align: center;\n padding: 2rem;\n color: #636e72;\n}\n\n@media (max-width: 768px) {\n .calculator-container {\n margin: 1rem;\n padding: 1rem;\n }\n \n .trade-entry {\n grid-template-columns: 1fr 1fr;\n }\n \n .remove-trade {\n grid-column: span 2;\n width: 100%;\n }\n}\n\n---script.js---\ndocument.addEventListener('DOMContentLoaded', () => {\n const addTradeBtn = document.getElementById('add-trade');\n const tradesContainer = document.getElementById('trades-container');\n \n // Add event listeners\n addTradeBtn.addEventListener('click', addTrade);\n document.addEventListener('input', calculateResults);\n \n function addTrade() {\n const tradeEntry = document.createElement('div');\n tradeEntry.className = 'trade-entry';\n tradeEntry.innerHTML = `\n \n \n \n `;\n \n tradeEntry.querySelector('.remove-trade').addEventListener('click', () => {\n tradeEntry.remove();\n calculateResults();\n });\n \n tradesContainer.appendChild(tradeEntry);\n }\n \n function calculateResults() {\n const leverage = parseFloat(document.getElementById('leverage').value) || 0;\n const margin = parseFloat(document.getElementById('margin').value) || 0;\n const trades = document.querySelectorAll('.trade-entry');\n \n let totalSize = 0;\n let weightedPrice = 0;\n \n trades.forEach(trade => {\n const price = parseFloat(trade.querySelector('.entry-price').value) || 0;\n const size = parseFloat(trade.querySelector('.position-size').value) || 0;\n \n totalSize += size;\n weightedPrice += price * size;\n });\n \n const avgEntry = totalSize > 0 ? weightedPrice / totalSize : 0;\n const liquidationPrice = calculateLiquidationPrice(avgEntry, leverage, true);\n \n // Update results\n document.getElementById('avg-entry').textContent = avgEntry.toFixed(2);\n document.getElementById('total-size').textContent = totalSize.toFixed(2);\n document.getElementById('liquidation').textContent = liquidationPrice.toFixed(2);\n \n calculatePNL(avgEntry, totalSize);\n }\n \n function calculateLiquidationPrice(entryPrice, leverage, isLong) {\n const maintenanceMargin = 0.005; // 0.5%\n const fee = 0.0005; // 0.05%\n \n if (isLong) {\n return entryPrice * (1 - (1 / leverage) + maintenanceMargin + fee);\n } else {\n return entryPrice * (1 + (1 / leverage) - maintenanceMargin - fee);\n }\n }\n \n function calculatePNL(avgEntry, totalSize) {\n const exitPrice = parseFloat(document.getElementById('exit-price').value) || 0;\n \n if (exitPrice && avgEntry && totalSize) {\n const pnl = (exitPrice - avgEntry) * totalSize;\n const pnlPercentage = ((exitPrice - avgEntry) / avgEntry) * 100;\n \n document.getElementById('pnl-amount').textContent = `$${pnl.toFixed(2)}`;\n document.getElementById('pnl-percentage').textContent = `${pnlPercentage.toFixed(2)}%`;\n }\n }\n \n // Initialize with one trade entry\n addTrade();\n});\n\n---end---\n\nThis implementation creates a beautiful, responsive crypto futures calculator with a modern design and smooth animations. It includes all requested features:\n- Multiple trade entry calculation\n- Average price calculation\n- PNL calculation\n- Liquidation price calculation\n- Position sizing in USD\n- Leverage adjustment\n\nThe UI is clean and intuitive, with a gradient header, card-based layout, and responsive design that works well on all devices. The calculator updates in real-time as users input values, and includes smooth animations for better user experience."
+ }
+ ],
+ "stop_reason": "end_turn",
+ "stop_sequence": null,
+ "usage": {
+ "input_tokens": 356,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 0,
+ "output_tokens": 3005
+ }
+ }
readme.scroll
Changed around line 1
+ # cryptocalc1.scroll.pub
+ Website generated by Claude from prompt: Build a calculator for crypto futures that can calculate average price, PNL's and Liquidation Key Features Average price for Multiple trades at different price levels Accurate Sizing in USD after multiple trades in a single asset Calculated PNL's and Liquidations with same features Idea is to create a perfect/Suitable calculator for Concentrated Bets Easy to calculate possible trades PNL and other data
script.js
Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const addTradeBtn = document.getElementById('add-trade');
+ const tradesContainer = document.getElementById('trades-container');
+
+ // Add event listeners
+ addTradeBtn.addEventListener('click', addTrade);
+ document.addEventListener('input', calculateResults);
+
+ function addTrade() {
+ const tradeEntry = document.createElement('div');
+ tradeEntry.className = 'trade-entry';
+ tradeEntry.innerHTML = `
+
+
+
+ `;
+
+ tradeEntry.querySelector('.remove-trade').addEventListener('click', () => {
+ tradeEntry.remove();
+ calculateResults();
+ });
+
+ tradesContainer.appendChild(tradeEntry);
+ }
+
+ function calculateResults() {
+ const leverage = parseFloat(document.getElementById('leverage').value) || 0;
+ const margin = parseFloat(document.getElementById('margin').value) || 0;
+ const trades = document.querySelectorAll('.trade-entry');
+
+ let totalSize = 0;
+ let weightedPrice = 0;
+
+ trades.forEach(trade => {
+ const price = parseFloat(trade.querySelector('.entry-price').value) || 0;
+ const size = parseFloat(trade.querySelector('.position-size').value) || 0;
+
+ totalSize += size;
+ weightedPrice += price * size;
+ });
+
+ const avgEntry = totalSize > 0 ? weightedPrice / totalSize : 0;
+ const liquidationPrice = calculateLiquidationPrice(avgEntry, leverage, true);
+
+ // Update results
+ document.getElementById('avg-entry').textContent = avgEntry.toFixed(2);
+ document.getElementById('total-size').textContent = totalSize.toFixed(2);
+ document.getElementById('liquidation').textContent = liquidationPrice.toFixed(2);
+
+ calculatePNL(avgEntry, totalSize);
+ }
+
+ function calculateLiquidationPrice(entryPrice, leverage, isLong) {
+ const maintenanceMargin = 0.005; // 0.5%
+ const fee = 0.0005; // 0.05%
+
+ if (isLong) {
+ return entryPrice * (1 - (1 / leverage) + maintenanceMargin + fee);
+ } else {
+ return entryPrice * (1 + (1 / leverage) - maintenanceMargin - fee);
+ }
+ }
+
+ function calculatePNL(avgEntry, totalSize) {
+ const exitPrice = parseFloat(document.getElementById('exit-price').value) || 0;
+
+ if (exitPrice && avgEntry && totalSize) {
+ const pnl = (exitPrice - avgEntry) * totalSize;
+ const pnlPercentage = ((exitPrice - avgEntry) / avgEntry) * 100;
+
+ document.getElementById('pnl-amount').textContent = `$${pnl.toFixed(2)}`;
+ document.getElementById('pnl-percentage').textContent = `${pnlPercentage.toFixed(2)}%`;
+ }
+ }
+
+ // Initialize with one trade entry
+ addTrade();
+ });
style.css
Changed around line 1
+ :root {
+ --primary-color: #6c5ce7;
+ --secondary-color: #a8a4e6;
+ --background: #f8f9fd;
+ --text-color: #2d3436;
+ --border-radius: 12px;
+ --shadow: 0 8px 30px rgba(0,0,0,0.12);
+ }
+
+ * {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ }
+
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
+ background: var(--background);
+ color: var(--text-color);
+ line-height: 1.6;
+ }
+
+ header {
+ text-align: center;
+ padding: 3rem 1rem;
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
+ color: white;
+ }
+
+ h1 {
+ font-size: 2.5rem;
+ margin-bottom: 0.5rem;
+ }
+
+ .tagline {
+ font-size: 1.1rem;
+ opacity: 0.9;
+ }
+
+ .calculator-container {
+ max-width: 1000px;
+ margin: 2rem auto;
+ padding: 2rem;
+ background: white;
+ border-radius: var(--border-radius);
+ box-shadow: var(--shadow);
+ }
+
+ .input-section, .trades-section, .results-section {
+ margin-bottom: 2rem;
+ }
+
+ h2 {
+ color: var(--primary-color);
+ margin-bottom: 1.5rem;
+ }
+
+ .input-group {
+ margin-bottom: 1rem;
+ }
+
+ label {
+ display: block;
+ margin-bottom: 0.5rem;
+ font-weight: 500;
+ }
+
+ input {
+ width: 100%;
+ padding: 0.8rem;
+ border: 2px solid #e1e1e1;
+ border-radius: var(--border-radius);
+ font-size: 1rem;
+ transition: border-color 0.3s ease;
+ }
+
+ input:focus {
+ border-color: var(--primary-color);
+ outline: none;
+ }
+
+ .trade-entry {
+ display: grid;
+ grid-template-columns: 1fr 1fr auto;
+ gap: 1rem;
+ margin-bottom: 1rem;
+ }
+
+ .remove-trade {
+ background: #ff7675;
+ color: white;
+ border: none;
+ border-radius: var(--border-radius);
+ width: 40px;
+ cursor: pointer;
+ font-size: 1.2rem;
+ }
+
+ .action-button {
+ background: var(--primary-color);
+ color: white;
+ border: none;
+ padding: 0.8rem 1.5rem;
+ border-radius: var(--border-radius);
+ cursor: pointer;
+ font-size: 1rem;
+ transition: transform 0.2s ease;
+ }
+
+ .action-button:hover {
+ transform: translateY(-2px);
+ }
+
+ .result-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ gap: 1.5rem;
+ margin-bottom: 2rem;
+ }
+
+ .result-item {
+ background: var(--background);
+ padding: 1.5rem;
+ border-radius: var(--border-radius);
+ text-align: center;
+ }
+
+ .result-item label {
+ font-size: 0.9rem;
+ color: #636e72;
+ }
+
+ .result-item span {
+ display: block;
+ font-size: 1.5rem;
+ font-weight: 600;
+ color: var(--primary-color);
+ }
+
+ .pnl-calculator {
+ background: var(--background);
+ padding: 1.5rem;
+ border-radius: var(--border-radius);
+ }
+
+ .pnl-result {
+ display: flex;
+ justify-content: center;
+ gap: 2rem;
+ margin-top: 1rem;
+ font-size: 1.5rem;
+ font-weight: 600;
+ }
+
+ footer {
+ text-align: center;
+ padding: 2rem;
+ color: #636e72;
+ }
+
+ @media (max-width: 768px) {
+ .calculator-container {
+ margin: 1rem;
+ padding: 1rem;
+ }
+
+ .trade-entry {
+ grid-template-columns: 1fr 1fr;
+ }
+
+ .remove-trade {
+ grid-column: span 2;
+ width: 100%;
+ }
+ }