Skip to content

Commit 5e1a7e3

Browse files
authored
Merge pull request #2 from AlgoETS/improvement
2 parents e3f956d + e4d628a commit 5e1a7e3

File tree

3 files changed

+72
-21
lines changed

3 files changed

+72
-21
lines changed

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# Sport-Arbitrage
2-
Surebets
1+
# Arbitrage Calculator
2+
3+
This project is a web-based Arbitrage Calculator designed to help users identify arbitrage opportunities in sports betting. The calculator allows users to input odds from different betting sites and calculates the potential arbitrage percentage, optimal stakes, total returns, and guaranteed profit.
4+
5+
## Features
6+
7+
- **Select Number of Odds**: Choose between 2 or 3 odds for your calculations.
8+
- **Input Odds**: Enter the odds for different outcomes (Win, Lost, Draw) from multiple sites.
9+
- **Calculate Arbitrage**: Determine if there is an arbitrage opportunity and calculate the relevant metrics.
10+
- **Responsive Design**: The calculator is built with Tailwind CSS for a modern, responsive design.
11+
12+
## Instructions
13+
14+
1. **Select the number of odds (2 or 3).**
15+
2. **Enter the odds values in the respective fields:**
16+
- For 2 odds: Enter values for "Win Site 1," "Lost Site 1," "Win Site 2," and "Lost Site 2."
17+
- For 3 odds: Enter values for "Win Site 1," "Lost Site 1," "Draw Site 1," "Win Site 2," "Lost Site 2," and "Draw Site 2."
18+
3. **Enter the total investment amount.**
19+
4. **Click "Calculate" to see the arbitrage opportunity, percentage, optimal stakes, total returns, and guaranteed profit.
20+
21+
## Contributing
22+
23+
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
24+
25+
## License
26+
27+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

index.html

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</head>
1212
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
1313
<div class="bg-white p-8 rounded-lg shadow-lg w-full max-w-md">
14-
<h1 class="text-2xl font-bold mb-4 text-center">Arbitrage Calculator</h1>
14+
<h1 class="text-3xl font-bold mb-6 text-center text-blue-600">Arbitrage Calculator</h1>
1515
<div class="space-y-4">
1616
<div class="input-group">
1717
<label for="numOdds" class="block text-sm font-medium text-gray-700">Number of Odds:</label>
@@ -21,24 +21,44 @@ <h1 class="text-2xl font-bold mb-4 text-center">Arbitrage Calculator</h1>
2121
</select>
2222
</div>
2323
<div class="input-group">
24-
<label for="odds1" class="block text-sm font-medium text-gray-700">Odds 1:</label>
25-
<input type="number" id="odds1" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01">
24+
<label for="odds1Win" class="block text-sm font-medium text-gray-700">Win Site 1:</label>
25+
<input type="number" id="odds1Win" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter Win Site 1 odds">
2626
</div>
2727
<div class="input-group">
28-
<label for="odds2" class="block text-sm font-medium text-gray-700">Odds 2:</label>
29-
<input type="number" id="odds2" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01">
28+
<label for="odds1Lost" class="block text-sm font-medium text-gray-700">Lost Site 1:</label>
29+
<input type="number" id="odds1Lost" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter Lost Site 1 odds">
3030
</div>
31-
<div class="input-group hidden" id="odds3-container">
32-
<label for="odds3" class="block text-sm font-medium text-gray-700">Odds 3:</label>
33-
<input type="number" id="odds3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01">
31+
<div class="input-group">
32+
<label for="odds2Win" class="block text-sm font-medium text-gray-700">Win Site 2:</label>
33+
<input type="number" id="odds2Win" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter Win Site 2 odds">
34+
</div>
35+
<div class="input-group">
36+
<label for="odds2Lost" class="block text-sm font-medium text-gray-700">Lost Site 2:</label>
37+
<input type="number" id="odds2Lost" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter Lost Site 2 odds">
38+
</div>
39+
<div class="input-group hidden" id="odds3Win-container">
40+
<label for="odds3Win" class="block text-sm font-medium text-gray-700">Draw Site 1:</label>
41+
<input type="number" id="odds3Win" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter Draw Site 1 odds">
42+
</div>
43+
<div class="input-group hidden" id="odds3Lost-container">
44+
<label for="odds3Lost" class="block text-sm font-medium text-gray-700">Draw Site 2:</label>
45+
<input type="number" id="odds3Lost" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter Draw Site 2 odds">
3446
</div>
3547
<div class="input-group">
3648
<label for="investment" class="block text-sm font-medium text-gray-700">Total Investment:</label>
37-
<input type="number" id="investment" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01">
49+
<input type="number" id="investment" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm" step="0.01" placeholder="Enter total investment">
3850
</div>
3951
<button onclick="calculateArbitrage()" class="w-full py-2 px-4 bg-blue-600 text-white rounded-md shadow hover:bg-blue-700 focus:outline-none">Calculate</button>
4052
</div>
41-
<div id="results" class="mt-4 text-gray-700"></div>
53+
<div id="results" class="mt-6 p-4 bg-gray-100 rounded-md shadow-md text-gray-700"></div>
54+
</div>
55+
<div class="mt-6 text-center text-gray-600">
56+
<p>Instructions:</p>
57+
<ol class="list-decimal list-inside text-left max-w-md mx-auto">
58+
<li>Select the number of odds (2 or 3).</li>
59+
<li>Enter the odds values and the total investment amount.</li>
60+
<li>Click "Calculate" to see the arbitrage opportunity, percentage, optimal stakes, total returns, and guaranteed profit.</li>
61+
</ol>
4262
</div>
4363
<script src="script.js"></script>
4464
</body>

