overtime-live-trading-utils 0.2.10 → 0.3.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/index.ts +0 -1
- package/main.js +1 -1
- package/package.json +1 -1
- package/src/constants/common.ts +1 -1
- package/src/constants/sports.ts +1 -231
- package/src/types/sports.ts +17 -0
- package/src/utils/markets.ts +6 -149
- package/src/utils/odds.ts +180 -166
- package/src/utils/sports.ts +34 -34
- package/src/enums/statuses.ts +0 -21
package/src/utils/sports.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LeagueMap } from '../constants/sports';
|
|
2
|
-
import { League, Sport
|
|
2
|
+
import { League, Sport } from '../enums/sports';
|
|
3
|
+
import { LeagueInfo } from '../types/sports';
|
|
3
4
|
|
|
4
5
|
export const getLeagueSport = (league: League) => {
|
|
5
6
|
const leagueInfo = LeagueMap[league];
|
|
@@ -21,25 +22,20 @@ export const getLeagueIsDrawAvailable = (league: League) => {
|
|
|
21
22
|
return leagueInfo ? leagueInfo.isDrawAvailable : false;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
export const getLiveSupportedLeagues = (
|
|
25
|
-
|
|
26
|
-
return allLeagues
|
|
27
|
-
.filter((league) => (testnet ? league.betTypesForLiveTestnet.length > 0 : league.betTypesForLive.length > 0))
|
|
28
|
-
.map((league) => league.id);
|
|
25
|
+
export const getLiveSupportedLeagues = (leagueMap: LeagueInfo[]) => {
|
|
26
|
+
return leagueMap.filter((leagueInfo) => leagueInfo.enabled === 'true').map((league) => Number(league.sportId));
|
|
29
27
|
};
|
|
28
|
+
export const getBetTypesForLeague = (league: League, leagueMap: LeagueInfo[]) => {
|
|
29
|
+
const betTypes = leagueMap
|
|
30
|
+
.filter((leagueInfo) => Number(leagueInfo.sportId) === Number(league) && leagueInfo.enabled === 'true')
|
|
31
|
+
.map((leagueInfo) => leagueInfo.marketName);
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
const leagueInfo = LeagueMap[league];
|
|
33
|
-
return leagueInfo ? (testnet ? leagueInfo.betTypesForLiveTestnet : leagueInfo.betTypesForLive) : [];
|
|
33
|
+
return betTypes;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export const
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
? testnet
|
|
40
|
-
? leagueInfo.betTypesForLiveTestnet.length > 0
|
|
41
|
-
: leagueInfo.betTypesForLive.length > 0
|
|
42
|
-
: false;
|
|
36
|
+
export const getLeagueInfo = (league: League, leagueMap: LeagueInfo[]) => {
|
|
37
|
+
const leagueInfos = leagueMap.filter((leagueInfo) => Number(leagueInfo.sportId) === league);
|
|
38
|
+
return leagueInfos;
|
|
43
39
|
};
|
|
44
40
|
|
|
45
41
|
export const getLeagueOpticOddsName = (league: League) => {
|
|
@@ -52,24 +48,28 @@ export const getLeaguePeriodType = (league: League) => {
|
|
|
52
48
|
return leagueInfo ? leagueInfo.periodType : '';
|
|
53
49
|
};
|
|
54
50
|
|
|
55
|
-
export const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
export const getLeagueSpreadTypes = (league: League, leagueMap: LeagueInfo[]) => {
|
|
52
|
+
const betTypes = leagueMap
|
|
53
|
+
.filter(
|
|
54
|
+
(leagueInfo) =>
|
|
55
|
+
Number(leagueInfo.sportId) === Number(league) &&
|
|
56
|
+
leagueInfo.type === 'Spread' &&
|
|
57
|
+
leagueInfo.enabled === 'true'
|
|
58
|
+
)
|
|
59
|
+
.map((leagueInfo) => leagueInfo.marketName.toLowerCase());
|
|
60
|
+
|
|
61
|
+
return betTypes;
|
|
64
62
|
};
|
|
65
63
|
|
|
66
|
-
export const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
export const getLeagueTotalTypes = (league: League, leagueMap: LeagueInfo[]) => {
|
|
65
|
+
const betTypes = leagueMap
|
|
66
|
+
.filter(
|
|
67
|
+
(leagueInfo) =>
|
|
68
|
+
Number(leagueInfo.sportId) === Number(league) &&
|
|
69
|
+
leagueInfo.type === 'Total' &&
|
|
70
|
+
leagueInfo.enabled === 'true'
|
|
71
|
+
)
|
|
72
|
+
.map((leagueInfo) => leagueInfo.marketName.toLowerCase());
|
|
73
|
+
|
|
74
|
+
return betTypes;
|
|
75
75
|
};
|
package/src/enums/statuses.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum for task status codes.
|
|
3
|
-
* @readonly
|
|
4
|
-
* @enum {number}
|
|
5
|
-
*/
|
|
6
|
-
export const statusCodes = {
|
|
7
|
-
/** Game is open and has not started. */
|
|
8
|
-
OPEN: 0,
|
|
9
|
-
/** Game has been temporarily halted. */
|
|
10
|
-
PAUSED: 1,
|
|
11
|
-
/** Game is currently underway. */
|
|
12
|
-
IN_PROGRESS: 3,
|
|
13
|
-
/** Game has been finished successfully. */
|
|
14
|
-
FINISHED: 8,
|
|
15
|
-
/** Game has been resolved successfully. */
|
|
16
|
-
RESOLVED: 10,
|
|
17
|
-
/** Game has been canceled and will not be finished. */
|
|
18
|
-
CANCELED: 255,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// TODO: Check if this file can be deleted
|