DpExchange.Core.Types.Order (DpExchangeCore v0.1.4)

Copy Markdown View Source

Normalised order, returned by every venue package.

:created_at and :updated_at are the venue's own values where it supplies them and nil where it does not. nil is the honest answer; a substituted local clock would be a plausible value with the wrong meaning.

Not every venue supports every order_type/0 or reports every status/0. The union here is what the contract can express; what a given venue can actually accept is declared by that package's capabilities/0, and asking for one it does not support is an error rather than a silent downgrade to the nearest available type.

Summary

Types

order_type()

@type order_type() ::
  :market | :limit | :stop | :stop_limit | :post_only | :ioc | :fok

side()

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

status()

@type status() ::
  :pending
  | :open
  | :partially_filled
  | :filled
  | :cancelled
  | :rejected
  | :expired

t()

@type t() :: %DpExchange.Core.Types.Order{
  average_price: Decimal.t() | nil,
  created_at: DateTime.t() | nil,
  fee: Decimal.t() | nil,
  fee_currency: String.t() | nil,
  filled_quantity: Decimal.t() | nil,
  id: String.t(),
  order_type: order_type(),
  price: Decimal.t() | nil,
  provider: atom() | String.t(),
  quantity: Decimal.t(),
  side: side(),
  status: status(),
  stop_price: Decimal.t() | nil,
  symbol: String.t(),
  updated_at: DateTime.t() | nil
}