ExOkex.Spot.Private (ExOkex v0.6.0) View Source

Spot account client.

API docs

Link to this section Summary

Functions

Amend multiple open orders for a specific trading pair (up to 10 orders)

Place multiple orders for specific trading pairs (up to 4 trading pairs, maximum 4 orders each)

Get the balance, amount available/on hold of a token in spot account.

Link to this section Types

Specs

config() :: ExOkex.Config.t()

Specs

params() :: map()

Specs

response() :: ExOkex.Api.response()

Link to this section Functions

Link to this function

amend_bulk_orders(params, config \\ nil)

View Source

Specs

amend_bulk_orders([params()], config() | nil) :: response()

Amend multiple open orders for a specific trading pair (up to 10 orders)

https://www.okex.com/docs/en/#spot-amend_batch

Examples

iex> ExOkex.Spot.Private.amend_bulk_orders([ %{"order_id" => "305512815291895607","instrument_id" => "BTC-USDT","new_size" => "2"}, %{"order_id" => "305512815291895606","instrument_id" => "BTC-USDT","new_size" => "1"} ])

Link to this function

cancel_orders(instrument_id, order_ids \\ [], params \\ %{}, config \\ nil)

View Source

Cancelling an unfilled order.

https://www.okex.com/docs/en/#spot-revocation

Example

iex> ExOkex.Spot.Private.cancel_orders("btc-usdt", ["1611729012263936"])

TODO: Add response

Link to this function

create_batch_orders(params, config \\ nil)

View Source

See ExOkex.Spot.Private.CreateBulkOrders.create_bulk_orders/2.

Link to this function

create_bulk_orders(params, config \\ nil)

View Source

Place multiple orders for specific trading pairs (up to 4 trading pairs, maximum 4 orders each)

https://www.okex.com/docs/en/#spot-batch

Examples

iex> ExOkex.Spot.Private.create_bulk_orders([

  %{
    "client_oid" => "20180728",
    "instrument_id" => "btc-usdt",
    "side" => "sell",
    "type" => "limit",
    "size" => "0.001",
    "price" => "10001",
    "margin_trading" => "1"
  },
  %{
    "client_oid":"20180729",
    "instrument_id":"btc-usdt",
    "side":"sell",
    "type":"limit",
    "size":"0.001",
    "price":"10002",
    "margin_trading ":"1"
  }
])
{:ok, %{
  "btc_usdt" => [
    %{"client_oid" => "20180728", "error_code" => 0, "error_message" => "", "order_id" => "2510832677159936", "result" => true},
    %{"client_oid" => "20180729", "error_code" => 0, "error_message" => "", "order_id" => "2510832677225472", "result" => true}
  ]
}}
Link to this function

create_order(params, config \\ nil)

View Source

Place a new order.

Refer to params listed in API docs

Examples

iex> ExOkex.Spot.Private.create_order(%{type: "limit", side: "buy", product_id: "ETH-USD", price: "0.50", size: "1.0"}) {:ok, %{ "client_oid" => "oktspot79", "error_code" => "", "error_message" => "", "order_id" => "2510789768709120", "result" => true }}

Link to this function

get_account(currency, config \\ nil)

View Source

Get the balance, amount available/on hold of a token in spot account.

Spot Trading Account of a Currency

Example

iex> ExOkex.Spot.Private.get_account("btc") {:ok, %{ "available" => "0.005", "balance" => "0.005", "currency" => "btc", "frozen" => "0", "hold" => "0", "holds" => "0", "id" => "2006057" }}

Link to this function

list_accounts(config \\ nil)

View Source

List accounts.

Examples

iex> ExOkex.Spot.Private.list_accounts() {:ok, [ %{

"available" => "0.005",
"balance" => "0.005",
"currency" => "BTC",
"frozen" => "0",
"hold" => "0",
"holds" => "0",
"id" => "2006257"

} ]}