script.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
function toggleOddsFields() {
22
const numOdds = document.getElementById('numOdds').value;
3-
const odds3Container = document.getElementById('odds3-container');
3+
const odds3WinContainer = document.getElementById('odds3Win-container');
4+
const odds3LostContainer = document.getElementById('odds3Lost-container');
45

56
if (numOdds == 3) {
6-
odds3Container.classList.remove('hidden');
7+
odds3WinContainer.classList.remove('hidden');
8+
odds3LostContainer.classList.remove('hidden');
79
} else {
8-
odds3Container.classList.add('hidden');
10+
odds3WinContainer.classList.add('hidden');
11+
odds3LostContainer.classList.add('hidden');
912
}
1013
}
1114

@@ -38,12 +41,15 @@ function calculateGuaranteedProfit(totalInvestment, totalReturns) {
3841
function calculateArbitrage() {
3942
const numOdds = document.getElementById('numOdds').value;
4043
const odds = [
41-
parseFloat(document.getElementById('odds1').value),
42-
parseFloat(document.getElementById('odds2').value),
44+
parseFloat(document.getElementById('odds1Win').value),
45+
parseFloat(document.getElementById('odds1Lost').value),
46+
parseFloat(document.getElementById('odds2Win').value),
47+
parseFloat(document.getElementById('odds2Lost').value)
4348
];
44-
49+
4550
if (numOdds == 3) {
46-
odds.push(parseFloat(document.getElementById('odds3').value));
51+
odds.push(parseFloat(document.getElementById('odds3Win').value));
52+
odds.push(parseFloat(document.getElementById('odds3Lost').value));
4753
}
4854

4955
const totalInvestment = parseFloat(document.getElementById('investment').value);
@@ -55,13 +61,13 @@ function calculateArbitrage() {
5561
const guaranteedProfit = calculateGuaranteedProfit(totalInvestment, totalReturns);
5662

5763
document.getElementById('results').innerHTML = `
58-
<p>Arbitrage Opportunity: Yes</p>
64+
<p class="font-bold">Arbitrage Opportunity: Yes</p>
5965
<p>Arbitrage Percentage: ${arbitragePercentage.toFixed(2)}%</p>
6066
<p>Optimal Stakes: ${optimalStakes.map(stake => stake.toFixed(2)).join(', ')}</p>
6167
<p>Total Returns: ${totalReturns.map(ret => ret.toFixed(2)).join(', ')}</p>
6268
<p>Guaranteed Profit: ${guaranteedProfit.toFixed(2)}</p>
6369
`;
6470
} else {
65-
document.getElementById('results').innerHTML = `<p>Arbitrage Opportunity: No</p>`;
71+
document.getElementById('results').innerHTML = `<p class="font-bold">Arbitrage Opportunity: No</p>`;
6672
}
6773
}

0 commit comments

Comments
 (0)