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,
request: &InstrumentsRequest<'_>,
) -> Result<Vec<Instrument>, Error>
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.
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 RestError::Okx 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,
request: &InstIdRequest<'_>,
) -> Result<Vec<FundingRate>, Error>
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.
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,
request: &InstIdRequest<'_>,
) -> Result<Vec<PriceLimit>, Error>
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.
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,
request: &UnderlyingRequest<'_>,
) -> Result<Vec<Vec<String>>, Error>
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.
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.
Sourcepub async fn get_option_summary(
&self,
request: &OptionSummaryRequest<'_>,
) -> Result<Vec<OptionSummary>, Error>
pub async fn get_option_summary( &self, request: &OptionSummaryRequest<'_>, ) -> Result<Vec<OptionSummary>, Error>
Sourcepub async fn get_estimated_price(
&self,
request: &InstIdRequest<'_>,
) -> Result<Vec<EstimatedPrice>, Error>
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.
Sourcepub async fn get_discount_rate_interest_free_quota(
&self,
request: &CurrencyRequest<'_>,
) -> Result<Vec<DiscountRateInterestFreeQuota>, Error>
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.
Sourcepub async fn get_interest_rate_loan_quota(
&self,
request: &InterestRateLoanQuotaRequest,
) -> Result<Vec<InterestRateLoanQuota>, Error>
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.
Sourcepub async fn get_instrument_tick_bands(
&self,
request: &InstrumentTickBandsRequest<'_>,
) -> Result<Vec<InstrumentTickBand>, Error>
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.
Sourcepub async fn get_option_trades(
&self,
request: &PublicOptionTradesRequest<'_>,
) -> Result<Vec<PublicOptionTrade>, Error>
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.
Sourcepub async fn get_market_data_history(
&self,
request: &MarketDataHistoryRequest<'_>,
) -> Result<Vec<MarketDataHistory>, Error>
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.
Sourcepub async fn get_mm_instrument_types(
&self,
request: &MmInstrumentTypesRequest<'_>,
) -> Result<Vec<MmInstrumentType>, Error>
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.
Sourcepub async fn get_economic_calendar(
&self,
request: &EconomicCalendarRequest<'_>,
) -> Result<Vec<EconomicCalendar>, Error>
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.