overtime-live-trading-utils 2.1.31 → 2.1.33
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.
- package/main.js +1 -1
- package/package.json +1 -1
- package/src/utils/odds.ts +6 -0
- package/src/utils/resolution.ts +8 -2
- package/webpack.config.js +2 -8
package/package.json
CHANGED
package/src/utils/odds.ts
CHANGED
|
@@ -845,7 +845,12 @@ export const groupAndFormatDoubleChanceOdds = (oddsArray: any[], commonData: Hom
|
|
|
845
845
|
let probability12 = 0;
|
|
846
846
|
let probabilityX2 = 0;
|
|
847
847
|
|
|
848
|
+
let sportId;
|
|
849
|
+
|
|
848
850
|
oddsArray.forEach((odd) => {
|
|
851
|
+
if (odd.sportId) {
|
|
852
|
+
sportId = odd.sportId;
|
|
853
|
+
}
|
|
849
854
|
if (odd.selection.includes(commonData.homeTeam)) {
|
|
850
855
|
if (odd.selection.includes(commonData.awayTeam)) {
|
|
851
856
|
probability12 = odd.price;
|
|
@@ -868,6 +873,7 @@ export const groupAndFormatDoubleChanceOdds = (oddsArray: any[], commonData: Hom
|
|
|
868
873
|
odds: [probability1X, probability12, probabilityX2],
|
|
869
874
|
type: 'Double Chance',
|
|
870
875
|
typeId: 10003,
|
|
876
|
+
sportId: sportId,
|
|
871
877
|
};
|
|
872
878
|
return [marketObject];
|
|
873
879
|
};
|
package/src/utils/resolution.ts
CHANGED
|
@@ -49,6 +49,10 @@ export const detectCompletedPeriods = (
|
|
|
49
49
|
inPlayPeriod.toLowerCase().includes('ot') ||
|
|
50
50
|
inPlayPeriod.toLowerCase().includes('extra'));
|
|
51
51
|
|
|
52
|
+
// Check if game is at halftime (period 1 is complete)
|
|
53
|
+
const isAtHalftime = (status === 'half' || status === 'halftime') ||
|
|
54
|
+
(inPlayPeriod && inPlayPeriod.toLowerCase() === 'half');
|
|
55
|
+
|
|
52
56
|
// For each period, check if it's complete
|
|
53
57
|
for (const periodNum of periodKeys) {
|
|
54
58
|
const key = `period_${periodNum}`;
|
|
@@ -62,15 +66,17 @@ export const detectCompletedPeriods = (
|
|
|
62
66
|
// Period is complete if:
|
|
63
67
|
// 1. Game is completed (status = completed/finished), OR
|
|
64
68
|
// 2. Game is live AND in_play.period is GREATER than this period, OR
|
|
65
|
-
// 3. Game is in overtime (all regulation periods are complete)
|
|
69
|
+
// 3. Game is in overtime (all regulation periods are complete), OR
|
|
70
|
+
// 4. Game is at halftime AND this is period 1
|
|
66
71
|
//
|
|
67
72
|
// Note: We do NOT check if next period exists in data, as OpticOdds may include
|
|
68
73
|
// future periods with scores (including zeros). Only in_play.period is
|
|
69
74
|
// the source of truth for live games.
|
|
70
75
|
const isCompleted = status === 'completed' || status === 'complete' || status === 'finished';
|
|
71
76
|
const isCompletedInLiveGame = isLive && currentLivePeriod !== null && currentLivePeriod > periodNum;
|
|
77
|
+
const isFirstPeriodAtHalftime = isAtHalftime && periodNum === 1;
|
|
72
78
|
|
|
73
|
-
if (isCompleted || isCompletedInLiveGame || isInOvertime) {
|
|
79
|
+
if (isCompleted || isCompletedInLiveGame || isInOvertime || isFirstPeriodAtHalftime) {
|
|
74
80
|
completedPeriods.push(periodNum);
|
|
75
81
|
}
|
|
76
82
|
}
|
package/webpack.config.js
CHANGED
|
@@ -17,14 +17,8 @@ module.exports = {
|
|
|
17
17
|
output: {
|
|
18
18
|
filename: 'main.js',
|
|
19
19
|
path: path.resolve(__dirname),
|
|
20
|
-
library:
|
|
21
|
-
|
|
22
|
-
type: 'umd',
|
|
23
|
-
},
|
|
20
|
+
library: 'thalesUtils',
|
|
21
|
+
libraryTarget: 'umd',
|
|
24
22
|
globalObject: 'this',
|
|
25
23
|
},
|
|
26
|
-
optimization: {
|
|
27
|
-
usedExports: false,
|
|
28
|
-
sideEffects: false,
|
|
29
|
-
},
|
|
30
24
|
};
|