diff --git a/src/core/analysis/index.ts b/src/core/analysis/index.ts index 0766982..59d6bb0 100644 --- a/src/core/analysis/index.ts +++ b/src/core/analysis/index.ts @@ -23,7 +23,7 @@ export class BaseAnalyser { protected getEventEvPercent(probabilityOfEvent: number, oddsForEvent: number): number { const theoreticalStake = 10; const evAsNumber = (this.getWinnings(theoreticalStake, oddsForEvent) * probabilityOfEvent) - (theoreticalStake * (1-probabilityOfEvent)); - return evAsNumber; // TODO: Return as a percentage + return (evAsNumber / theoreticalStake) * 100; // TODO: Return as a percentage } /** * Get two way game events that can be analyzed. diff --git a/src/core/analysis/three_way/index.ts b/src/core/analysis/three_way/index.ts index 156b5c1..f7dbc69 100644 --- a/src/core/analysis/three_way/index.ts +++ b/src/core/analysis/three_way/index.ts @@ -6,7 +6,7 @@ const {logger} = getConfig(); export class ThreeWayAnalyzer extends BaseAnalyser { public async getData() { - const gameEventsWithEv: {clubAWinEv: number, clubBWinEv: number, drawEv: number, event: ThreeWayGameEventEntity}[] = []; + const gameEventsWithEv: {clubAWinEv: number, clubBWinEv: number, drawEv: number, event: ThreeWayGameEventEntity, trueEvent: ThreeWayGameEventEntity}[] = []; const getEventDataResult = await this.getThreeWayGameEventData(); @@ -34,7 +34,8 @@ export class ThreeWayAnalyzer extends BaseAnalyser { clubAWinEv, clubBWinEv, drawEv, - event: gameEvent + event: gameEvent, + trueEvent: event }); }); } diff --git a/src/datastores/postgres/queries/three_way_game_event/index.ts b/src/datastores/postgres/queries/three_way_game_event/index.ts index 4973f5d..6252b5f 100644 --- a/src/datastores/postgres/queries/three_way_game_event/index.ts +++ b/src/datastores/postgres/queries/three_way_game_event/index.ts @@ -60,14 +60,13 @@ export const getMatchingThreeWayGameEventsTrigram = async ( dataSource: DataSource, event: ThreeWayGameEventEntity ): Promise => { - //@ts-ignore const currentDate = moment().format(); const results = await dataSource.createQueryBuilder() .select("three_way_game_event") .from(ThreeWayGameEventEntity, "three_way_game_event") - //.where("estimated_start_time_utc > :currentDate", {currentDate: currentDate}) TODO: Add before final commit - .where("bet_provider_name != :betProviderName", {betProviderName: event.bet_provider_name}) + .where("estimated_start_time_utc > :currentDate", {currentDate: currentDate}) + .andWhere("bet_provider_name != :betProviderName", {betProviderName: event.bet_provider_name}) .andWhere("similarity(club_a, :clubAName) > 0.2", {clubAName: event.club_a}) .andWhere("similarity(club_b, :clubBName) > 0.2", {clubBName: event.club_b}) .getMany(); diff --git a/src/datastores/postgres/queries/two_way_game_event/index.ts b/src/datastores/postgres/queries/two_way_game_event/index.ts index 8cc5942..b961d7f 100644 --- a/src/datastores/postgres/queries/two_way_game_event/index.ts +++ b/src/datastores/postgres/queries/two_way_game_event/index.ts @@ -62,14 +62,13 @@ export const getMatchingTwoWayGameEventsTrigram = async ( dataSource: DataSource, event: TwoWayGameEventEntity ): Promise => { - //@ts-ignore const currentDate = moment().format(); const results = await dataSource.createQueryBuilder() .select("two_way_game_event") .from(TwoWayGameEventEntity, "two_way_game_event") - //.where("estimated_start_time_utc > :currentDate", {currentDate: currentDate}) TODO: Add before final commit - .where("bet_provider_name != :betProviderName", {betProviderName: event.bet_provider_name}) + .where("estimated_start_time_utc > :currentDate", {currentDate: currentDate}) + .andWhere("bet_provider_name != :betProviderName", {betProviderName: event.bet_provider_name}) .andWhere("similarity(club_a, :clubAName) > 0.2", {clubAName: event.club_a}) .andWhere("similarity(club_b, :clubBName) > 0.2", {clubBName: event.club_b}) .getMany(); diff --git a/src/testbed/testbed_1.ts b/src/testbed/testbed_1.ts index 4b36a58..ef7260c 100644 --- a/src/testbed/testbed_1.ts +++ b/src/testbed/testbed_1.ts @@ -1,4 +1,4 @@ -import { BetikaScrapper } from "../core/scrapping/betika"; +import { OrbitScrapper } from "../core/scrapping/orbit"; -const scrapper = new BetikaScrapper(); +const scrapper = new OrbitScrapper(); scrapper.fetchData(); diff --git a/src/testbed/testbed_2.ts b/src/testbed/testbed_2.ts index cc1fb39..8577af2 100644 --- a/src/testbed/testbed_2.ts +++ b/src/testbed/testbed_2.ts @@ -1,4 +1,4 @@ -import { BetikaParser } from "../core/parsers/betika"; +import { OrbitParser } from "../core/parsers/orbit"; -const parser = new BetikaParser() +const parser = new OrbitParser() parser.subscribeToChannels(); diff --git a/src/testbed/testbed_3.ts b/src/testbed/testbed_3.ts index cd55820..415c4ae 100644 --- a/src/testbed/testbed_3.ts +++ b/src/testbed/testbed_3.ts @@ -1,4 +1,4 @@ -import { BetikaGameEventsProcessor } from "../core/game_events/betika"; +import { OrbitGameEventsProcessor } from "../core/game_events/orbit"; -const gameEventsProcessor = new BetikaGameEventsProcessor(); +const gameEventsProcessor = new OrbitGameEventsProcessor(); gameEventsProcessor.initGameEventsListener(); diff --git a/src/testbed/testbed_4.ts b/src/testbed/testbed_4.ts index 1e4ea23..93e84e3 100644 --- a/src/testbed/testbed_4.ts +++ b/src/testbed/testbed_4.ts @@ -1,4 +1,4 @@ -import { ThreeWayAnalyzer } from "../core/analysis/three_way"; +import { TwoWayAnalyser } from "../core/analysis/two_way"; -const analyzer = new ThreeWayAnalyzer(); +const analyzer = new TwoWayAnalyser(); analyzer.getData();