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>
impl<'a, T: Transport> PublicData<'a, T>
Sourcepub async fn get_instruments(
&self,
inst_type: InstType,
inst_family: Option<&str>,
) -> Result<Vec<Instrument>, Error>
pub async fn get_instruments( &self, inst_type: InstType, inst_family: Option<&str>, ) -> Result<Vec<Instrument>, Error>
Retrieve the list of tradable instruments.
GET /api/v5/public/instruments
inst_family is required for FUTURES, SWAP, and OPTION and ignored
for SPOT/MARGIN. This endpoint is public (unauthenticated).
§Errors
Returns Error::Api if OKX rejects the request, or
Error::Transport/Error::Decode on transport/parsing failure.
Sourcepub async fn get_system_time(&self) -> Result<Vec<SystemTime>, Error>
pub async fn get_system_time(&self) -> Result<Vec<SystemTime>, Error>
Retrieve OKX system time.
GET /api/v5/public/time. Public.
§Errors
Returns Error::Api if OKX rejects the request, or transport/decode
errors.
Sourcepub async fn get_open_interest(
&self,
request: &InstrumentFamilyRequest,
) -> Result<Vec<OpenInterest>, Error>
pub async fn get_open_interest( &self, request: &InstrumentFamilyRequest, ) -> Result<Vec<OpenInterest>, Error>
Sourcepub async fn get_funding_rate(
&self,
inst_id: &str,
) -> Result<Vec<FundingRate>, Error>
pub async fn get_funding_rate( &self, inst_id: &str, ) -> 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.
Sourcepub async fn get_funding_rate_history(
&self,
request: &FundingRateHistoryRequest,
) -> Result<Vec<FundingRateHistory>, Error>
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.
Sourcepub async fn get_price_limit(
&self,
inst_id: &str,
) -> Result<Vec<PriceLimit>, Error>
pub async fn get_price_limit( &self, inst_id: &str, ) -> Result<Vec<PriceLimit>, Error>
Retrieve the price limit for an instrument.
GET /api/v5/public/price-limit. Public.
§Errors
See get_system_time.
Sourcepub async fn get_mark_price(
&self,
request: &InstrumentFamilyRequest,
) -> Result<Vec<MarkPrice>, Error>
pub async fn get_mark_price( &self, request: &InstrumentFamilyRequest, ) -> Result<Vec<MarkPrice>, Error>
Sourcepub async fn get_delivery_exercise_history(
&self,
request: &DeliveryExerciseHistoryRequest,
) -> Result<Vec<DeliveryExercise>, Error>
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.
Sourcepub async fn get_position_tiers(
&self,
request: &PositionTiersRequest,
) -> Result<Vec<PositionTier>, Error>
pub async fn get_position_tiers( &self, request: &PositionTiersRequest, ) -> Result<Vec<PositionTier>, Error>
Sourcepub async fn get_underlying(
&self,
inst_type: InstType,
) -> Result<Vec<String>, Error>
pub async fn get_underlying( &self, inst_type: InstType, ) -> Result<Vec<String>, Error>
Retrieve underlying values for an instrument type.
GET /api/v5/public/underlying. Public.
§Errors
See get_system_time.
Sourcepub async fn get_insurance_fund(
&self,
request: &InsuranceFundRequest,
) -> Result<Vec<InsuranceFund>, Error>
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.
Sourcepub async fn get_convert_contract_coin(
&self,
request: &ConvertContractCoinRequest,
) -> Result<Vec<ConvertContractCoin>, Error>
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.