pub enum Subscription {
Show 30 variants
AllMids {
dex: String,
},
Notification {
user: Address,
},
WebData3 {
user: Address,
},
TwapStates {
user: Address,
dex: String,
},
ClearinghouseState {
user: Address,
dex: String,
},
OpenOrders {
user: Address,
dex: String,
},
Candle {
coin: String,
interval: Interval,
},
L2Book {
coin: String,
n_sig_figs: Option<u8>,
mantissa: Option<u8>,
fast: bool,
},
Trades {
coin: String,
},
OrderUpdates {
user: Address,
},
UserEvents {
user: Address,
},
UserFills {
user: Address,
aggregate_by_time: bool,
},
UserFundings {
user: Address,
},
UserNonFundingLedgerUpdates {
user: Address,
},
ActiveAssetCtx {
coin: String,
},
ActiveAssetData {
user: Address,
coin: String,
},
UserTwapSliceFills {
user: Address,
},
UserTwapHistory {
user: Address,
},
Bbo {
coin: String,
},
SpotState {
user: Address,
ignore_portfolio_margin: bool,
},
AllDexsClearinghouseState {
user: Address,
},
AllDexsAssetCtxs,
OutcomeMetaUpdates,
FastAssetCtxs,
AssetCtxs {
dex: String,
},
SpotAssetCtxs,
UserHistoricalOrders {
user: Address,
},
L2 {
coin: String,
n_sig_figs: Option<u8>,
mantissa: Option<u8>,
},
Pac,
Sac,
}Expand description
One feed. A coin is spelled as the venue spells it: BTC, xyz:SP500 (HIP-3), @107 or
PURR/USDC (spot), #14720 (an outcome side). A dex of "" is the first perp dex.
Variants§
AllMids
Every coin’s mid on one perp dex. The first dex’s also carries spot and outcome mids.
Notification
Short texts for the account: fills, liquidations.
WebData3
The account as Hyperliquid’s own frontend reads it.
TwapStates
The account’s running TWAPs on one dex, on the channel twapStates.
ClearinghouseState
The account’s clearinghouse on one dex, on the channel clearinghouseState.
OpenOrders
The account’s resting orders on one dex, on the channel openOrders.
Candle
One coin’s candles at one interval, on the channel candle.
L2Book
n_sig_figs groups levels to 2 to 5 significant figures; mantissa (1, 2 or 5) groups
further, with 5 figures only. fast gives 5 levels a side more often, not 20.
Fields
Trades
One coin’s prints, on the channel trades.
OrderUpdates
Status changes of the account’s orders, on the channel orderUpdates.
UserEvents
Its data comes on the channel user.
UserFills
aggregate_by_time merges the partial fills of one crossing order.
Fields
UserFundings
The account’s funding payments, on the channel userFundings.
UserNonFundingLedgerUpdates
The account’s ledger rows other than funding, on the channel userNonFundingLedgerUpdates.
ActiveAssetCtx
A perp’s context; a spot pair’s or an outcome side’s comes on activeSpotAssetCtx.
ActiveAssetData
What the account may trade on a perp. Perps only.
UserTwapSliceFills
Fills of the account’s TWAP slices, on the channel userTwapSliceFills.
UserTwapHistory
The account’s TWAP events, on the channel userTwapHistory.
Bbo
The best bid and offer, sent only when one of them moves.
SpotState
The docs name the option isPortfolioMargin; the venue ignores that and echoes
ignorePortfolioMargin, which is what it reads.
Fields
AllDexsClearinghouseState
The account’s clearinghouse on every dex, on the channel allDexsClearinghouseState.
AllDexsAssetCtxs
Every perp dex’s contexts in one frame.
OutcomeMetaUpdates
Changes to outcomeMeta, sent only when something changes.
FastAssetCtxs
Mark and mid changes, base64 of raw DEFLATE.
AssetCtxs
One perp dex’s contexts. In @nktkas/hyperliquid, not on the docs’ list.
SpotAssetCtxs
Every spot and outcome context. In @nktkas/hyperliquid, not on the docs’ list.
UserHistoricalOrders
Orders and what became of them. In @nktkas/hyperliquid, not on the docs’ list.
L2
The book as a snapshot of up to twenty levels a side, then diffs. n_sig_figs and
mantissa group levels as on Subscription::L2Book; on the wire they are s and m, and
the coin is c.
Fields
Pac
Every perp dex’s contexts, base64 of raw DEFLATE: a snapshot, then only what changed.
Sac
Every spot pair’s and outcome side’s context by coin, base64 of raw DEFLATE: a snapshot, then only what changed.
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn parse(json: &Json) -> Result<Subscription, BadSubscription>
pub fn parse(json: &Json) -> Result<Subscription, BadSubscription>
Reads a subscription object, in any key order, as the venue echoes it or as it was sent.
Keys it does not know are passed over; null, false and "" read as left out.
Source§impl Subscription
impl Subscription
Sourcepub fn to_json(&self) -> Json
pub fn to_json(&self) -> Json
The object a subscribe or unsubscribe frame carries: keys in the docs’ order, optional ones
last and only when set, as the Python SDK sends them. The venue echoes left out options
filled in (fast: false, dex: ""), and Subscription::parse reads that echo back to
the same subscription.
Source§impl Subscription
impl Subscription
Sourcepub fn channel(&self) -> &'static str
pub fn channel(&self) -> &'static str
The channel its data comes on: its type, except userEvents (on user) and a spot or
outcome coin’s activeAssetCtx (on activeSpotAssetCtx), so matching on the name sent
would never fire.
Sourcepub const fn user(&self) -> Option<Address>
pub const fn user(&self) -> Option<Address>
The account a user subscription follows. The venue allows ten across an IP’s subscriptions.
Sourcepub fn check(&self) -> Result<(), BadSubscription>
pub fn check(&self) -> Result<(), BadSubscription>
Whether the venue would take it: a coin is named, and a book’s grouping is one the info
docs allow. The venue drops the whole socket for some subscriptions it cannot serve (a
bbo of an unknown coin), so a coin should come from the venue’s own lists.
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§impl Debug for Subscription
impl Debug for Subscription
Source§impl Display for Subscription
impl Display for Subscription
impl Eq for Subscription
Source§impl Hash for Subscription
impl Hash for Subscription
Source§impl PartialEq for Subscription
impl PartialEq for Subscription
impl StructuralPartialEq for Subscription
Auto Trait Implementations§
impl Forget for Subscription
impl Freeze for Subscription
impl Move for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.