Bingex.Order (Bingex v0.1.7)

Defines the structure and types for orders in BingX.

This module provides the Bingex.Order struct along with associated types for order properties such as type, status, side, position side, and margin mode. It also includes functions to create and validate orders.

Summary

Functions

Creates Bingex.Order struct using the provided parameters. Note that it only performs validation for the specified values, leaving nil for the rest.

The same as new/1 but returns struct and raises error instead of tuples.

Types

execution_type()

@type execution_type() :: :placed | :canceled | :calculated | :expired | :trade

margin_mode()

@type margin_mode() :: :isolated | :crossed

position_side()

@type position_side() :: :long | :short | :both

side()

@type side() :: :buy | :sell

status()

@type status() ::
  :placed
  | :triggered
  | :filled
  | :partially_filled
  | :canceled
  | :canceled
  | :expired

t()

@type t() :: %Bingex.Order{
  position_side: position_side(),
  price: nil | float(),
  quantity: float(),
  side: side(),
  stop_price: nil | float(),
  symbol: binary(),
  type: type(),
  working_type: nil | working_type()
}

Represents an order in BingX.

Fields:

  • type - The type of order (e.g., market, limit, stop-loss).
  • symbol - The trading pair symbol.
  • side - The order side, either :buy or :sell.
  • position_side - Specifies whether the position is :long, :short, or :both.
  • quantity - The amount of the asset to be traded.
  • price - The order price.
  • stop_price - The stop price for stop-loss or take-profit orders.
  • working_type - The price type used (:mark_price, :index_price, or :contract_price).

type()

@type type() ::
  :market
  | :trigger_market
  | :stop_loss
  | :take_profit
  | :limit
  | :stop_loss_market
  | :take_profit_market

working_type()

@type working_type() :: :mark_price | :index_price | :contract_price

Functions

new(params)

Creates Bingex.Order struct using the provided parameters. Note that it only performs validation for the specified values, leaving nil for the rest.

new!(params)

The same as new/1 but returns struct and raises error instead of tuples.