overtime-live-trading-utils 4.0.0-rc.3 → 4.0.0-rc.6

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.3",
3
+ "version": "4.0.0-rc.6",
4
4
  "description": "",
5
5
  "main": "main.js",
6
6
  "scripts": {
package/src/utils/odds.ts CHANGED
@@ -475,16 +475,16 @@ export const groupAndFormatTotalOdds = (oddsArray: any[], commonData: HomeAwayTe
475
475
  // if we have away team in total odds we know the market is team total and we need to increase typeId by one.
476
476
  // if this is false typeId is already mapped correctly
477
477
  const shouldIncreaseTypeId = selection === commonData.awayTeam && !(value as any).playerProps;
478
- if ((value as any).over !== null && (value as any).under !== null) {
479
- acc.push({
480
- line: line as any,
481
- odds: [(value as any).over, (value as any).under],
482
- typeId: !shouldIncreaseTypeId ? (value as any).typeId : Number((value as any).typeId) + 1,
483
- sportId: (value as any).sportId,
484
- type: (value as any).type,
485
- playerProps: (value as any).playerProps,
486
- });
487
- }
478
+
479
+ acc.push({
480
+ line: line as any,
481
+ odds: [(value as any).over, (value as any).under].filter((odd) => odd !== null),
482
+ typeId: !shouldIncreaseTypeId ? (value as any).typeId : Number((value as any).typeId) + 1,
483
+ sportId: (value as any).sportId,
484
+ type: (value as any).type,
485
+ playerProps: (value as any).playerProps,
486
+ });
487
+
488
488
  return acc;
489
489
  }, []);
490
490
 
@@ -943,13 +943,8 @@ export const adjustSpreadOnChildOdds = (
943
943
  ) => {
944
944
  const result: any[] = [];
945
945
  iterableGroupedOdds.forEach((data) => {
946
- const hasDrawOdds = data.odds.length === 3;
947
- const homeTeamOdds = convertOddsToImpl(data.odds[0]) || ZERO;
948
- const awayTeamOdds = convertOddsToImpl(data.odds[1]) || ZERO;
949
- const drawOdds = convertOddsToImpl(data.odds[2]) || ZERO;
950
- const odds = hasDrawOdds ? [homeTeamOdds, awayTeamOdds, drawOdds] : [homeTeamOdds, awayTeamOdds];
951
-
952
- const isZeroOddsChild = homeTeamOdds === ZERO || awayTeamOdds === ZERO || (hasDrawOdds && drawOdds === ZERO);
946
+ const odds = data.odds.map((odd: number) => convertOddsToImpl(odd) || ZERO);
947
+ const isZeroOddsChild = odds.includes(ZERO);
953
948
  if (!isZeroOddsChild) {
954
949
  const spreadData = getSpreadData(
955
950
  spreadDataForSport,