xapi_okx/client/
public.rs1use crate::{
2 client::Okx,
3 common::{ratelimiter::OkxRateLimitKey, response::OkxRestRespType},
4 data::{
5 instrument::{OkxInstrument, OkxInstrumentParams},
6 system_time::OkxSystemTime,
7 },
8};
9use nonzero_ext::nonzero;
10use reqwest::Method;
11use xapi_shared::rest::SharedRestClientTrait;
12
13impl Okx {
14 pub async fn get_instruments(
18 &self,
19 params: &OkxInstrumentParams,
20 ) -> OkxRestRespType<OkxInstrument> {
21 let rate_limit_key = OkxRateLimitKey::new_ip_based("/api/v5/public/instruments");
22
23 self.executor
24 .call(
25 &[(rate_limit_key, nonzero!(1u32))],
26 false,
27 Method::GET,
28 self.executor
29 .get_endpoint()
30 .build_rest_api_url("/api/v5/public/instruments"),
31 Some(params),
32 )
33 .await
34 }
35
36 pub async fn get_system_time(&self) -> OkxRestRespType<OkxSystemTime> {
40 let rate_limit_key = OkxRateLimitKey::new_ip_based("/api/v5/public/time");
41
42 self.executor
43 .call_with_no_payload(
44 &[(rate_limit_key, nonzero!(1u32))],
45 false,
46 Method::GET,
47 self.executor
48 .get_endpoint()
49 .build_rest_api_url("/api/v5/public/time"),
50 )
51 .await
52 }
53}