confpickem 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- confpickem-0.1.0/.github/workflows/publish.yml +28 -0
- confpickem-0.1.0/.github/workflows/test.yml +28 -0
- confpickem-0.1.0/.gitignore +28 -0
- confpickem-0.1.0/LICENSE +21 -0
- confpickem-0.1.0/PKG-INFO +110 -0
- confpickem-0.1.0/README.md +73 -0
- confpickem-0.1.0/conftest.py +6 -0
- confpickem-0.1.0/examples/pickem_example.py +76 -0
- confpickem-0.1.0/examples/yahoo_pickem_demo.ipynb +2057 -0
- confpickem-0.1.0/pyproject.toml +80 -0
- confpickem-0.1.0/src/confpickem/__init__.py +48 -0
- confpickem-0.1.0/src/confpickem/confidence_pickem_sim.py +467 -0
- confpickem-0.1.0/src/confpickem/yahoo_pickem_integration.py +219 -0
- confpickem-0.1.0/src/confpickem/yahoo_pickem_scraper.py +355 -0
- confpickem-0.1.0/tests/__init__.py +0 -0
- confpickem-0.1.0/tests/test_confidence_pickem_sim.py +193 -0
- confpickem-0.1.0/tests/test_yahoo_pickem_scraper.py +499 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
deploy:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v4
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.x"
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install --upgrade pip
|
|
22
|
+
pip install build
|
|
23
|
+
- name: Build package
|
|
24
|
+
run: python -m build
|
|
25
|
+
- name: Publish package
|
|
26
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
27
|
+
with:
|
|
28
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
push:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v4
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install ".[dev]"
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: |
|
|
28
|
+
pytest
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
.cache/
|
|
3
|
+
.vscode/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
*.so
|
|
7
|
+
.Python
|
|
8
|
+
build/
|
|
9
|
+
develop-eggs/
|
|
10
|
+
dist/
|
|
11
|
+
downloads/
|
|
12
|
+
eggs/
|
|
13
|
+
.eggs/
|
|
14
|
+
lib/
|
|
15
|
+
lib64/
|
|
16
|
+
parts/
|
|
17
|
+
sdist/
|
|
18
|
+
var/
|
|
19
|
+
wheels/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
.installed.cfg
|
|
22
|
+
*.egg
|
|
23
|
+
.pytest_cache/
|
|
24
|
+
.coverage
|
|
25
|
+
htmlcov/
|
|
26
|
+
cookies.txt
|
|
27
|
+
.DS_Store
|
|
28
|
+
**/.DS_Store
|
confpickem-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Taylor Firman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: confpickem
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Simulation-based tool to analyze Confidence Pick Em pools
|
|
5
|
+
Project-URL: Repository, https://github.com/tefirman/confpickem
|
|
6
|
+
Project-URL: Documentation, https://github.com/tefirman/confpickem#readme
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/tefirman/confpickem/issues
|
|
8
|
+
Author-email: Taylor Firman <tefirman@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: confidence-pool,fantasy-sports,football,nfl,pick-em
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Games/Entertainment
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Requires-Dist: beautifulsoup4>=4.9.0
|
|
26
|
+
Requires-Dist: numpy>=1.19.0
|
|
27
|
+
Requires-Dist: pandas>=1.2.0
|
|
28
|
+
Requires-Dist: requests>=2.25.0
|
|
29
|
+
Requires-Dist: scipy>=1.6.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: black>=21.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: flake8>=3.9.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy>=0.900; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov>=2.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=6.0.0; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# confpickem - Yahoo NFL Confidence Pick'em Analyzer
|
|
39
|
+
|
|
40
|
+
A Python package for analyzing and optimizing picks for Yahoo NFL Confidence Pick'em pools. This package provides tools for:
|
|
41
|
+
|
|
42
|
+
- Scraping Yahoo Pick'em league data
|
|
43
|
+
- Analyzing pick distributions and trends
|
|
44
|
+
- Simulating outcomes and optimizing picks
|
|
45
|
+
- Evaluating different picking strategies
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
You can install the package using pip:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install confpickem
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from confpickem import YahooPickEm, ConfidencePickEmSimulator, run_simulation
|
|
59
|
+
|
|
60
|
+
# Initialize scraper with your league info
|
|
61
|
+
yahoo = YahooPickEm(
|
|
62
|
+
week=1,
|
|
63
|
+
league_id=YOUR_LEAGUE_ID,
|
|
64
|
+
cookies_file='cookies.txt'
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Run simulation with actual picks
|
|
68
|
+
simulator, stats = run_simulation(yahoo)
|
|
69
|
+
|
|
70
|
+
# Print expected points and win percentages
|
|
71
|
+
print("\nExpected Points by Player:")
|
|
72
|
+
print(stats['expected_points'])
|
|
73
|
+
print("\nWin Percentages:")
|
|
74
|
+
print(stats['win_pct'])
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
### Yahoo Data Scraping
|
|
80
|
+
- Scrape pick distributions and crowd confidence levels
|
|
81
|
+
- Track actual picks and results from your league
|
|
82
|
+
- Cache responses to avoid excessive requests
|
|
83
|
+
|
|
84
|
+
### Simulation and Analysis
|
|
85
|
+
- Monte Carlo simulation of game outcomes
|
|
86
|
+
- Player skill modeling and analysis
|
|
87
|
+
- Pick optimization algorithms
|
|
88
|
+
- Risk/reward analysis
|
|
89
|
+
|
|
90
|
+
### Strategy Optimization
|
|
91
|
+
- Evaluate different picking strategies
|
|
92
|
+
- Optimize confidence point assignments
|
|
93
|
+
- Analyze pick correlations and game importance
|
|
94
|
+
|
|
95
|
+
## Dependencies
|
|
96
|
+
|
|
97
|
+
- Python ≥ 3.8
|
|
98
|
+
- requests
|
|
99
|
+
- pandas
|
|
100
|
+
- numpy
|
|
101
|
+
- beautifulsoup4
|
|
102
|
+
- scipy
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# confpickem - Yahoo NFL Confidence Pick'em Analyzer
|
|
2
|
+
|
|
3
|
+
A Python package for analyzing and optimizing picks for Yahoo NFL Confidence Pick'em pools. This package provides tools for:
|
|
4
|
+
|
|
5
|
+
- Scraping Yahoo Pick'em league data
|
|
6
|
+
- Analyzing pick distributions and trends
|
|
7
|
+
- Simulating outcomes and optimizing picks
|
|
8
|
+
- Evaluating different picking strategies
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
You can install the package using pip:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install confpickem
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from confpickem import YahooPickEm, ConfidencePickEmSimulator, run_simulation
|
|
22
|
+
|
|
23
|
+
# Initialize scraper with your league info
|
|
24
|
+
yahoo = YahooPickEm(
|
|
25
|
+
week=1,
|
|
26
|
+
league_id=YOUR_LEAGUE_ID,
|
|
27
|
+
cookies_file='cookies.txt'
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Run simulation with actual picks
|
|
31
|
+
simulator, stats = run_simulation(yahoo)
|
|
32
|
+
|
|
33
|
+
# Print expected points and win percentages
|
|
34
|
+
print("\nExpected Points by Player:")
|
|
35
|
+
print(stats['expected_points'])
|
|
36
|
+
print("\nWin Percentages:")
|
|
37
|
+
print(stats['win_pct'])
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
### Yahoo Data Scraping
|
|
43
|
+
- Scrape pick distributions and crowd confidence levels
|
|
44
|
+
- Track actual picks and results from your league
|
|
45
|
+
- Cache responses to avoid excessive requests
|
|
46
|
+
|
|
47
|
+
### Simulation and Analysis
|
|
48
|
+
- Monte Carlo simulation of game outcomes
|
|
49
|
+
- Player skill modeling and analysis
|
|
50
|
+
- Pick optimization algorithms
|
|
51
|
+
- Risk/reward analysis
|
|
52
|
+
|
|
53
|
+
### Strategy Optimization
|
|
54
|
+
- Evaluate different picking strategies
|
|
55
|
+
- Optimize confidence point assignments
|
|
56
|
+
- Analyze pick correlations and game importance
|
|
57
|
+
|
|
58
|
+
## Dependencies
|
|
59
|
+
|
|
60
|
+
- Python ≥ 3.8
|
|
61
|
+
- requests
|
|
62
|
+
- pandas
|
|
63
|
+
- numpy
|
|
64
|
+
- beautifulsoup4
|
|
65
|
+
- scipy
|
|
66
|
+
|
|
67
|
+
## Contributing
|
|
68
|
+
|
|
69
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*-coding:utf-8 -*-
|
|
3
|
+
'''
|
|
4
|
+
@File : confidence_pickem_example.py
|
|
5
|
+
@Time : 2024/12/09 14:30:00
|
|
6
|
+
@Author : Example Author
|
|
7
|
+
@Version : 1.0
|
|
8
|
+
@Desc : Example usage of ConfidencePickEmSimulator
|
|
9
|
+
'''
|
|
10
|
+
|
|
11
|
+
import sys
|
|
12
|
+
sys.path.append("../src/confpickem/")
|
|
13
|
+
from confidence_pickem_sim import ConfidencePickEmSimulator, Player, Game
|
|
14
|
+
import pandas as pd
|
|
15
|
+
|
|
16
|
+
def main():
|
|
17
|
+
# Initialize simulator with 10,000 simulations
|
|
18
|
+
simulator = ConfidencePickEmSimulator(num_sims=10000)
|
|
19
|
+
|
|
20
|
+
# Create sample games data
|
|
21
|
+
games_data = pd.DataFrame({
|
|
22
|
+
'home_team': ['KC', 'DAL', 'SF', 'PHI', 'BUF'],
|
|
23
|
+
'away_team': ['LV', 'NYG', 'SEA', 'MIN', 'NYJ'],
|
|
24
|
+
'vegas_win_prob': [0.75, 0.68, 0.72, 0.65, 0.70],
|
|
25
|
+
'crowd_home_pick_pct': [0.82, 0.75, 0.78, 0.70, 0.73],
|
|
26
|
+
'crowd_home_confidence': [13.2, 11.5, 12.8, 10.5, 11.8],
|
|
27
|
+
'crowd_away_confidence': [4.5, 5.2, 4.8, 6.2, 5.5],
|
|
28
|
+
'week': [14, 14, 14, 14, 14],
|
|
29
|
+
'actual_outcome': [None, None, None, None, None] # None for games not yet played
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
# Load games into simulator
|
|
33
|
+
simulator.add_games_from_dataframe(games_data)
|
|
34
|
+
|
|
35
|
+
# Add players with different characteristics
|
|
36
|
+
simulator.players = [
|
|
37
|
+
Player("Expert Player", skill_level=0.9, crowd_following=0.2, confidence_following=0.3),
|
|
38
|
+
Player("Crowd Follower", skill_level=0.5, crowd_following=0.9, confidence_following=0.8),
|
|
39
|
+
Player("Average Joe", skill_level=0.5, crowd_following=0.5, confidence_following=0.5),
|
|
40
|
+
Player("Contrarian", skill_level=0.7, crowd_following=0.1, confidence_following=0.4)
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
# Run each of the individual pieces...
|
|
44
|
+
picks_df = simulator.simulate_picks()
|
|
45
|
+
outcomes = simulator.simulate_outcomes()
|
|
46
|
+
stats = simulator.analyze_results(picks_df, outcomes)
|
|
47
|
+
|
|
48
|
+
# ... or run them all in one function
|
|
49
|
+
stats = simulator.simulate_all()
|
|
50
|
+
|
|
51
|
+
# Print summary statistics
|
|
52
|
+
print("\nExpected Points by Player:")
|
|
53
|
+
print(stats['expected_points'])
|
|
54
|
+
|
|
55
|
+
print("\nWin Percentages:")
|
|
56
|
+
print(stats['win_pct'])
|
|
57
|
+
|
|
58
|
+
print("\nPoint Standard Deviations:")
|
|
59
|
+
print(stats['point_std'])
|
|
60
|
+
|
|
61
|
+
print("\nValue at Risk (5th percentile):")
|
|
62
|
+
print(stats['value_at_risk'])
|
|
63
|
+
|
|
64
|
+
# Optimize picks for Expert Player
|
|
65
|
+
print("\nOptimal Picks for Expert Player:")
|
|
66
|
+
optimal_picks = simulator.optimize_picks()
|
|
67
|
+
print(optimal_picks)
|
|
68
|
+
|
|
69
|
+
# Example with some fixed picks
|
|
70
|
+
fixed_picks = {'PHI': 5, 'BUF': 4} # Force PHI with 5 points and BUF with 4 points
|
|
71
|
+
print("\nOptimal Picks with Fixed Selections:")
|
|
72
|
+
optimal_picks_fixed = simulator.optimize_picks(fixed_picks)
|
|
73
|
+
print(optimal_picks_fixed)
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
main()
|