overtime-live-trading-utils 4.0.0-rc.9 → 4.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overtime-live-trading-utils",
3
- "version": "4.0.0-rc.9",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "dependencies": {
15
15
  "@types/node": "^20.8.10",
16
16
  "oddslib": "^2.1.1",
17
- "overtime-utils": "^0.1.59",
17
+ "overtime-utils": "^0.1.66",
18
18
  "react": "^17.0.1"
19
19
  },
20
20
  "devDependencies": {
package/src/utils/odds.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as oddslib from 'oddslib';
2
- import { MarketType, MarketTypeMap } from 'overtime-utils';
2
+ import { isOneSideExtendedPlayerPropsMarket, MarketType, MarketTypeMap } from 'overtime-utils';
3
3
  import { DRAW, ZERO } from '../constants/common';
4
4
  import { LAST_POLLED_TOO_OLD, NO_MARKETS_FOR_LEAGUE_ID } from '../constants/errors';
5
5
  import { MoneylineTypes } from '../enums/sports';
@@ -291,10 +291,10 @@ export const createChildMarkets: (
291
291
  const maxOdds = leagueInfoByTypeId?.maxOdds; // maximum odds configured for child market (e.g. 0.05 implied probability)
292
292
 
293
293
  if (minOdds && maxOdds) {
294
- const conditionToAddChildMarket =
295
- data.type === 'Total'
296
- ? data.odds.some((odd: number) => odd < minOdds && odd > maxOdds)
297
- : data.odds.every((odd: number) => odd < minOdds && odd > maxOdds);
294
+ const allowZeroOdds = ['Total'].includes(data.type);
295
+ const conditionToAddChildMarket = data.odds.every(
296
+ (odd: number) => (odd < minOdds && odd > maxOdds) || (allowZeroOdds && odd === ZERO)
297
+ );
298
298
  if (conditionToAddChildMarket) {
299
299
  childMarkets.push(childMarket);
300
300
  }
@@ -457,9 +457,16 @@ export const groupAndFormatTotalOdds = (oddsArray: any[], commonData: HomeAwayTe
457
457
  // if this is false typeId is already mapped correctly
458
458
  const shouldIncreaseTypeId = selection === commonData.awayTeam && !(value as any).playerProps;
459
459
 
460
+ const odds = [(value as any).over, (value as any).under];
461
+ const hasOdds = odds.some((odd) => odd !== null);
462
+
460
463
  acc.push({
461
464
  line: line as any,
462
- odds: [(value as any).over, (value as any).under].map((odd) => odd || ZERO),
465
+ odds: hasOdds
466
+ ? isOneSideExtendedPlayerPropsMarket(Number((value as any).typeId))
467
+ ? odds.filter((odd) => odd !== null)
468
+ : odds.map((odd) => odd || ZERO)
469
+ : [],
463
470
  typeId: !shouldIncreaseTypeId ? (value as any).typeId : Number((value as any).typeId) + 1,
464
471
  sportId: (value as any).sportId,
465
472
  type: (value as any).type,