pub struct PositionManager {
pub client: Client,
pub recv_window: u16,
}Fields§
§client: Client§recv_window: u16Implementations§
Source§impl PositionManager
impl PositionManager
Sourcepub async fn get_info<'b>(
&self,
req: PositionRequest<'_>,
) -> Result<InfoResponse, BybitError>
pub async fn get_info<'b>( &self, req: PositionRequest<'_>, ) -> Result<InfoResponse, BybitError>
Asynchronously retrieves information about a position based on the provided request.
§Arguments
req- The position request containing the category, symbol, base coin, settle coin, and limit.
§Returns
A Result containing a vector of PositionInfo if the operation is successful, or an error if it fails.
§Example
use crate::model::{PositionRequest, Category};
use crate::errors::Result;
use crate::api::PositionInfo;
use my_module::PositionManager;
#[tokio::main]
async fn main() -> Result<()> {
let position_manager = PositionManager::new();
let request = PositionRequest::new(Category::Linear, Some("symbol"), Some("base_coin"), Some("settle_coin"), Some(10));
let position_info = position_manager.get_info(request).await?;
Ok(())
}Sourcepub async fn set_leverage<'b>(
&self,
req: LeverageRequest<'_>,
) -> Result<LeverageResponse, BybitError>
pub async fn set_leverage<'b>( &self, req: LeverageRequest<'_>, ) -> Result<LeverageResponse, BybitError>
Sourcepub async fn set_margin_mode<'b>(
&self,
req: ChangeMarginRequest<'_>,
) -> Result<ChangeMarginResponse, BybitError>
pub async fn set_margin_mode<'b>( &self, req: ChangeMarginRequest<'_>, ) -> Result<ChangeMarginResponse, BybitError>
Sourcepub async fn set_position_mode<'b>(
&self,
req: MarginModeRequest<'_>,
) -> Result<MarginModeResponse, BybitError>
pub async fn set_position_mode<'b>( &self, req: MarginModeRequest<'_>, ) -> Result<MarginModeResponse, BybitError>
Sourcepub async fn set_risk_limit<'b>(
&self,
req: SetRiskLimit<'_>,
) -> Result<SetRiskLimitResponse, BybitError>
pub async fn set_risk_limit<'b>( &self, req: SetRiskLimit<'_>, ) -> Result<SetRiskLimitResponse, BybitError>
Sourcepub async fn set_trading_stop<'b>(
&self,
req: TradingStopRequest<'_>,
) -> Result<TradingStopResponse, BybitError>
pub async fn set_trading_stop<'b>( &self, req: TradingStopRequest<'_>, ) -> Result<TradingStopResponse, BybitError>
Sourcepub async fn set_add_margin<'b>(
&self,
req: AddMarginRequest<'_>,
) -> Result<AddMarginResponse, BybitError>
pub async fn set_add_margin<'b>( &self, req: AddMarginRequest<'_>, ) -> Result<AddMarginResponse, BybitError>
Sourcepub async fn add_or_reduce_margin<'b>(
&self,
req: AddReduceMarginRequest<'_>,
) -> Result<AddReduceMarginResponse, BybitError>
pub async fn add_or_reduce_margin<'b>( &self, req: AddReduceMarginRequest<'_>, ) -> Result<AddReduceMarginResponse, BybitError>
pub async fn get_closed_pnl<'b>( &self, req: ClosedPnlRequest<'_>, ) -> Result<ClosedPnlResponse, BybitError>
Sourcepub async fn move_position<'b>(
&self,
req: MovePositionRequest<'_>,
) -> Result<MovePositionResponse, BybitError>
pub async fn move_position<'b>( &self, req: MovePositionRequest<'_>, ) -> Result<MovePositionResponse, BybitError>
Sourcepub async fn move_position_history<'b>(
&self,
req: MoveHistoryRequest<'_>,
) -> Result<MoveHistoryResponse, BybitError>
pub async fn move_position_history<'b>( &self, req: MoveHistoryRequest<'_>, ) -> Result<MoveHistoryResponse, BybitError>
Trait Implementations§
Source§impl Bybit for PositionManager
impl Bybit for PositionManager
Source§fn new(api_key: Option<String>, secret_key: Option<String>) -> PositionManager
fn new(api_key: Option<String>, secret_key: Option<String>) -> PositionManager
Creates a new instance of the module with default configuration. Read more
Source§fn new_with_config(
config: &Config,
api_key: Option<String>,
secret_key: Option<String>,
) -> PositionManager
fn new_with_config( config: &Config, api_key: Option<String>, secret_key: Option<String>, ) -> PositionManager
Creates a new instance of the module with custom configuration. Read more
Source§impl Clone for PositionManager
impl Clone for PositionManager
Source§fn clone(&self) -> PositionManager
fn clone(&self) -> PositionManager
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PositionManager
impl !RefUnwindSafe for PositionManager
impl Send for PositionManager
impl Sync for PositionManager
impl Unpin for PositionManager
impl !UnwindSafe for PositionManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more