Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
namibsun
python
BetBot
Commits
63e52ae8
Commit
63e52ae8
authored
Sep 18, 2020
by
Hermann Krumrey
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'master'
Fix more data fetching issues See merge request
!8
parents
4fff1047
d31f7e54
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
19 deletions
+40
-19
CHANGELOG
CHANGELOG
+4
-0
Dockerfile
Dockerfile
+1
-0
betbot/neural/data/FootballDataFetcher.py
betbot/neural/data/FootballDataFetcher.py
+25
-14
betbot/neural/data/Match.py
betbot/neural/data/Match.py
+9
-4
models/match-history/MatchHistoryTrainer.h5
models/match-history/MatchHistoryTrainer.h5
+0
-0
version
version
+1
-1
No files found.
CHANGELOG
View file @
63e52ae8
V 0.5.3:
- More oddsportal fixes
- Fixed matchday fetching of football-data
- Added pre-trained model weights
V 0.5.2:
- Fixed oddsportal int conversion issues
V 0.5.1:
...
...
Dockerfile
View file @
63e52ae8
...
...
@@ -8,6 +8,7 @@ RUN pip3 install tensorflow keras dryscrape
ADD
. bot
RUN
cd
bot
&&
python3 setup.py
install
RUN
mkdir
-p
/root/.config/betbot
&&
cp
-r
bot/models/
*
/root/.config/betbot
WORKDIR
bot
CMD
["docker_start.sh", "-v"]
betbot/neural/data/FootballDataFetcher.py
View file @
63e52ae8
...
...
@@ -125,7 +125,7 @@ class FootballDataFetcher(DataFetcher):
csv_urls
=
self
.
_load_csv_urls
([
country_enum
])
current_season
=
max
(
csv_urls
[
country
][
league
].
keys
())
now_url
=
"https://www.football-data.co.uk/
matches.php
"
now_url
=
"https://www.football-data.co.uk/
fixtures.csv
"
current_url
=
csv_urls
[
country
][
league
][
current_season
]
lower_url
=
csv_urls
[
country
][
league
+
1
][
current_season
]
previous_url
=
csv_urls
[
country
][
league
][
current_season
-
1
]
...
...
@@ -146,15 +146,23 @@ class FootballDataFetcher(DataFetcher):
with
StringIO
(
requests
.
get
(
now_url
).
text
)
as
f
:
data
=
[
x
for
x
in
csv
.
reader
(
f
)]
keys
=
data
.
pop
(
0
)
_current_matches
=
[
Match
.
from_football_data
(
{
keys
[
j
]:
data
[
i
][
j
]
for
j
in
range
(
len
(
data
))}
)
for
i
in
range
(
len
(
keys
))
if
data
[
i
][
0
]
==
league_identifier
]
current_matches
=
[
x
for
x
in
_current_matches
if
x
is
not
None
]
keys
=
[
x
.
lower
()
for
x
in
data
.
pop
(
0
)]
data
=
[
x
for
x
in
data
if
x
[
0
]
==
league_identifier
]
current_matches
=
[]
base_match_dict
=
{
"country"
:
country
,
"season"
:
str
(
current_season
),
"league"
:
str
(
league
),
"finished"
:
str
(
False
)
}
for
item
in
data
:
match_dict
=
{
keys
[
i
]:
item
[
i
]
for
i
in
range
(
len
(
keys
))}
match_dict
.
update
(
base_match_dict
)
match
=
Match
.
from_football_data
(
match_dict
)
if
match
is
not
None
:
current_matches
.
append
(
match
)
if
len
(
current_matches
)
==
0
:
retry
=
0
self
.
logger
.
info
(
"football-data not available, using oddportal"
)
...
...
@@ -256,10 +264,13 @@ class FootballDataFetcher(DataFetcher):
if
name
in
bookmakers
:
bookmaker_odds
=
[]
for
index
in
range
(
1
,
4
):
fraction
=
[
float
(
x
)
for
x
in
tds
[
index
].
text
.
split
(
"/"
)
]
odds_number
=
1.0
+
(
fraction
[
0
]
/
fraction
[
1
])
try
:
odds_number
=
float
(
tds
[
index
].
text
)
except
ValueError
:
fraction
=
[
int
(
x
)
for
x
in
tds
[
index
].
text
.
split
(
"/"
)
]
odds_number
=
1.0
+
(
fraction
[
0
]
/
fraction
[
1
])
bookmaker_odds
.
append
(
odds_number
)
bookmaker_odds_tuple
=
(
bookmaker_odds
[
0
],
bookmaker_odds
[
1
],
bookmaker_odds
[
2
]
...
...
betbot/neural/data/Match.py
View file @
63e52ae8
...
...
@@ -63,6 +63,11 @@ class Match:
except
(
KeyError
,
ValueError
):
return
None
away_ht
=
None
if
not
data
.
get
(
"htag"
)
else
int
(
data
[
"htag"
])
away_ft
=
None
if
not
data
.
get
(
"ftag"
)
else
int
(
data
[
"ftag"
])
home_ht
=
None
if
not
data
.
get
(
"hthg"
)
else
int
(
data
[
"hthg"
])
home_ft
=
None
if
not
data
.
get
(
"fthg"
)
else
int
(
data
[
"fthg"
])
return
cls
(
country
=
data
[
"country"
],
league
=
int
(
data
[
"league"
]),
...
...
@@ -71,9 +76,9 @@ class Match:
finished
=
bool
(
data
[
"finished"
]),
home_team
=
data
[
"hometeam"
],
away_team
=
data
[
"awayteam"
],
home_ht_score
=
int
(
data
[
"hthg"
])
,
home_ft_score
=
int
(
data
[
"fthg"
])
,
away_ht_score
=
int
(
data
[
"htag"
])
,
away_ft_score
=
int
(
data
[
"ftag"
])
,
home_ht_score
=
home_ht
,
home_ft_score
=
home_ft
,
away_ht_score
=
away_ht
,
away_ft_score
=
away_ft
,
bet_odds
=
bet_odds
)
models/match-history/MatchHistoryTrainer.h5
0 → 100644
View file @
63e52ae8
File added
version
View file @
63e52ae8
0.5.2
\ No newline at end of file
0.5.3
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment