Struct bybit::position::PositionManager
source · pub struct PositionManager {
pub client: Client,
pub recv_window: u64,
}Fields§
§client: Client§recv_window: u64Implementations§
source§impl PositionManager
impl PositionManager
sourcepub async fn get_info<'a>(
&self,
req: PositionRequest<'a>
) -> Result<Vec<PositionInfo>>
pub async fn get_info<'a>( &self, req: PositionRequest<'a> ) -> Result<Vec<PositionInfo>>
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<'a>(
&self,
req: LeverageRequest<'a>
) -> Result<LeverageResponse>
pub async fn set_leverage<'a>( &self, req: LeverageRequest<'a> ) -> Result<LeverageResponse>
sourcepub async fn set_margin_mode<'a>(
&self,
req: ChangeMarginRequest<'a>
) -> Result<ChangeMarginResponse>
pub async fn set_margin_mode<'a>( &self, req: ChangeMarginRequest<'a> ) -> Result<ChangeMarginResponse>
sourcepub async fn set_position_mode<'a>(
&self,
req: MarginModeRequest<'a>
) -> Result<MarginModeResponse>
pub async fn set_position_mode<'a>( &self, req: MarginModeRequest<'a> ) -> Result<MarginModeResponse>
sourcepub async fn set_risk_limit<'a>(
&self,
req: SetRiskLimit<'a>
) -> Result<SetRiskLimitResult>
pub async fn set_risk_limit<'a>( &self, req: SetRiskLimit<'a> ) -> Result<SetRiskLimitResult>
sourcepub async fn set_trading_stop<'a>(
&self,
req: TradingStopRequest<'a>
) -> Result<TradingStopResponse>
pub async fn set_trading_stop<'a>( &self, req: TradingStopRequest<'a> ) -> Result<TradingStopResponse>
pub async fn set_add_margin<'a>( &self, req: AddMarginRequest<'a> ) -> Result<AddMarginResponse>
pub async fn add_or_reduce_margin<'a>( &self, req: AddReduceMarginRequest<'a> ) -> Result<AddReduceMarginResult>
pub async fn get_closed_pnl<'a>( &self, req: ClosedPnlRequest<'a> ) -> Result<ClosedPnlResult>
pub async fn move_position<'a>( &self, req: MovePositionRequest<'a> ) -> Result<MovePositionResult>
pub async fn move_position_history<'a>( &self, req: MoveHistoryRequest<'a> ) -> Result<MoveHistoryResult>
Trait Implementations§
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 !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