Current section

Files

Jump to
bingex lib bingex model order.ex
Raw

lib/bingex/model/order.ex

defmodule Bingex.Model.Order do
@moduledoc """
Defines the structure and types for orders in BingX.
"""
alias Bingex.Types
defstruct [
:type,
:symbol,
:side,
:position_side,
:quantity,
:price,
:stop_price,
:working_type
]
@type t() :: %__MODULE__{
:type => type(),
:symbol => Types.symbol(),
:side => side(),
:position_side => position_side(),
:quantity => float(),
:price => nil | float(),
:stop_price => nil | float(),
:working_type => nil | working_type()
}
@type type() ::
:market
| :trigger_market
| :stop_loss
| :take_profit
| :limit
| :stop_loss_market
| :take_profit_market
@type status() ::
:placed
| :triggered
| :filled
| :partially_filled
| :canceled
| :canceled
| :expired
@type side() :: :buy | :sell
@type position_side() :: :long | :short | :both
@type working_type() :: :mark_price | :index_price | :contract_price
@type execution_type() ::
:placed
| :canceled
| :calculated
| :expired
| :trade
@type margin_mode() :: :isolated | :crossed
def new(params), do: struct!(__MODULE__, params)
end