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
Types
Represents an order in BingX.
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
@type execution_type() :: :placed | :canceled | :calculated | :expired | :trade
@type margin_mode() :: :isolated | :crossed
@type position_side() :: :long | :short | :both
@type side() :: :buy | :sell
@type status() ::
:placed
| :triggered
| :filled
| :partially_filled
| :canceled
| :canceled
| :expired
@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() ::
:market
| :trigger_market
| :stop_loss
| :take_profit
| :limit
| :stop_loss_market
| :take_profit_market
@type working_type() :: :mark_price | :index_price | :contract_price
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.