pub enum Subscription {
Show 27 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,
},
}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
ClearinghouseState
OpenOrders
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.
Trades
OrderUpdates
UserEvents
Its data comes on the channel user.
UserFills
aggregate_by_time merges the partial fills of one crossing order.
UserFundings
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
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.
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.
Implementations§
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 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.
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.
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.
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 Freeze 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.