|
49 | 49 | "UserNonFundingLedgerUpdatesSubscription", {"type": Literal["userNonFundingLedgerUpdates"], "user": str} |
50 | 50 | ) |
51 | 51 | WebData2Subscription = TypedDict("WebData2Subscription", {"type": Literal["webData2"], "user": str}) |
| 52 | +ActiveAssetCtxSubscription = TypedDict("ActiveAssetCtxSubscription", {"type": Literal["activeAssetCtx"], "coin": str}) |
52 | 53 | # If adding new subscription types that contain coin's don't forget to handle automatically rewrite name to coin in info.subscribe |
53 | 54 | Subscription = Union[ |
54 | 55 | AllMidsSubscription, |
|
62 | 63 | UserFundingsSubscription, |
63 | 64 | UserNonFundingLedgerUpdatesSubscription, |
64 | 65 | WebData2Subscription, |
| 66 | + ActiveAssetCtxSubscription, |
65 | 67 | ] |
66 | 68 |
|
67 | 69 | AllMidsData = TypedDict("AllMidsData", {"mids": Dict[str, str]}) |
|
74 | 76 | PongMsg = TypedDict("PongMsg", {"channel": Literal["pong"]}) |
75 | 77 | Trade = TypedDict("Trade", {"coin": str, "side": Side, "px": str, "sz": int, "hash": str, "time": int}) |
76 | 78 | TradesMsg = TypedDict("TradesMsg", {"channel": Literal["trades"], "data": List[Trade]}) |
| 79 | +PerpAssetCtx = TypedDict( |
| 80 | + "PerpAssetCtx", |
| 81 | + { |
| 82 | + "funding": str, |
| 83 | + "openInterest": str, |
| 84 | + "prevDayPx": str, |
| 85 | + "dayNtlVlm": str, |
| 86 | + "premium": str, |
| 87 | + "oraclePx": str, |
| 88 | + "markPx": str, |
| 89 | + "midPx": Optional[str], |
| 90 | + "impactPxs": Optional[Tuple[str, str]], |
| 91 | + "dayBaseVlm": str, |
| 92 | + }, |
| 93 | +) |
| 94 | +ActiveAssetCtx = TypedDict("ActiveAssetCtx", {"coin": str, "ctx": PerpAssetCtx}) |
| 95 | +ActiveSpotAssetCtx = TypedDict("ActiveSpotAssetCtx", {"coin": str, "ctx": SpotAssetCtx}) |
| 96 | +ActiveAssetCtxMsg = TypedDict("ActiveAssetCtxMsg", {"channel": Literal["activeAssetCtx"], "data": ActiveAssetCtx}) |
| 97 | +ActiveSpotAssetCtxMsg = TypedDict( |
| 98 | + "ActiveSpotAssetCtxMsg", {"channel": Literal["activeSpotAssetCtx"], "data": ActiveSpotAssetCtx} |
| 99 | +) |
77 | 100 | Fill = TypedDict( |
78 | 101 | "Fill", |
79 | 102 | { |
|
112 | 135 | }, |
113 | 136 | total=False, |
114 | 137 | ) |
115 | | -WsMsg = Union[AllMidsMsg, BboMsg, L2BookMsg, TradesMsg, UserEventsMsg, PongMsg, UserFillsMsg, OtherWsMsg] |
| 138 | +WsMsg = Union[ |
| 139 | + AllMidsMsg, |
| 140 | + BboMsg, |
| 141 | + L2BookMsg, |
| 142 | + TradesMsg, |
| 143 | + UserEventsMsg, |
| 144 | + PongMsg, |
| 145 | + UserFillsMsg, |
| 146 | + OtherWsMsg, |
| 147 | + ActiveAssetCtxMsg, |
| 148 | + ActiveSpotAssetCtxMsg, |
| 149 | +] |
116 | 150 |
|
117 | 151 | # b is the public address of the builder, f is the amount of the fee in tenths of basis points. e.g. 10 means 1 basis point |
118 | 152 | BuilderInfo = TypedDict("BuilderInfo", {"b": str, "f": int}) |
|
0 commit comments