diff --git a/package.json b/package.json index 9448a6a..3e0248f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "overtime-live-trading-utils", - "version": "1.1.5", + "version": "1.1.6", "description": "", "main": "main.js", "scripts": { diff --git a/src/utils/markets.ts b/src/utils/markets.ts index 33f5b16..73f6273 100644 --- a/src/utils/markets.ts +++ b/src/utils/markets.ts @@ -58,13 +58,12 @@ export const processMarket = ( let finalProbability = probability; if (probability < 0.95) { - finalProbability = - leagueInfoByTypeId && leagueInfoByTypeId.addedSpread > 0 - ? (probability * (100 + leagueInfoByTypeId.addedSpread)) / 100 - : probability; - // edge case if added spread is bigger than 5%, it can happen that odd goes above 1, in that case return odd from api. - if (finalProbability >= 1) { - finalProbability = probability; + if (leagueInfoByTypeId && leagueInfoByTypeId.addedSpread) { + finalProbability = (probability * (100 + leagueInfoByTypeId.addedSpread)) / 100; + // edge case if added spread is bigger than 5%, it can happen that odd goes above 1, in that case return odd from api. + if (finalProbability >= 1) { + finalProbability = probability; + } } } @@ -110,12 +109,12 @@ export const processMarket = ( let finalProbability = probability; if (probability < 0.95) { - finalProbability = - leagueInfoByTypeId && leagueInfoByTypeId.addedSpread > 0 - ? (probability * (100 + leagueInfoByTypeId.addedSpread)) / 100 - : probability; - if (finalProbability >= 1) { - finalProbability = probability; + if (leagueInfoByTypeId && leagueInfoByTypeId.addedSpread) { + finalProbability = (probability * (100 + leagueInfoByTypeId.addedSpread)) / 100; + // edge case if added spread is bigger than 5%, it can happen that odd goes above 1, in that case return odd from api. + if (finalProbability >= 1) { + finalProbability = probability; + } } } return {