-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed537e0
commit 2f86d8b
Showing
3 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,47 @@ | ||
import { BaseAnalyser } from ".."; | ||
import { getConfig } from "../../.."; | ||
import { ThreeWayGameEventEntity } from "../../../datastores/postgres/entities"; | ||
|
||
const {logger} = getConfig(); | ||
|
||
export class ThreeWayAnalyzer extends BaseAnalyser { | ||
public async getData() { | ||
const gameEventsWithEv: {clubAWinEv: number, clubBWinEv: number, drawEv: number, event: ThreeWayGameEventEntity}[] = []; | ||
|
||
const getEventDataResult = await this.getThreeWayGameEventData(); | ||
|
||
if (getEventDataResult.result === "error") { | ||
logger.error("Error while fetching event data: ", getEventDataResult.value.message); | ||
return; | ||
} | ||
|
||
getEventDataResult.value.map(async event => { | ||
const matchingEvents = await this.getMatchingThreeWayGameEvents(event); | ||
const results = await getEventDataResult.value.map(async event => { | ||
const getMatchingEventsResult = await this.getMatchingThreeWayGameEvents(event); | ||
logger.info("Event: ", event); | ||
logger.info("Matching events: ", matchingEvents); | ||
logger.info("Matching events: ", getMatchingEventsResult); | ||
|
||
if (getMatchingEventsResult.result === "success" && getMatchingEventsResult.value !== null) { | ||
getMatchingEventsResult.value.forEach(gameEvent => { | ||
const clubAWinTrueProbability = (1 / event.odds_a_win); | ||
const clubBWinTrueProbability = (1 / event.odds_b_win); | ||
const drawTrueProbability = (1 / event.odds_draw); | ||
|
||
const clubAWinEv = this.getEventEvPercent(clubAWinTrueProbability, gameEvent.odds_a_win); | ||
const clubBWinEv = this.getEventEvPercent(clubBWinTrueProbability, gameEvent.odds_b_win); | ||
const drawEv = this.getEventEvPercent(drawTrueProbability, gameEvent.odds_draw); | ||
|
||
gameEventsWithEv.push({ | ||
clubAWinEv, | ||
clubBWinEv, | ||
drawEv, | ||
event: gameEvent | ||
}); | ||
}); | ||
} | ||
}); | ||
|
||
await Promise.all(results); | ||
logger.info("Game events with EV: ", gameEventsWithEv); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,43 @@ | ||
import { BaseAnalyser } from ".."; | ||
import { getConfig } from "../../.."; | ||
import { TwoWayGameEventEntity } from "../../../datastores/postgres/entities"; | ||
|
||
const {logger} = getConfig(); | ||
|
||
export class TwoWayAnalyser extends BaseAnalyser { | ||
public async getData(): Promise<void> { | ||
const gameEventsWithEv: {clubAWinEv: Number, clubBWinEv: number, event: TwoWayGameEventEntity}[] = []; | ||
|
||
const getEventDataResult = await this.getTwoWayGameEventData(); | ||
|
||
if (getEventDataResult.result === "error") { | ||
logger.error("Error while fetching event data: ", getEventDataResult.value.message); | ||
return; | ||
} | ||
|
||
getEventDataResult.value.map(async event => { | ||
const matchingEvents = await this.getMatchingTwoWayGameEvents(event); | ||
const results = await getEventDataResult.value.map(async event => { | ||
const getMatchingEventsResult = await this.getMatchingTwoWayGameEvents(event); | ||
logger.info("Event: ", event); | ||
logger.info("Matching events: ", matchingEvents); | ||
logger.info("Matching events: ", getMatchingEventsResult); | ||
|
||
if (getMatchingEventsResult.result === "success" && getMatchingEventsResult.value !== null) { | ||
getMatchingEventsResult.value.forEach(gameEvent => { | ||
const clubAWinTrueProbability = (1 / event.odds_a_win); | ||
const clubBWinTrueProbability = (1 / event.odds_b_win); | ||
|
||
const clubAWinEv = this.getEventEvPercent(clubAWinTrueProbability, gameEvent.odds_a_win); | ||
const clubBWinEv = this.getEventEvPercent(clubBWinTrueProbability, gameEvent.odds_b_win); | ||
|
||
gameEventsWithEv.push({ | ||
clubAWinEv, | ||
clubBWinEv, | ||
event: gameEvent | ||
}); | ||
}); | ||
} | ||
}); | ||
|
||
await Promise.all(results); | ||
logger.info("Game events with EV: ", gameEventsWithEv); | ||
} | ||
} |