@@ -53,8 +53,6 @@ pub trait ExchangeClient: Send + Sync {
5353 body : Option < & Value > ,
5454 creds : & Credentials ,
5555 ) -> impl Future < Output = Result < Value > > + Send ;
56- fn base_url ( & self ) -> & str ;
57- fn is_testnet ( & self ) -> bool ;
5856}
5957
6058use std:: future:: Future ;
@@ -63,7 +61,6 @@ use std::future::Future;
6361pub struct BitmexClient {
6462 http : reqwest:: Client ,
6563 pub ( crate ) base_url : String ,
66- pub ( crate ) testnet : bool ,
6764 verbose : bool ,
6865 /// When Some, timing phases are collected and printed for every request.
6966 timing : Option < super :: timing:: TimingHandle > ,
@@ -114,19 +111,17 @@ impl BitmexClient {
114111 Ok ( Self {
115112 http : build_http_client ( timing_handle. as_ref ( ) ) ?,
116113 base_url,
117- testnet,
118114 verbose,
119115 timing : timing_handle,
120116 } )
121117 }
122118
123119 /// Create a new client with an explicit base URL override.
124- pub fn new_with_url ( base_url : String , testnet : bool , verbose : bool , timing : bool ) -> Result < Self > {
120+ pub fn new_with_url ( base_url : String , verbose : bool , timing : bool ) -> Result < Self > {
125121 let timing_handle = timing. then ( super :: timing:: new_handle) ;
126122 Ok ( Self {
127123 http : build_http_client ( timing_handle. as_ref ( ) ) ?,
128124 base_url,
129- testnet,
130125 verbose,
131126 timing : timing_handle,
132127 } )
@@ -202,25 +197,6 @@ impl BitmexClient {
202197 self . parse_response ( resp, "PUT" , & url) . await
203198 }
204199
205- /// Authenticated PATCH with JSON body.
206- pub async fn patch ( & self , path : & str , body : & Value , creds : & Credentials ) -> Result < Value > {
207- let full_path = format ! ( "/api/v1{path}" ) ;
208- let body_str = serde_json:: to_string ( body) ?;
209- let url = self . url ( path, "" ) ;
210- if self . verbose { crate :: cli:: output:: verbose ( & format ! ( "PATCH {url}" ) ) ; }
211- self . begin_request ( ) ;
212- let resp = super :: middleware:: execute_with_retry ( self . verbose , || async {
213- let expires = auth:: generate_expires ( ) ?;
214- let sig = auth:: sign ( "PATCH" , & full_path, expires, & body_str, & creds. api_secret ) ?;
215- let headers = self . auth_headers ( & creds. api_key , expires, & sig) ?;
216- self . http . patch ( & url) . headers ( headers)
217- . header ( "Content-Type" , "application/json" )
218- . body ( body_str. clone ( ) ) . send ( ) . await
219- . map_err ( |e| BitmexError :: Network { message : e. to_string ( ) } )
220- } ) . await ?;
221- self . parse_response ( resp, "PATCH" , & url) . await
222- }
223-
224200 /// Authenticated DELETE, optional JSON body.
225201 pub async fn delete (
226202 & self ,
@@ -413,14 +389,6 @@ impl ExchangeClient for BitmexClient {
413389 ) -> Result < Value > {
414390 BitmexClient :: delete ( self , path, query, body, creds) . await
415391 }
416-
417- fn base_url ( & self ) -> & str {
418- & self . base_url
419- }
420-
421- fn is_testnet ( & self ) -> bool {
422- self . testnet
423- }
424392}
425393
426394/// Extract a human-readable error message from a BitMEX error response body.
0 commit comments