@levrbet/shared 0.5.75 → 0.5.76

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,4 @@
1
1
  export * from "./depth.types";
2
+ export * from "./mm-decision.types";
2
3
  export * from "./order.types";
3
4
  export * from "./preview.types";
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./depth.types"), exports);
18
+ __exportStar(require("./mm-decision.types"), exports);
18
19
  __exportStar(require("./order.types"), exports);
19
20
  __exportStar(require("./preview.types"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/types/orderbook/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,gDAA6B;AAC7B,kDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/types/orderbook/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,sDAAmC;AACnC,gDAA6B;AAC7B,kDAA+B"}
@@ -0,0 +1,63 @@
1
+ import type { MarketType, MMDecisionOutcome, MMDecisionReason, MMDecisionTrigger, OrderDirection } from "@prisma/client";
2
+ import type { Side } from "../blockchain/contract.types";
3
+ export declare enum MMDecisionOp {
4
+ PLACE = "PLACE",
5
+ EDIT = "EDIT",
6
+ CANCEL = "CANCEL"
7
+ }
8
+ export interface MMDecisionLevel {
9
+ price: number;
10
+ size: string;
11
+ }
12
+ export interface MMDecisionOperation {
13
+ op: MMDecisionOp;
14
+ direction: OrderDirection;
15
+ orderId?: string;
16
+ price: number;
17
+ size: string;
18
+ success: boolean;
19
+ error?: string;
20
+ }
21
+ export interface MarketMakerDecisionDto {
22
+ id: string;
23
+ chainId: number;
24
+ gameId: number;
25
+ gameMarketId: string;
26
+ side: Side;
27
+ marketType: MarketType;
28
+ outcome: MMDecisionOutcome;
29
+ reason?: MMDecisionReason;
30
+ trigger: MMDecisionTrigger;
31
+ refPrice?: number;
32
+ gameProgressBps?: number;
33
+ onChainBalance?: string;
34
+ totalBidBudget?: string;
35
+ marketBidBudget?: string;
36
+ cumulativeBidSpend?: string;
37
+ numActiveMarkets?: number;
38
+ numActiveSides?: number;
39
+ askAvailable?: string;
40
+ positionId?: string;
41
+ bidLevels: MMDecisionLevel[];
42
+ askLevels: MMDecisionLevel[];
43
+ bidEdits: number;
44
+ bidsPlaced: number;
45
+ bidsCancelled: number;
46
+ askEdits: number;
47
+ asksPlaced: number;
48
+ asksCancelled: number;
49
+ activeOrderCount?: number;
50
+ expectedOrderCount?: number;
51
+ operations: MMDecisionOperation[];
52
+ createdAt: string;
53
+ }
54
+ export interface MarketMakerDecisionFilters {
55
+ gameId: number;
56
+ chainId?: number;
57
+ gameMarketId?: string;
58
+ side?: Side;
59
+ from?: string;
60
+ to?: string;
61
+ outcome?: MMDecisionOutcome;
62
+ limit?: number;
63
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MMDecisionOp = void 0;
4
+ var MMDecisionOp;
5
+ (function (MMDecisionOp) {
6
+ MMDecisionOp["PLACE"] = "PLACE";
7
+ MMDecisionOp["EDIT"] = "EDIT";
8
+ MMDecisionOp["CANCEL"] = "CANCEL";
9
+ })(MMDecisionOp || (exports.MMDecisionOp = MMDecisionOp = {}));
10
+ //# sourceMappingURL=mm-decision.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mm-decision.types.js","sourceRoot":"","sources":["../../../../src/core/types/orderbook/mm-decision.types.ts"],"names":[],"mappings":";;;AAGA,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,+BAAe,CAAA;IACf,6BAAa,CAAA;IACb,iCAAiB,CAAA;AACrB,CAAC,EAJW,YAAY,aAAZ,YAAY,GAAZ,YAAY,QAIvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levrbet/shared",
3
- "version": "0.5.75",
3
+ "version": "0.5.76",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -26,6 +26,29 @@ enum MarketType {
26
26
  OverUnder
27
27
  }
28
28
 
29
+ enum MMDecisionOutcome {
30
+ QUOTED
31
+ SKIPPED
32
+ CANCELLED_ALL
33
+ ABORTED
34
+ ERROR
35
+ }
36
+
37
+ enum MMDecisionReason {
38
+ NO_REF_PRICE
39
+ OUTSIDE_WINDOW
40
+ PAST_STOP
41
+ BUDGET_EXHAUSTED
42
+ MARKET_CLOSED
43
+ }
44
+
45
+ enum MMDecisionTrigger {
46
+ ODDS_MOVEMENT
47
+ HEARTBEAT
48
+ STATUS_CHANGE
49
+ INITIAL
50
+ }
51
+
29
52
  enum MarketStatus {
30
53
  Open
31
54
  Closed
@@ -657,5 +680,57 @@ model Notification {
657
680
  @@index([userId])
658
681
  @@index([userId, readAt])
659
682
  @@index([type])
683
+ }
684
+
685
+ model MarketMakerDecision {
686
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
687
+
688
+ // Identity / routing
689
+ chainId Int
690
+ gameId Int
691
+ gameMarketId String
692
+ side Int // Side enum (numeric, matches ClosedOrder)
693
+ marketType MarketType
694
+
695
+ // Outcome
696
+ outcome MMDecisionOutcome
697
+ reason MMDecisionReason?
698
+ trigger MMDecisionTrigger
699
+
700
+ // Inputs snapshot
701
+ refPrice Int? // 3dp
702
+ gameProgressBps Int?
703
+
704
+ // Budget snapshot (e6 values as strings)
705
+ onChainBalance String?
706
+ totalBidBudget String?
707
+ marketBidBudget String?
708
+ cumulativeBidSpend String?
709
+ numActiveMarkets Int?
710
+ numActiveSides Int?
711
+ askAvailable String?
712
+ positionId String?
713
+
714
+ // Computed ladders (price 3dp, size e6 as string)
715
+ bidLevels Json // [{ price, size }]
716
+ askLevels Json // [{ price, size }]
717
+
718
+ // Action summary
719
+ bidEdits Int @default(0)
720
+ bidsPlaced Int @default(0)
721
+ bidsCancelled Int @default(0)
722
+ askEdits Int @default(0)
723
+ asksPlaced Int @default(0)
724
+ asksCancelled Int @default(0)
725
+ activeOrderCount Int?
726
+ expectedOrderCount Int?
727
+
728
+ // Concrete order operations issued this cycle
729
+ operations Json // [{ op, direction, orderId?, price, size, success, error? }]
730
+
731
+ createdAt DateTime @default(now())
732
+
733
+ @@index([gameId, createdAt(sort: Desc)])
734
+ @@index([gameMarketId, side, createdAt(sort: Desc)])
660
735
  @@index([createdAt])
661
736
  }