ExOkex.Spot.Private (ExOkex v0.6.0) View Source
Spot account client.
Link to this section Summary
Functions
Amend multiple open orders for a specific trading pair (up to 10 orders)
Cancelling an unfilled order.
Place multiple orders for specific trading pairs (up to 4 trading pairs, maximum 4 orders each)
Place a new order.
Get the balance, amount available/on hold of a token in spot account.
List accounts.
Link to this section Types
Specs
config() :: ExOkex.Config.t()
Specs
params() :: map()
Specs
response() :: ExOkex.Api.response()
Link to this section Functions
Specs
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"} ])
cancel_orders(instrument_id, order_ids \\ [], params \\ %{}, config \\ nil)
View SourceCancelling an unfilled order.
https://www.okex.com/docs/en/#spot-revocation
Example
iex> ExOkex.Spot.Private.cancel_orders("btc-usdt", ["1611729012263936"])
TODO: Add response
See ExOkex.Spot.Private.CreateBulkOrders.create_bulk_orders/2
.
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}
]
}}
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 }}
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" }}
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"
} ]}