glupbit/exchange/order

Order management — create, query, cancel orders.

Types

Parameters for canceling an existing order and creating a replacement.

pub type CancelAndNewOrder {
  CancelAndNewOrder(
    prev_order_uuid: option.Option(String),
    prev_order_identifier: option.Option(String),
    new_market: option.Option(String),
    new_side: option.Option(String),
    new_volume: option.Option(String),
    new_price: option.Option(String),
    new_ord_type: option.Option(String),
    new_identifier: option.Option(String),
    new_time_in_force: option.Option(String),
    new_smp_type: option.Option(String),
  )
}

Constructors

Minimal order reference returned by batch cancel endpoints.

pub type CancelledOrder {
  CancelledOrder(uuid: String, market: String)
}

Constructors

  • CancelledOrder(uuid: String, market: String)

Parameters for creating a new order.

pub type NewOrder {
  NewOrder(
    market: types.Market,
    side: types.OrderSide,
    ord_type: types.OrderType,
    volume: option.Option(String),
    price: option.Option(String),
    identifier: option.Option(String),
    time_in_force: option.Option(types.TimeInForce),
    smp_type: option.Option(types.SmpType),
  )
}

Constructors

Order constraints and account info for a market.

pub type OrderChance {
  OrderChance(
    bid_fee: String,
    ask_fee: String,
    market_id: String,
    bid_account_currency: String,
    bid_account_balance: String,
    ask_account_currency: String,
    ask_account_balance: String,
  )
}

Constructors

  • OrderChance(
      bid_fee: String,
      ask_fee: String,
      market_id: String,
      bid_account_currency: String,
      bid_account_balance: String,
      ask_account_currency: String,
      ask_account_balance: String,
    )

Detailed order info, optionally including trade executions.

pub type OrderDetail {
  OrderDetail(
    market: String,
    uuid: String,
    side: String,
    ord_type: String,
    price: option.Option(String),
    state: String,
    created_at: String,
    volume: option.Option(String),
    remaining_volume: option.Option(String),
    executed_volume: String,
    trades_count: Int,
    trades: option.Option(List(TradeExecution)),
  )
}

Constructors

Response from order creation, test, or cancel-and-new operations.

pub type OrderResponse {
  OrderResponse(
    market: String,
    uuid: String,
    side: String,
    ord_type: String,
    price: option.Option(String),
    state: String,
    created_at: String,
    volume: option.Option(String),
    remaining_volume: option.Option(String),
    executed_volume: String,
    reserved_fee: String,
    remaining_fee: String,
    paid_fee: String,
    locked: String,
    trades_count: Int,
    time_in_force: option.Option(String),
    identifier: option.Option(String),
    smp_type: option.Option(String),
    prevented_volume: option.Option(String),
    prevented_locked: option.Option(String),
    trades: option.Option(List(TradeExecution)),
  )
}

Constructors

A single fill within an order.

pub type TradeExecution {
  TradeExecution(
    market: String,
    uuid: String,
    price: String,
    volume: String,
    funds: String,
    created_at: String,
    side: String,
    trend: option.Option(String),
  )
}

Constructors

  • TradeExecution(
      market: String,
      uuid: String,
      price: String,
      volume: String,
      funds: String,
      created_at: String,
      side: String,
      trend: option.Option(String),
    )

Values

pub fn batch_cancel_orders(
  c: client.AuthClient,
  market market: option.Option(types.Market),
  side side: option.Option(types.OrderSide),
) -> Result(
  types.ApiResponse(List(CancelledOrder)),
  types.ApiError,
)

Batch-cancel open orders. DELETE /orders/open

pub fn cancel_and_new_order(
  c: client.AuthClient,
  order order: CancelAndNewOrder,
) -> Result(types.ApiResponse(OrderResponse), types.ApiError)

Cancel an existing order and create a replacement. POST /orders/cancel_and_new

pub fn cancel_order(
  c: client.AuthClient,
  uuid uuid: String,
) -> Result(types.ApiResponse(OrderDetail), types.ApiError)

Cancel a single order by UUID. DELETE /order

pub fn cancel_order_by_identifier(
  c: client.AuthClient,
  identifier id: String,
) -> Result(types.ApiResponse(OrderDetail), types.ApiError)

Cancel a single order by identifier. DELETE /order

pub fn cancel_orders_by_uuids(
  c: client.AuthClient,
  uuids uuids: List(String),
) -> Result(
  types.ApiResponse(List(CancelledOrder)),
  types.ApiError,
)

Cancel multiple orders by UUIDs. DELETE /orders/uuids

pub fn create_order(
  c: client.AuthClient,
  order order: NewOrder,
) -> Result(types.ApiResponse(OrderResponse), types.ApiError)

Create a new order. POST /orders

pub fn get_order(
  c: client.AuthClient,
  uuid uuid: String,
) -> Result(types.ApiResponse(OrderDetail), types.ApiError)

Get a single order by UUID. GET /order

pub fn get_order_by_identifier(
  c: client.AuthClient,
  identifier id: String,
) -> Result(types.ApiResponse(OrderDetail), types.ApiError)

Get a single order by client identifier. GET /order

pub fn get_order_chance(
  c: client.AuthClient,
  market market: types.Market,
) -> Result(types.ApiResponse(OrderChance), types.ApiError)

Get order constraints for a market. GET /orders/chance

pub fn list_closed_orders(
  c: client.AuthClient,
  market market: option.Option(types.Market),
  state state: option.Option(String),
  start_time start_time: option.Option(String),
  end_time end_time: option.Option(String),
  limit limit: option.Option(Int),
) -> Result(types.ApiResponse(List(OrderDetail)), types.ApiError)

List closed orders. GET /orders/closed

pub fn list_open_orders(
  c: client.AuthClient,
  market market: option.Option(types.Market),
  state state: option.Option(String),
) -> Result(types.ApiResponse(List(OrderDetail)), types.ApiError)

List open orders. GET /orders/open

pub fn list_orders_by_uuids(
  c: client.AuthClient,
  uuids uuids: List(String),
) -> Result(types.ApiResponse(List(OrderDetail)), types.ApiError)

List orders by UUIDs. GET /orders/uuids

pub fn order_detail_decoder() -> decode.Decoder(OrderDetail)

Decoder for OrderDetail.

pub fn order_response_decoder() -> decode.Decoder(OrderResponse)

Decoder for OrderResponse.

pub fn test_order(
  c: client.AuthClient,
  order order: NewOrder,
) -> Result(types.ApiResponse(OrderResponse), types.ApiError)

Create a test order (no execution). POST /orders/test

Search Document