pub struct PositionClient { /* private fields */ }Implementations§
Source§impl PositionClient
impl PositionClient
pub fn new(client: RestClient) -> Self
Sourcepub async fn get_position_info(
&self,
category: &str,
symbol: Option<&str>,
base_coin: Option<&str>,
settle_coin: Option<&str>,
limit: Option<i32>,
cursor: Option<&str>,
) -> Result<ServerResponse<Value>>
pub async fn get_position_info( &self, category: &str, symbol: Option<&str>, base_coin: Option<&str>, settle_coin: Option<&str>, limit: Option<i32>, cursor: Option<&str>, ) -> Result<ServerResponse<Value>>
Get position info
API: GET /v5/position/list https://bybit-exchange.github.io/docs/v5/position
Sourcepub async fn set_leverage(
&self,
category: &str,
symbol: &str,
buy_leverage: &str,
sell_leverage: &str,
) -> Result<ServerResponse<Value>>
pub async fn set_leverage( &self, category: &str, symbol: &str, buy_leverage: &str, sell_leverage: &str, ) -> Result<ServerResponse<Value>>
Set leverage
API: POST /v5/position/set-leverage https://bybit-exchange.github.io/docs/v5/position/set-leverage
Sourcepub async fn switch_margin_mode(
&self,
category: &str,
symbol: &str,
trade_mode: i32,
buy_leverage: &str,
sell_leverage: &str,
) -> Result<ServerResponse<Value>>
pub async fn switch_margin_mode( &self, category: &str, symbol: &str, trade_mode: i32, buy_leverage: &str, sell_leverage: &str, ) -> Result<ServerResponse<Value>>
Switch between cross/isolated margin
API: POST /v5/position/switch-isolated https://bybit-exchange.github.io/docs/v5/position/switch-isolated
Sourcepub async fn switch_position_mode(
&self,
category: &str,
mode: i32,
symbol: Option<&str>,
coin: Option<&str>,
) -> Result<ServerResponse<Value>>
pub async fn switch_position_mode( &self, category: &str, mode: i32, symbol: Option<&str>, coin: Option<&str>, ) -> Result<ServerResponse<Value>>
Switch position mode
API: POST /v5/position/switch-mode https://bybit-exchange.github.io/docs/v5/position/switch-mode
Sourcepub async fn set_trading_stop(
&self,
category: &str,
symbol: &str,
position_idx: i32,
take_profit: Option<&str>,
stop_loss: Option<&str>,
trailing_stop: Option<&str>,
tp_trigger_by: Option<&str>,
sl_trigger_by: Option<&str>,
active_price: Option<&str>,
tp_size: Option<&str>,
sl_size: Option<&str>,
tp_limit_price: Option<&str>,
sl_limit_price: Option<&str>,
tp_order_type: Option<&str>,
sl_order_type: Option<&str>,
) -> Result<ServerResponse<Value>>
pub async fn set_trading_stop( &self, category: &str, symbol: &str, position_idx: i32, take_profit: Option<&str>, stop_loss: Option<&str>, trailing_stop: Option<&str>, tp_trigger_by: Option<&str>, sl_trigger_by: Option<&str>, active_price: Option<&str>, tp_size: Option<&str>, sl_size: Option<&str>, tp_limit_price: Option<&str>, sl_limit_price: Option<&str>, tp_order_type: Option<&str>, sl_order_type: Option<&str>, ) -> Result<ServerResponse<Value>>
Set Trading Stop (Take profit/Stop loss)
API: POST /v5/position/trading-stop https://bybit-exchange.github.io/docs/v5/position/trading-stop
Sourcepub async fn set_auto_add_margin(
&self,
category: &str,
symbol: &str,
auto_add_margin: i32,
position_idx: Option<i32>,
) -> Result<ServerResponse<Value>>
pub async fn set_auto_add_margin( &self, category: &str, symbol: &str, auto_add_margin: i32, position_idx: Option<i32>, ) -> Result<ServerResponse<Value>>
Set auto add margin
API: POST /v5/position/set-auto-add-margin https://bybit-exchange.github.io/docs/v5/position/set-auto-add-margin
Sourcepub async fn get_closed_pnl(
&self,
category: &str,
symbol: Option<&str>,
start_time: Option<i64>,
end_time: Option<i64>,
limit: Option<i32>,
cursor: Option<&str>,
) -> Result<ServerResponse<Value>>
pub async fn get_closed_pnl( &self, category: &str, symbol: Option<&str>, start_time: Option<i64>, end_time: Option<i64>, limit: Option<i32>, cursor: Option<&str>, ) -> Result<ServerResponse<Value>>
Get closed PnL
API: GET /v5/position/closed-pnl https://bybit-exchange.github.io/docs/v5/position/closed-pnl
Sourcepub async fn set_tpsl_mode(
&self,
category: &str,
symbol: &str,
tp_sl_mode: &str,
) -> Result<ServerResponse<Value>>
pub async fn set_tpsl_mode( &self, category: &str, symbol: &str, tp_sl_mode: &str, ) -> Result<ServerResponse<Value>>
Set TP/SL mode
API: POST /v5/position/set-tpsl-mode https://bybit-exchange.github.io/docs/v5/position/set-tpsl-mode
Sourcepub async fn set_risk_limit(
&self,
category: &str,
symbol: &str,
risk_id: i32,
position_idx: Option<i32>,
) -> Result<ServerResponse<Value>>
pub async fn set_risk_limit( &self, category: &str, symbol: &str, risk_id: i32, position_idx: Option<i32>, ) -> Result<ServerResponse<Value>>
Set risk limit
API: POST /v5/position/set-risk-limit https://bybit-exchange.github.io/docs/v5/position/set-risk-limit
Sourcepub async fn move_positions(
&self,
from_uid: &str,
to_uid: &str,
list: Vec<Value>,
) -> Result<ServerResponse<Value>>
pub async fn move_positions( &self, from_uid: &str, to_uid: &str, list: Vec<Value>, ) -> Result<ServerResponse<Value>>
Move positions
API: POST /v5/position/move-positions https://bybit-exchange.github.io/docs/v5/position/move-positions
Sourcepub async fn get_move_position_history(
&self,
category: Option<&str>,
symbol: Option<&str>,
start_time: Option<i64>,
end_time: Option<i64>,
status: Option<&str>,
block_trade_id: Option<&str>,
limit: Option<i32>,
cursor: Option<&str>,
) -> Result<ServerResponse<Value>>
pub async fn get_move_position_history( &self, category: Option<&str>, symbol: Option<&str>, start_time: Option<i64>, end_time: Option<i64>, status: Option<&str>, block_trade_id: Option<&str>, limit: Option<i32>, cursor: Option<&str>, ) -> Result<ServerResponse<Value>>
Get move position history
API: GET /v5/position/move-history https://bybit-exchange.github.io/docs/v5/position/move-history
Sourcepub async fn confirm_new_risk_limit(
&self,
category: &str,
symbol: &str,
) -> Result<ServerResponse<Value>>
pub async fn confirm_new_risk_limit( &self, category: &str, symbol: &str, ) -> Result<ServerResponse<Value>>
Confirm new risk limit
API: POST /v5/position/confirm-pending-mmr https://bybit-exchange.github.io/docs/v5/position/confirm-pending-mmr
Sourcepub async fn update_margin(
&self,
category: &str,
symbol: &str,
margin: &str,
position_idx: Option<i32>,
) -> Result<ServerResponse<Value>>
pub async fn update_margin( &self, category: &str, symbol: &str, margin: &str, position_idx: Option<i32>, ) -> Result<ServerResponse<Value>>
Add/Reduce margin
API: POST /v5/position/add-margin https://bybit-exchange.github.io/docs/v5/position/manual-add-margin
Sourcepub async fn get_execution(
&self,
category: &str,
symbol: Option<&str>,
order_id: Option<&str>,
order_link_id: Option<&str>,
base_coin: Option<&str>,
start_time: Option<i64>,
end_time: Option<i64>,
exec_type: Option<&str>,
limit: Option<i32>,
cursor: Option<&str>,
) -> Result<ServerResponse<Value>>
pub async fn get_execution( &self, category: &str, symbol: Option<&str>, order_id: Option<&str>, order_link_id: Option<&str>, base_coin: Option<&str>, start_time: Option<i64>, end_time: Option<i64>, exec_type: Option<&str>, limit: Option<i32>, cursor: Option<&str>, ) -> Result<ServerResponse<Value>>
Get execution
API: GET /v5/execution/list https://bybit-exchange.github.io/docs/v5/position/execution