use crate::error::OkxResult;
use crate::rest::RestClient;
use crate::types::request::public::*;
use crate::types::response::public::*;
impl RestClient {
pub async fn get_instruments(
&self,
params: &GetInstrumentsRequest,
) -> OkxResult<Vec<Instrument>> {
self.get("/api/v5/public/instruments", Some(params)).await
}
pub async fn get_delivery_exercise_history(
&self,
params: &GetDeliveryExerciseHistoryRequest,
) -> OkxResult<Vec<DeliveryExerciseHistory>> {
self.get("/api/v5/public/delivery-exercise-history", Some(params))
.await
}
pub async fn get_open_interest(
&self,
params: &GetOpenInterestRequest,
) -> OkxResult<Vec<OpenInterest>> {
self.get("/api/v5/public/open-interest", Some(params)).await
}
pub async fn get_funding_rate(
&self,
params: &GetFundingRateRequest,
) -> OkxResult<Vec<FundingRate>> {
self.get("/api/v5/public/funding-rate", Some(params)).await
}
pub async fn get_funding_rate_history(
&self,
params: &GetFundingRateHistoryRequest,
) -> OkxResult<Vec<FundingRate>> {
self.get("/api/v5/public/funding-rate-history", Some(params))
.await
}
pub async fn get_mark_price(&self, params: &GetMarkPriceRequest) -> OkxResult<Vec<MarkPrice>> {
self.get("/api/v5/public/mark-price", Some(params)).await
}
pub async fn get_position_tiers(
&self,
params: &GetPositionTiersRequest,
) -> OkxResult<Vec<PositionTier>> {
self.get("/api/v5/public/position-tiers", Some(params))
.await
}
pub async fn get_insurance_fund(
&self,
params: &GetInsuranceFundRequest,
) -> OkxResult<Vec<InsuranceFund>> {
self.get("/api/v5/public/insurance-fund", Some(params))
.await
}
pub async fn get_unit_convert(
&self,
params: &GetUnitConvertRequest,
) -> OkxResult<Vec<UnitConvertResult>> {
self.get("/api/v5/public/convert-contract-coin", Some(params))
.await
}
pub async fn get_option_tick_bands(
&self,
params: &GetOptionTickBandsRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get("/api/v5/public/instrument-tick-bands", Some(params))
.await
}
pub async fn get_estimated_price(
&self,
params: &GetEstimatedPriceRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get("/api/v5/public/estimated-price", Some(params))
.await
}
pub async fn get_discount_rate(
&self,
params: &GetDiscountRateRequest,
) -> OkxResult<Vec<DiscountRate>> {
self.get(
"/api/v5/public/discount-rate-interest-free-quota",
Some(params),
)
.await
}
pub async fn get_premium_history(
&self,
params: &GetPremiumHistoryRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get("/api/v5/public/premium-history", Some(params))
.await
}
pub async fn get_liquidation_orders(
&self,
params: &GetLiquidationOrdersRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get("/api/v5/public/liquidation-orders", Some(params))
.await
}
pub async fn get_server_time(&self) -> OkxResult<Vec<ServerTime>> {
self.get::<ServerTime, ()>("/api/v5/public/time", None)
.await
}
pub async fn get_historical_market_data(
&self,
params: &GetHistoricalMarketDataRequest,
) -> OkxResult<Vec<MarketDataHistoryResult>> {
self.get("/api/v5/public/market-data-history", Some(params))
.await
}
pub async fn get_event_contract_series(
&self,
params: &GetEventContractSeriesRequest,
) -> OkxResult<Vec<EventContractSeries>> {
self.get("/api/v5/public/event-contract/series", Some(params))
.await
}
pub async fn get_event_contract_events(
&self,
params: &GetEventContractEventsRequest,
) -> OkxResult<Vec<EventContractEvent>> {
self.get("/api/v5/public/event-contract/events", Some(params))
.await
}
pub async fn get_event_contract_markets(
&self,
params: &GetEventContractMarketsRequest,
) -> OkxResult<Vec<EventContractMarket>> {
self.get("/api/v5/public/event-contract/markets", Some(params))
.await
}
pub async fn get_mm_instrument_types(
&self,
params: &GetMmInstrumentTypesRequest,
) -> OkxResult<Vec<MmInstrumentType>> {
self.get("/api/v5/public/mm-instrument-types", Some(params))
.await
}
pub async fn get_announcements(
&self,
params: &GetAnnouncementsRequest,
) -> OkxResult<Vec<Announcement>> {
self.get("/api/v5/support/announcements", Some(params))
.await
}
}