Struct bybit::position::PositionManager
source · pub struct PositionManager<'a> {
pub client: Client<'a>,
pub recv_window: u16,
}Fields§
§client: Client<'a>§recv_window: u16Implementations§
source§impl<'a> PositionManager<'_>
impl<'a> 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<'a> Bybit<'a> for PositionManager<'a>
impl<'a> Bybit<'a> for PositionManager<'a>
source§impl<'a> Clone for PositionManager<'a>
impl<'a> Clone for PositionManager<'a>
source§fn clone(&self) -> PositionManager<'a>
fn clone(&self) -> PositionManager<'a>
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<'a> Freeze for PositionManager<'a>
impl<'a> !RefUnwindSafe for PositionManager<'a>
impl<'a> Send for PositionManager<'a>
impl<'a> Sync for PositionManager<'a>
impl<'a> Unpin for PositionManager<'a>
impl<'a> !UnwindSafe for PositionManager<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)