pub struct HermesClient { /* private fields */ }
Implementations§
Source§impl HermesClient
impl HermesClient
pub fn new(base_url: impl Into<String>) -> Self
Sourcepub async fn get_latest_price_feeds(
&self,
ids: &[&str],
) -> Result<Vec<RpcPriceFeed>, Error>
pub async fn get_latest_price_feeds( &self, ids: &[&str], ) -> Result<Vec<RpcPriceFeed>, Error>
Get the latest price updates by price feed id.
Sourcepub async fn get_price_feeds_metadata(
&self,
query: Option<&str>,
asset_type: Option<&str>,
) -> Result<Vec<PriceFeedMetadata>, Error>
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 stringasset_type
- If provides filter by asset type. Values are crypto, equity, fx, metal, rates
Sourcepub async fn get_price_updates_by_time(
&self,
publish_time: i64,
ids: &[&str],
) -> Result<PriceUpdate, Error>
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
Sourcepub async fn get_latest_twaps(
&self,
window_seconds: u64,
ids: &[&str],
) -> Result<TwapsResponse, Error>
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
Sourcepub async fn get_latest_publisher_stake_caps(
&self,
) -> Result<LatestPublisherStakeCapsUpdateDataResponse, Error>
pub async fn get_latest_publisher_stake_caps( &self, ) -> Result<LatestPublisherStakeCapsUpdateDataResponse, Error>
Gets the most recent publisher stake caps update data
pub async fn stream_price_updates<F>( &self, ids: &[&str], on_event: F, ) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for HermesClient
impl !RefUnwindSafe for HermesClient
impl Send for HermesClient
impl Sync for HermesClient
impl Unpin for HermesClient
impl !UnwindSafe for HermesClient
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
Mutably borrows from an owned value. Read more