Struct HermesClient

Source
pub struct HermesClient { /* private fields */ }

Implementations§

Source§

impl HermesClient

Source

pub fn new(base_url: impl Into<String>) -> Self

Source

pub async fn get_latest_price_feeds( &self, ids: &[&str], ) -> Result<Vec<RpcPriceFeed>, Error>

Get the latest price updates by price feed id.

Source

pub async fn get_price_feeds_metadata( &self, query: Option<&str>, asset_type: Option<&str>, ) -> Result<Vec<PriceFeedMetadata>, Error>

This endpoint fetches all price feeds from the Pyth network. It can be filtered by asset type and query string.

§Arguments
  • query - If provided results will be filtered for price feeds whose symbol contains the query string
  • asset_type - If provides filter by asset type. Values are crypto, equity, fx, metal, rates
Source

pub async fn get_price_updates_by_time( &self, publish_time: i64, ids: &[&str], ) -> Result<PriceUpdate, Error>

Get the latest price updates by price feed id, with a publish time greater than publish_time

§Arguments
  • publish_time - Only return price feed updates that are greater than or equal to this timestamp
Source

pub async fn get_latest_twaps( &self, window_seconds: u64, ids: &[&str], ) -> Result<TwapsResponse, Error>

Get the latest TWAP by price feed id with a custom time window.

§Arguments
  • window_seconds - Time period in seconds used to calculate the TWAP, ending at current time
Source

pub async fn get_latest_publisher_stake_caps( &self, ) -> Result<LatestPublisherStakeCapsUpdateDataResponse, Error>

Gets the most recent publisher stake caps update data

Source

pub async fn stream_price_updates<F>( &self, ids: Vec<String>, on_event: F, ) -> Result<JoinHandle<()>, Error>
where F: FnMut(ParsedPriceUpdate) + Send + 'static,

Spawns a task which streams price updates from the hermes api

§Returns

JoinHandle which can be used to abort the spawned task

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<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: 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: 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> ErasedDestructor for T
where T: 'static,