Skip to main content

Subscription

Enum Subscription 

Source
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.

Fields

§

Notification

Short texts for the account: fills, liquidations.

Fields

§user: Address
§

WebData3

The account as Hyperliquid’s own frontend reads it.

Fields

§user: Address
§

TwapStates

Fields

§user: Address
§

ClearinghouseState

Fields

§user: Address
§

OpenOrders

Fields

§user: Address
§

Candle

Fields

§coin: String
§interval: Interval
§

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

§coin: String
§n_sig_figs: Option<u8>
§mantissa: Option<u8>
§fast: bool
§

Trades

Fields

§coin: String
§

OrderUpdates

Fields

§user: Address
§

UserEvents

Its data comes on the channel user.

Fields

§user: Address
§

UserFills

aggregate_by_time merges the partial fills of one crossing order.

Fields

§user: Address
§aggregate_by_time: bool
§

UserFundings

Fields

§user: Address
§

UserNonFundingLedgerUpdates

Fields

§user: Address
§

ActiveAssetCtx

A perp’s context; a spot pair’s or an outcome side’s comes on activeSpotAssetCtx.

Fields

§coin: String
§

ActiveAssetData

What the account may trade on a perp. Perps only.

Fields

§user: Address
§coin: String
§

UserTwapSliceFills

Fields

§user: Address
§

UserTwapHistory

Fields

§user: Address
§

Bbo

The best bid and offer, sent only when one of them moves.

Fields

§coin: String
§

SpotState

The docs name the option isPortfolioMargin; the venue ignores that and echoes ignorePortfolioMargin, which is what it reads.

Fields

§user: Address
§ignore_portfolio_margin: bool
§

AllDexsClearinghouseState

Fields

§user: Address
§

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.

Fields

§

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.

Fields

§user: Address

Implementations§

Source§

impl Subscription

Source

pub const fn kind(&self) -> &'static str

Its type.

Source

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.

Source

pub const fn user(&self) -> Option<Address>

The account a user subscription follows. The venue allows ten across an IP’s subscriptions.

Source

pub fn coin(&self) -> Option<&str>

The coin it follows, for the subscriptions that follow one.

Source

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

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Subscription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Subscription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The object as one line of JSON.

Source§

impl Eq for Subscription

Source§

impl Hash for Subscription

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Subscription

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Subscription

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more