Skip to main content

PublicData

Struct PublicData 

Source
pub struct PublicData<'a, T> { /* private fields */ }
Expand description

Accessor for the public reference-data endpoints.

Obtain one via OkxClient::public_data.

Implementations§

Source§

impl<'a, T: Transport> PublicData<'a, T>

Source

pub async fn get_instruments( &self, request: &InstrumentsRequest<'_>, ) -> Result<Vec<Instrument>, Error>

Retrieve the list of tradable instruments.

GET /api/v5/public/instruments. Public.

inst_family is required for FUTURES, SWAP, and OPTION and ignored for SPOT/MARGIN.

§Errors

Returns RestError::Okx if OKX rejects the request, or RestError::Transport/RestError::Decode on transport/parsing failure.

Source

pub async fn get_system_time(&self) -> Result<Vec<SystemTime>, Error>

Retrieve OKX system time.

GET /api/v5/public/time. Public.

§Errors

Returns RestError::Okx if OKX rejects the request, or transport/decode errors.

Source

pub async fn get_open_interest( &self, request: &InstrumentFamilyRequest<'_>, ) -> Result<Vec<OpenInterest>, Error>

Retrieve open interest.

GET /api/v5/public/open-interest. Public.

§Errors

See get_system_time.

Source

pub async fn get_funding_rate( &self, request: &InstIdRequest<'_>, ) -> Result<Vec<FundingRate>, Error>

Retrieve the current funding rate for a derivatives instrument.

GET /api/v5/public/funding-rate. Public.

§Errors

See get_system_time.

Source

pub async fn get_funding_rate_history( &self, request: &FundingRateHistoryRequest<'_>, ) -> Result<Vec<FundingRateHistory>, Error>

Retrieve historical funding rates.

GET /api/v5/public/funding-rate-history. Public.

§Errors

See get_system_time.

Source

pub async fn get_price_limit( &self, request: &InstIdRequest<'_>, ) -> Result<Vec<PriceLimit>, Error>

Retrieve the price limit for an instrument.

GET /api/v5/public/price-limit. Public.

§Errors

See get_system_time.

Source

pub async fn get_mark_price( &self, request: &InstrumentFamilyRequest<'_>, ) -> Result<Vec<MarkPrice>, Error>

Retrieve mark prices.

GET /api/v5/public/mark-price. Public.

§Errors

See get_system_time.

Source

pub async fn get_delivery_exercise_history( &self, request: &DeliveryExerciseHistoryRequest<'_>, ) -> Result<Vec<DeliveryExercise>, Error>

Retrieve delivery/exercise history.

GET /api/v5/public/delivery-exercise-history. Public.

§Errors

See get_system_time.

Source

pub async fn get_position_tiers( &self, request: &PositionTiersRequest<'_>, ) -> Result<Vec<PositionTier>, Error>

Retrieve position tiers.

GET /api/v5/public/position-tiers. Public.

§Errors

See get_system_time.

Source

pub async fn get_underlying( &self, request: &UnderlyingRequest<'_>, ) -> Result<Vec<Vec<String>>, Error>

Retrieve underlying values for an instrument type.

GET /api/v5/public/underlying. Public.

§Errors

See get_system_time.

Source

pub async fn get_insurance_fund( &self, request: &InsuranceFundRequest<'_>, ) -> Result<Vec<InsuranceFund>, Error>

Retrieve insurance-fund snapshots.

GET /api/v5/public/insurance-fund. Public.

§Errors

See get_system_time.

Source

pub async fn get_convert_contract_coin( &self, request: &ConvertContractCoinRequest<'_>, ) -> Result<Vec<ConvertContractCoin>, Error>

Convert between contract count and coin amount.

GET /api/v5/public/convert-contract-coin. Public.

§Errors

See get_system_time.

Source

pub async fn get_option_summary( &self, request: &OptionSummaryRequest<'_>, ) -> Result<Vec<OptionSummary>, Error>

Retrieve option summary data.

GET /api/v5/public/opt-summary. Public.

§Errors

See get_system_time.

Source

pub async fn get_estimated_price( &self, request: &InstIdRequest<'_>, ) -> Result<Vec<EstimatedPrice>, Error>

Retrieve the estimated delivery/exercise price for an instrument.

GET /api/v5/public/estimated-price. Public.

§Errors

See get_system_time.

Source

pub async fn get_discount_rate_interest_free_quota( &self, request: &CurrencyRequest<'_>, ) -> Result<Vec<DiscountRateInterestFreeQuota>, Error>

Retrieve discount-rate and interest-free quota data.

GET /api/v5/public/discount-rate-interest-free-quota. Public.

§Errors

See get_system_time.

Source

pub async fn get_interest_rate_loan_quota( &self, request: &InterestRateLoanQuotaRequest, ) -> Result<Vec<InterestRateLoanQuota>, Error>

Retrieve interest-rate loan quota data.

GET /api/v5/public/interest-rate-loan-quota. Public.

§Errors

See get_system_time.

Source

pub async fn get_instrument_tick_bands( &self, request: &InstrumentTickBandsRequest<'_>, ) -> Result<Vec<InstrumentTickBand>, Error>

Retrieve option tick bands.

GET /api/v5/public/instrument-tick-bands. Public.

§Errors

See get_system_time.

Source

pub async fn get_option_trades( &self, request: &PublicOptionTradesRequest<'_>, ) -> Result<Vec<PublicOptionTrade>, Error>

Retrieve public option trade data.

GET /api/v5/public/option-trades. Public.

§Errors

See get_system_time.

Source

pub async fn get_market_data_history( &self, request: &MarketDataHistoryRequest<'_>, ) -> Result<Vec<MarketDataHistory>, Error>

Retrieve public market-data history.

GET /api/v5/public/market-data-history. Public.

§Errors

See get_system_time.

Source

pub async fn get_mm_instrument_types( &self, request: &MmInstrumentTypesRequest<'_>, ) -> Result<Vec<MmInstrumentType>, Error>

Retrieve MM Program instrument-type classifications.

GET /api/v5/public/mm-instrument-types. Public.

§Errors

See get_system_time.

Source

pub async fn get_economic_calendar( &self, request: &EconomicCalendarRequest<'_>, ) -> Result<Vec<EconomicCalendar>, Error>

Retrieve macro-economic calendar data within the last three months.

GET /api/v5/public/economic-calendar. Authenticated: this endpoint requires signing and is only supported in the production environment. Historical data older than three months requires trading fee tier VIP1 or above.

§Errors

See get_system_time.

Auto Trait Implementations§

§

impl<'a, T> Freeze for PublicData<'a, T>

§

impl<'a, T> RefUnwindSafe for PublicData<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for PublicData<'a, T>
where T: Sync,

§

impl<'a, T> Sync for PublicData<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for PublicData<'a, T>

§

impl<'a, T> UnsafeUnpin for PublicData<'a, T>

§

impl<'a, T> UnwindSafe for PublicData<'a, T>
where T: RefUnwindSafe,

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> 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, 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<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