|
50 | 50 | ) |
51 | 51 | WebData2Subscription = TypedDict("WebData2Subscription", {"type": Literal["webData2"], "user": str}) |
52 | 52 | ActiveAssetCtxSubscription = TypedDict("ActiveAssetCtxSubscription", {"type": Literal["activeAssetCtx"], "coin": str}) |
| 53 | +ActiveAssetDataSubscription = TypedDict( |
| 54 | + "ActiveAssetDataSubscription", {"type": Literal["activeAssetData"], "user": str, "coin": str} |
| 55 | +) |
53 | 56 | # If adding new subscription types that contain coin's don't forget to handle automatically rewrite name to coin in info.subscribe |
54 | 57 | Subscription = Union[ |
55 | 58 | AllMidsSubscription, |
|
64 | 67 | UserNonFundingLedgerUpdatesSubscription, |
65 | 68 | WebData2Subscription, |
66 | 69 | ActiveAssetCtxSubscription, |
| 70 | + ActiveAssetDataSubscription, |
67 | 71 | ] |
68 | 72 |
|
69 | 73 | AllMidsData = TypedDict("AllMidsData", {"mids": Dict[str, str]}) |
|
75 | 79 | BboMsg = TypedDict("BboMsg", {"channel": Literal["bbo"], "data": BboData}) |
76 | 80 | PongMsg = TypedDict("PongMsg", {"channel": Literal["pong"]}) |
77 | 81 | Trade = TypedDict("Trade", {"coin": str, "side": Side, "px": str, "sz": int, "hash": str, "time": int}) |
| 82 | +CrossLeverage = TypedDict( |
| 83 | + "CrossLeverage", |
| 84 | + { |
| 85 | + "type": Literal["cross"], |
| 86 | + "value": int, |
| 87 | + }, |
| 88 | +) |
| 89 | +IsolatedLeverage = TypedDict( |
| 90 | + "IsolatedLeverage", |
| 91 | + { |
| 92 | + "type": Literal["isolated"], |
| 93 | + "value": int, |
| 94 | + "rawUsd": str, |
| 95 | + }, |
| 96 | +) |
| 97 | +Leverage = Union[CrossLeverage, IsolatedLeverage] |
78 | 98 | TradesMsg = TypedDict("TradesMsg", {"channel": Literal["trades"], "data": List[Trade]}) |
79 | 99 | PerpAssetCtx = TypedDict( |
80 | 100 | "PerpAssetCtx", |
|
97 | 117 | ActiveSpotAssetCtxMsg = TypedDict( |
98 | 118 | "ActiveSpotAssetCtxMsg", {"channel": Literal["activeSpotAssetCtx"], "data": ActiveSpotAssetCtx} |
99 | 119 | ) |
| 120 | +ActiveAssetData = TypedDict( |
| 121 | + "ActiveAssetData", |
| 122 | + { |
| 123 | + "user": str, |
| 124 | + "coin": str, |
| 125 | + "leverage": Leverage, |
| 126 | + "maxTradeSzs": Tuple[str, str], |
| 127 | + "availableToTrade": Tuple[str, str], |
| 128 | + "markPx": str, |
| 129 | + }, |
| 130 | +) |
| 131 | +ActiveAssetDataMsg = TypedDict("ActiveAssetDataMsg", {"channel": Literal["activeAssetData"], "data": ActiveAssetData}) |
100 | 132 | Fill = TypedDict( |
101 | 133 | "Fill", |
102 | 134 | { |
|
146 | 178 | OtherWsMsg, |
147 | 179 | ActiveAssetCtxMsg, |
148 | 180 | ActiveSpotAssetCtxMsg, |
| 181 | + ActiveAssetDataMsg, |
149 | 182 | ] |
150 | 183 |
|
151 | 184 | # 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 |
|
0 commit comments