-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.txt
69 lines (56 loc) · 3.55 KB
/
todo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# DONE Rosters https://api.sleeper.app/v1/league/650130288072040448/rosters
# DONE Users: https://api.sleeper.app/v1/league/650130288072040448/users
DONE COMBINE Rosters & Users to be readable - done
------------------------
AFTER DRAFT: https://api.sleeper.app/v1/draft/<draft_id>
All drafts for lg: https://api.sleeper.app/v1/league/650130288072040448/drafts --> 2021 is 650130288072040449?
that draft https://api.sleeper.app/v1/draft/650130288072040449/picks
1. Save draft data to json file
2. Run parse_draft.py -o <output file>
to extract, prepare usable data
------------------------
BEFORE SEASON
1. Run get_users.py -o <output file>
to get owners -> Save to ...data/2022/users.json
Ex: "97088838635503616": {"display_name": "Tim_Terry", "team_name": "Vegas Vipers"},
------------------------
AFTER DRAFT
1. Download draft data from url, save as json - to data/2022/draft-2022.json
Ex: https://api.sleeper.app/v1/draft/650130288072040449/picks
Ex: {"round":1,"roster_id":1,"player_id":"6794","picked_by":"378716407027937280","pick_no":1,"metadata":{"years_exp":"2","team":"MIN","status":"Active","sport":"nfl","slot":"1","position":"WR","player_id":"6794","number":"18","news_updated":"1646327726661","last_name":"Jefferson","injury_status":"","first_name":"Justin","amount":"10"},"is_keeper":false,"draft_slot":1,"draft_id":"787796366440124417"}
2. Run parse_draft.py -o data/2022/parsed_draft.json to create a consumable json
Ex: {'6794': {'type': 'draft', 'roster_id': 1, 'price': '10', 'date': 'Sep 1, 2022'}, '6803':
------------------------
TO UPDATE
1. Download player pool from URL, save as json (huge file) -> Save to ...
https://api.sleeper.app/v1/players/nfl
2. Run parse_players.py -o <output file> <full players file from step 1>
to reduce pool to usable json file -> Save to data/2022/parsed_players.json
Ex: {"5870": {"positions": ["QB"], "team": "NYG", "full_name": "Daniel Jones"}, ...
3. Run get_rosters.py -o <output file>
to get current roster (looks ok 2022-11-02)
Gets data direct from URL
output is dict w key = owner_id, value = player id list
- write to data/2022/rosters-<date>.json
Ex: [{"owner_id": "378716407027937280", "roster_id": 1, "players": ["1466", "1476", "1825", "4035", "4098", "421", "4881", "5955", "6083", "6786", "6794", "6803", "6945", "6955", "7525", "7571", "7611", "8121", "8137", "8148", "NE"]},
4. Run get_transactions.py -o <output file>
(gets entire year) - gets waiver claims & prices, merge w draft, sort in dollar order desc
Key = player_id, list of transaction dicts sorted by price hi to low,
each transaction dict has entries for date, price, roster_id, type (draft/waiver) -
merges transactions and drafts, putting results per player in reverse order of price
- write to data/2022/transactions.xlsx
Ex: {"1067": [{"date": "Sep 1, 2022", "price": 1, "roster_id": 5, "type": "draft"}], "1166":
5. Run final.py -o <output file>
to merge teams, rosters and transactions
transactions have key=player_id value = list of transaction dicts sorted in reverse price order
value transaction ids have roster_id
to get rosters, players & curr salaries
read in user data/2022/users.json
read in parsed_player data/2022/parsed_players.json
read in roster data data/2022/rosters-<date>.json
read in transaction data/2022/transactions.json
----
POST 2023 to do's
1. Put year & league id into a config file
2. Have all scripts based off config file
3. Change scripts so you don't have to ever update them in or between seasons