@sportsbroker/firebase-structure 3.1.0 → 3.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.
@@ -1,3 +1,7 @@
1
+ import {Percentage} from "../global";
2
+
1
3
  export interface Config {
2
- statusCheckRequired: Boolean;
4
+ statusCheckRequired: boolean;
5
+ buyPriceFee: Percentage;
6
+ instantSellPriceFactor: Percentage;
3
7
  }
@@ -1,16 +1,19 @@
1
- export interface MatchTeamShares {
1
+ export interface MatchTeamSharePriceImpact {
2
2
  price: number;
3
- openingPrice: number;
4
- priceChangePercentage: number;
3
+ preMatchPrice?: number;
4
+ afterMatchPrice?: number;
5
+ adjustedPrice?: number;
6
+ priceChangePercentage?: number;
7
+ priceChange?: number;
5
8
  }
6
9
 
7
- export interface MatchShares {
8
- home: MatchTeamShares;
9
- away: MatchTeamShares;
10
+ export interface MatchSharePriceImpact {
11
+ home: MatchTeamSharePriceImpact;
12
+ away: MatchTeamSharePriceImpact;
10
13
  }
11
14
 
12
15
  export interface Shares {
13
16
  [sportID: string]: {
14
- [matchID: string]: MatchShares;
17
+ [matchID: string]: MatchSharePriceImpact;
15
18
  };
16
19
  }
@@ -1,5 +1,7 @@
1
1
  import { TeamID } from "../../global";
2
2
 
3
+ export type TradingInactiveReason = "SPLIT_IN_PROGRESS" | "NONE";
4
+
3
5
  export interface MarketIndicators {
4
6
  dailyHigh: number;
5
7
  dailyLow: number;
@@ -11,6 +13,11 @@ export interface MarketIndicators {
11
13
  capacity: number;
12
14
  }
13
15
 
16
+ export interface TradingStatus {
17
+ isTradingActive: boolean;
18
+ inactivityReason: TradingInactiveReason;
19
+ }
20
+
14
21
  export interface TeamShare {
15
22
  seasonPriceChangePercentage: number;
16
23
  price: number;
@@ -20,6 +27,7 @@ export interface TeamShare {
20
27
  sellPrice: number;
21
28
  id: TeamID;
22
29
  market?: MarketIndicators;
30
+ tradingStatus: TradingStatus;
23
31
  }
24
32
 
25
33
  export interface Shares {
@@ -1,5 +1,5 @@
1
1
  import { Orders } from "./orders";
2
- import { Overviews } from "./overviews";
2
+ import { Status } from "./status";
3
3
  import { Wallet } from "./wallet";
4
4
  import { Watchlist } from "./watchlist";
5
5
  import { Notifications } from "./notifications";
@@ -8,7 +8,7 @@ import { Transactions } from './transactions';
8
8
 
9
9
  export interface Users {
10
10
  orders: Orders;
11
- overviews: Overviews;
11
+ status: Status;
12
12
  wallet: Wallet;
13
13
  watchlist: Watchlist;
14
14
  notifications: Notifications;
@@ -1,4 +1,5 @@
1
1
  import { SportID } from "../../global";
2
+ import { OwnedSharesSplit } from "./ownedSharesSplit";
2
3
 
3
4
  export interface UserOwnedShares {
4
5
  sportId: SportID;
@@ -7,6 +8,7 @@ export interface UserOwnedShares {
7
8
  profit: number;
8
9
  invested: number;
9
10
  averagePricePerShare: number;
11
+ splits?: OwnedSharesSplit[];
10
12
  }
11
13
 
12
14
  /**
@@ -0,0 +1,10 @@
1
+ import { MatchID, ISODate } from "../../global";
2
+
3
+ export interface OwnedSharesSplit {
4
+ id: string;
5
+ matchId: MatchID;
6
+ date: ISODate;
7
+ sharesAmountAfterSplit: number;
8
+ sharesAmountDiff: number;
9
+ profit: number;
10
+ }
@@ -1,5 +1,3 @@
1
- import { UserID } from "../../global";
2
-
3
1
  export interface UserRanking {
4
2
  change: number;
5
3
  equity: number;
@@ -9,5 +7,5 @@ export interface UserRanking {
9
7
 
10
8
  //Restricted access only to own data
11
9
  export interface Ranking {
12
- [userId: UserID]: UserRanking;
10
+ [userId: string]: UserRanking;
13
11
  }
@@ -0,0 +1,14 @@
1
+ export enum UserStatus {
2
+ CREATED = "CREATED",
3
+ ACTIVATED = "ACTIVATED",
4
+ DEACTIVATED = "DEACTIVATED",
5
+ BANNED = "BANNED",
6
+ SELF_EXCLUDED = "SELF_EXCLUDED",
7
+ }
8
+
9
+ /**
10
+ * userID: UserID
11
+ */
12
+ export interface Status {
13
+ [userID: string]: UserStatus;
14
+ }
@@ -25,6 +25,8 @@ export type SeasonID = string;
25
25
 
26
26
  export type GroupID = string;
27
27
 
28
+ export type Percentage = number // 0.0-1.0
29
+
28
30
  export interface Image {
29
31
  default: string;
30
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {
@@ -1,46 +0,0 @@
1
- import { UserID } from "../../global";
2
-
3
- /**
4
- * This stateful structure is required because of asynchronous matter of id verification.
5
- * The values might change during integration with 3rd party provider.
6
- */
7
- type IDVerification = "SUBMITTED" | "VERIFIED" | "REJECTED";
8
-
9
- export interface UserStatus {
10
- emailVerified: boolean;
11
- idVerification: IDVerification | null;
12
- phoneVerified: boolean;
13
- banned: boolean;
14
- deactivated: boolean;
15
- }
16
-
17
- export interface UserProfile {
18
- firstName?: string;
19
- lastName?: string;
20
- birthdate?: string;
21
- }
22
-
23
- export interface UserAddress {
24
- addressLine1?: string;
25
- addressLine2?: string;
26
- county?: string;
27
- city?: string;
28
- postalCode?: string;
29
- countryCode: string;
30
- }
31
-
32
- export interface User {
33
- username: string;
34
- email: string;
35
- id: UserID;
36
- status: UserStatus;
37
- profile?: UserProfile;
38
- address: UserAddress;
39
- }
40
-
41
- /**
42
- * userID: UserID
43
- */
44
- export interface Overviews {
45
- [userID: string]: User;
46
- }