Bingex.Swap.PositionUpdate (Bingex v0.1.7)

Represents position update information for a swap contract in BingX (ws event).

This module provides a structured representation of real-time position updates, including margin details, profit/loss, and pricing information.

Summary

Types

t()

Position update information.

Types

t()

@type t() :: %Bingex.Swap.PositionUpdate{
  average_price: float(),
  margin: float(),
  margin_mode: Bingex.Order.margin_mode(),
  position_margin: float(),
  realized_pnl: float(),
  side: Bingex.Order.position_side(),
  symbol: binary(),
  unrealized_pnl: float()
}

Position update information.

Fields:

  • side (Order.position_side()): Position type (e.g., long, short).
  • symbol (binary): Trading pair symbol (e.g., "BTC-USDT").
  • margin (float): Initial margin allocated to the position.
  • position_margin (float): Current margin assigned to the position.
  • average_price (float): Average entry price of the position.
  • unrealized_pnl (float): Unrealized profit or loss.
  • realized_pnl (float): Realized profit or loss from position adjustments.
  • margin_mode (Order.margin_mode()): Margin mode (e.g., isolated, cross).

Functions

decode(data)

@spec decode(map()) :: {:ok, t()} | :error