@@ -2,10 +2,7 @@ use std::sync::Arc;
22
33use color_eyre:: eyre:: { Context , Result , bail} ;
44use nautilus_bybit:: {
5- common:: {
6- credential:: Credential ,
7- enums:: { BybitEnvironment , BybitProductType } ,
8- } ,
5+ common:: enums:: { BybitEnvironment , BybitProductType } ,
96 http:: query:: { BybitInstrumentsInfoParamsBuilder , BybitTickersParamsBuilder } ,
107} ;
118use nautilus_model:: identifiers:: InstrumentId ;
@@ -188,10 +185,11 @@ pub(crate) async fn main(args: AdjustPosArgs, live_settings: Arc<LiveSettings>,
188185 if args. duration . is_some ( ) {
189186 log ! ( "Using WebSocket chase-limit execution with duration: {:?}" , args. duration) ;
190187
191- // Create credential for WebSocket (clone exchange_name since it was moved)
188+ // Get API credentials for WebSocket
192189 let config = live_settings. config ( ) ?;
193190 let exchange_config = config. get_exchange ( exchange_name) ?;
194- let credential = Credential :: new ( exchange_config. api_pubkey . clone ( ) , exchange_config. api_secret . expose_secret ( ) . to_string ( ) ) ;
191+ let api_key = exchange_config. api_pubkey . clone ( ) ;
192+ let api_secret = exchange_config. api_secret . expose_secret ( ) . to_string ( ) ;
195193
196194 // Determine environment
197195 let environment = if testnet { BybitEnvironment :: Testnet } else { BybitEnvironment :: Mainnet } ;
@@ -200,9 +198,11 @@ pub(crate) async fn main(args: AdjustPosArgs, live_settings: Arc<LiveSettings>,
200198 // Format: "SYMBOL.VENUE" e.g., "BTCUSDT.BYBIT"
201199 let instrument_id = InstrumentId :: from ( format ! ( "{}.BYBIT" , symbol) . as_str ( ) ) ;
202200
203- let filled_qty = crate :: ws_chase_limit:: execute_ws_chase_limit ( & raw_client, credential, environment, & symbol, instrument_id, side, quantity, qty_step, tick_size, args. duration )
204- . await
205- . context ( "WebSocket chase-limit execution failed" ) ?;
201+ let filled_qty = crate :: ws_chase_limit:: execute_ws_chase_limit (
202+ & raw_client, api_key, api_secret, environment, & symbol, instrument_id, side, quantity, qty_step, tick_size, args. duration ,
203+ )
204+ . await
205+ . context ( "WebSocket chase-limit execution failed" ) ?;
206206
207207 let filled_notional = filled_qty * current_price;
208208 println ! ( "✅ Chase-limit execution completed!" ) ;
0 commit comments