Trading.Order (trading v0.1.0)
Represents a trading order with various types and attributes.
Summary
Functions
Checks if an order is active.
Checks if an order can be executed at a given price.
Fills an order partially or completely.
Creates an iceberg order.
Creates a limit order.
Creates a market order.
Creates a new order with the given parameters.
Creates a stop order.
Updates order status.
Validates an order.
Types
@type order_type() :: :market | :limit | :stop | :stop_limit | :iceberg
@type side() :: :buy | :sell
@type status() :: :new | :partially_filled | :filled | :cancelled | :rejected
@type t() :: %Trading.Order{ client_id: String.t() | nil, hidden_quantity: pos_integer() | nil, id: String.t(), metadata: map() | nil, price: float() | nil, quantity: pos_integer(), remaining_quantity: pos_integer() | nil, side: side(), status: status(), stop_price: float() | nil, time_in_force: time_in_force(), timestamp: integer(), type: order_type() }
@type time_in_force() :: :day | :gtc | :ioc | :fok
Functions
Checks if an order is active.
Checks if an order can be executed at a given price.
@spec fill(t(), pos_integer()) :: {:ok, t()} | {:error, String.t()}
Fills an order partially or completely.
@spec iceberg_order( String.t(), side(), float(), pos_integer(), pos_integer(), keyword() ) :: t()
Creates an iceberg order.
Creates a limit order.
@spec market_order(String.t(), side(), pos_integer(), keyword()) :: t()
Creates a market order.
@spec new(String.t(), side(), float() | nil, pos_integer(), order_type(), keyword()) :: t()
Creates a new order with the given parameters.
Creates a stop order.
Updates order status.
Validates an order.