commit c6905c44ddd3b6f5931334aacae4cd550969d3bc
Author: root <root@hub.scroll.pub> Date: 2024-12-27 09:51:36 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..7f55233 --- /dev/null +++ b/body.html @@ -0,0 +1,58 @@ +<header> + <h1>Sports Arbitrage Calculator</h1> + <p class="tagline">Calculate guaranteed profits across different bookmakers</p> +</header> + +<main> + <div class="calculator-container"> + <div class="mode-switch"> + <button class="mode-btn active" data-mode="2way">2-Way</button> + <button class="mode-btn" data-mode="3way">3-Way</button> + </div> + + <div class="calculator-form"> + <div class="stake-input"> + <label for="total-stake">Total Stake</label> + <div class="input-wrapper"> + <span class="currency">$</span> + <input type="number" id="total-stake" min="0" step="0.01" placeholder="Enter stake amount"> + </div> + </div> + + <div class="odds-container"> + <div class="odds-group"> + <label>Bookmaker 1</label> + <input type="number" class="odds-input" step="0.01" min="1" placeholder="Odds"> + </div> + + <div class="odds-group"> + <label>Bookmaker 2</label> + <input type="number" class="odds-input" step="0.01" min="1" placeholder="Odds"> + </div> + + <div class="odds-group third-way hidden"> + <label>Bookmaker 3</label> + <input type="number" class="odds-input" step="0.01" min="1" placeholder="Odds"> + </div> + </div> + + <button class="calculate-btn">Calculate</button> + </div> + + <div class="results hidden"> + <h2>Results</h2> + <div class="profit-info"> + <span class="profit-label">Total Profit:</span> + <span class="profit-amount">$0.00</span> + </div> + <div class="stakes-breakdown"> + <h3>Recommended Stakes</h3> + <ul class="stakes-list"></ul> + </div> + </div> + </div> +</main> + +<footer> + <p>Built for sports arbitrage traders</p> +</footer> diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..c0de04b --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://arbi.scroll.pub +metaTags +editButton /edit.html +title Sports Arbitrage Calculator +style.css +body.html +script.js diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..3435cdb --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# arbi.scroll.pub +Website generated by Claude from prompt: A sports arbitrage calculator with impressive Ui, should work for both 3 way and 2 way games. \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..9a6cb08 --- /dev/null +++ b/script.js @@ -0,0 +1,79 @@ +document.addEventListener('DOMContentLoaded', () => { + const modeButtons = document.querySelectorAll('.mode-btn'); + const thirdWay = document.querySelector('.third-way'); + const calculateBtn = document.querySelector('.calculate-btn'); + const results = document.querySelector('.results'); + const stakesList = document.querySelector('.stakes-list'); + const profitAmount = document.querySelector('.profit-amount'); + const totalStakeInput = document.getElementById('total-stake'); + const oddsInputs = document.querySelectorAll('.odds-input'); + + let currentMode = '2way'; + + modeButtons.forEach(btn => { + btn.addEventListener('click', () => { + modeButtons.forEach(b => b.classList.remove('active')); + btn.classList.add('active'); + currentMode = btn.dataset.mode; + thirdWay.classList.toggle('hidden', currentMode === '2way'); + results.classList.add('hidden'); + }); + }); + + calculateBtn.addEventListener('click', () => { + const totalStake = parseFloat(totalStakeInput.value); + if (!totalStake || totalStake <= 0) { + alert('Please enter a valid stake amount'); + return; + } + + const odds = Array.from(oddsInputs) + .slice(0, currentMode === '2way' ? 2 : 3) + .map(input => parseFloat(input.value)) + .filter(odd => odd && odd > 1); + + if (odds.length !== (currentMode === '2way' ? 2 : 3)) { + alert('Please enter valid odds for all bookmakers'); + return; + } + + const result = calculateArbitrage(odds, totalStake); + if (!result.isArbitrage) { + alert('No arbitrage opportunity found with these odds'); + return; + } + + displayResults(result); + }); + + function calculateArbitrage(odds, totalStake) { + const impliedProbs = odds.map(odd => 1 / odd); + const totalImpliedProb = impliedProbs.reduce((sum, prob) => sum + prob, 0); + + if (totalImpliedProb >= 1) { + return { isArbitrage: false }; + } + + const profit = ((1 - totalImpliedProb) / totalImpliedProb) * totalStake; + const stakes = impliedProbs.map(prob => + (prob / totalImpliedProb) * totalStake + ); + + return { + isArbitrage: true, + profit, + stakes + }; + } + + function displayResults(result) { + results.classList.remove('hidden'); + profitAmount.textContent = `$${result.profit.toFixed(2)}`; + + stakesList.innerHTML = result.stakes + .map((stake, index) => ` + <li>Bookmaker ${index + 1}: $${stake.toFixed(2)}</li> + `) + .join(''); + } +}); diff --git a/style.css b/style.css new file mode 100644 index 0000000..85eab40 --- /dev/null +++ b/style.css @@ -0,0 +1,189 @@ +:root { + --primary-color: #2c3e50; + --accent-color: #3498db; + --success-color: #27ae60; + --error-color: #e74c3c; + --bg-color: #f8f9fa; + --text-color: #2c3e50; + --border-radius: 8px; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + color: var(--text-color); + background: var(--bg-color); + min-height: 100vh; + display: flex; + flex-direction: column; +} + +header { + background: var(--primary-color); + color: white; + padding: 2rem 1rem; + text-align: center; +} + +.tagline { + opacity: 0.8; + font-size: 1.1rem; + margin-top: 0.5rem; +} + +main { + flex: 1; + padding: 2rem 1rem; + max-width: 800px; + margin: 0 auto; + width: 100%; +} + +.calculator-container { + background: white; + border-radius: var(--border-radius); + padding: 2rem; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +.mode-switch { + display: flex; + gap: 1rem; + margin-bottom: 2rem; + justify-content: center; +} + +.mode-btn { + padding: 0.5rem 1.5rem; + border: 2px solid var(--accent-color); + background: none; + color: var(--accent-color); + border-radius: var(--border-radius); + cursor: pointer; + transition: all 0.3s ease; +} + +.mode-btn.active { + background: var(--accent-color); + color: white; +} + +.calculator-form { + display: flex; + flex-direction: column; + gap: 1.5rem; +} + +.stake-input { + margin-bottom: 1rem; +} + +.input-wrapper { + position: relative; + display: flex; + align-items: center; +} + +.currency { + position: absolute; + left: 1rem; + color: var(--text-color); +} + +input { + width: 100%; + padding: 0.8rem; + padding-left: 2rem; + border: 2px solid #ddd; + border-radius: var(--border-radius); + font-size: 1rem; + transition: border-color 0.3s ease; +} + +input:focus { + outline: none; + border-color: var(--accent-color); +} + +.odds-container { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 1rem; +} + +.odds-group { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.calculate-btn { + background: var(--accent-color); + color: white; + padding: 1rem; + border: none; + border-radius: var(--border-radius); + font-size: 1.1rem; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.calculate-btn:hover { + background: #2980b9; +} + +.results { + margin-top: 2rem; + padding-top: 2rem; + border-top: 2px solid #eee; +} + +.profit-info { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 1.2rem; + margin: 1rem 0; + padding: 1rem; + background: #f8f9fa; + border-radius: var(--border-radius); +} + +.profit-amount { + color: var(--success-color); + font-weight: bold; +} + +.stakes-list { + list-style: none; + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.hidden { + display: none; +} + +footer { + text-align: center; + padding: 2rem; + background: var(--primary-color); + color: white; +} + +@media (max-width: 600px) { + .calculator-container { + padding: 1rem; + } + + .odds-container { + grid-template-columns: 1fr; + } +}