pub struct PositionItem<'a> {
pub category: Category,
pub symbol: Cow<'a, str>,
pub price: f64,
pub side: Side,
pub qty: f64,
}Expand description
Represents a single position to be moved between accounts.
Part of the MovePositionRequest, this struct details the position to transfer, including its category, symbol, and trade parameters. Bots use this to specify which positions to move and at what price.
Fields§
§category: CategoryThe product category (e.g., Linear, Inverse).
Specifies the instrument type of the position. Bots must set this to match the position’s contract type.
symbol: Cow<'a, str>The trading pair symbol (e.g., “BTCUSDT”).
Identifies the perpetual futures contract for the position. Bots must specify a valid symbol.
price: f64The transfer price.
The price at which the position is transferred, used for valuation between accounts. Bots should set this based on the current mark price or a mutually agreed value to ensure fair transfer.
side: SideThe position side (Buy or Sell).
Indicates whether the position is long (Buy) or short (Sell). Bots use this to ensure the correct position direction is transferred.
qty: f64The quantity of the position to move.
The amount of the base asset to transfer. Bots should ensure this does not exceed the available position size in the source account.
Implementations§
Source§impl<'a> PositionItem<'a>
impl<'a> PositionItem<'a>
Sourcepub fn new(
category: Category,
symbol: &'a str,
price: f64,
side: Side,
qty: f64,
) -> Self
pub fn new( category: Category, symbol: &'a str, price: f64, side: Side, qty: f64, ) -> Self
Constructs a new PositionItem with specified parameters.
Allows customization of the position to move. Bots should use this to specify the category, symbol, price, side, and quantity of the position.
Sourcepub fn default() -> PositionItem<'a>
pub fn default() -> PositionItem<'a>
Creates a default PositionItem.
Returns a position item with category set to Linear, symbol set to "BTCUSDT", price and qty set to 0.0, and side set to Buy. Suitable for testing but should be customized for production.
Trait Implementations§
Source§impl<'a> Clone for PositionItem<'a>
impl<'a> Clone for PositionItem<'a>
Source§fn clone(&self) -> PositionItem<'a>
fn clone(&self) -> PositionItem<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more