Emxc.Global.Spot.V3 (emxc v0.0.5)

Link to this section Summary

API

Create a client for the private endpoints.

Create a client for the public endpoints.

Market Data (Public)

Current average price.

Compressed/Aggregate trades.

Exchange information.

Kline/candlestick bars.

Test connectivity to the Rest API.

24hr ticker price change statistics.

Symbol order book ticker.

Symbol price ticker.

Check server time.

Sub Accounts (Signed)

Create a sub-account API key (for master account).

Delete sub-account API key (for master account).

Query sub-account API key (for master account).

Create a sub-account (for master account).

Enable futures for sub-account (for master account).

Enable margin for sub-account (for master account).

Query universal transfer history (for master account).

Link to this section Types

Link to this type

account_option()

@type account_option() :: {:recvWindow, integer()}
Link to this type

account_trades_option()

@type account_trades_option() ::
  {:symbol, String.t()}
  | {:orderId, integer()}
  | {:startTime, integer()}
  | {:endTime, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
Link to this type

all_orders_option()

@type all_orders_option() ::
  {:symbol, String.t()}
  | {:startTime, integer()}
  | {:endTime, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
Link to this type

authorized_option()

@type authorized_option() ::
  {:headers, headers()}
  | {:api_key, String.t()}
  | {:adapter, Tesla.Client.adapter()}
  | {:base_url, String.t()}
Link to this type

average_price_option()

@type average_price_option() :: {:symbol, String.t()}
Link to this type

batch_orders_option()

@type batch_orders_option() :: {:batchOrders, list()} | {:recvWindow, integer()}
Link to this type

cancel_all_open_orders_option()

@type cancel_all_open_orders_option() ::
  {:symbol, String.t()} | {:recvWindow, integer()}
Link to this type

cancel_order_option()

@type cancel_order_option() ::
  {:symbol, String.t()}
  | {:orderId, integer()}
  | {:origClientOrderId, String.t()}
  | {:newClientOrderId, String.t()}
  | {:recvWindow, integer()}
Link to this type

cancel_withdrawal_option()

@type cancel_withdrawal_option() :: {:id, String.t()} | {:recvWindow, integer()}
@type client() :: Tesla.Client.t()
Link to this type

compressed_trades_option()

@type compressed_trades_option() ::
  {:limit, integer()}
  | {:symbol, String.t()}
  | {:startTime, integer()}
  | {:endTime, integer()}
Link to this type

create_dust_transfer_option()

@type create_dust_transfer_option() :: {:asset, String.t()} | {:recvWindow, integer()}
Link to this type

create_universal_transfer_option()

@type create_universal_transfer_option() ::
  {:fromAccountType, String.t()}
  | {:toAccountType, String.t()}
  | {:asset, String.t()}
  | {:amount, float()}
  | {:symbol, String.t()}
  | {:recvWindow, integer()}
Link to this type

create_withdrawal_option()

@type create_withdrawal_option() ::
  {:coin, String.t()}
  | {:withdrawOrderId, String.t()}
  | {:network, String.t()}
  | {:address, String.t()}
  | {:memo, String.t()}
  | {:amount, float()}
  | {:remark, String.t()}
  | {:recvWindow, integer()}
Link to this type

currency_details_option()

@type currency_details_option() :: {:recvWindow, integer()}
Link to this type

deposit_history_option()

@type deposit_history_option() ::
  {:coin, String.t()}
  | {:status, integer()}
  | {:startTime, integer()}
  | {:endTime, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
Link to this type

enable_mx_deduct_option()

@type enable_mx_deduct_option() ::
  {:mxDeductEnable, boolean()} | {:recvWindow, integer()}
Link to this type

etf_info_option()

@type etf_info_option() :: {:symbol, String.t()}
Link to this type

exchange_info_option()

@type exchange_info_option() :: {:symbol, String.t()} | {:symbols, [String.t()]}
Link to this type

generate_deposit_address_option()

@type generate_deposit_address_option() ::
  {:coin, String.t()} | {:network, String.t()} | {:recvWindow, integer()}
Link to this type

get_deposit_address_option()

@type get_deposit_address_option() ::
  {:coin, String.t()} | {:network, String.t()} | {:recvWindow, integer()}
Link to this type

get_dust_transfer_log_option()

@type get_dust_transfer_log_option() ::
  {:startTime, integer()}
  | {:endTime, integer()}
  | {:page, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
Link to this type

get_universal_transfer_history_option()

@type get_universal_transfer_history_option() ::
  {:fromAccountType, String.t()}
  | {:toAccountType, String.t()}
  | {:startTime, integer()}
  | {:endTime, integer()}
  | {:page, integer()}
  | {:size, integer()}
  | {:symbol, String.t()}
  | {:recvWindow, integer()}
Link to this type

get_universal_transfer_option()

@type get_universal_transfer_option() ::
  {:tranId, integer()} | {:recvWindow, integer()}
Link to this type

get_withdrawal_address_option()

@type get_withdrawal_address_option() ::
  {:coin, String.t()}
  | {:page, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
@type headers() :: Tesla.Env.headers()
Link to this type

kline_option()

@type kline_option() ::
  {:limit, integer()}
  | {:symbol, String.t()}
  | {:interval, String.t()}
  | {:startTime, integer()}
  | {:endTime, integer()}
Link to this type

mx_deduct_status_option()

@type mx_deduct_status_option() :: {:recvWindow, integer()}
Link to this type

new_order_option()

@type new_order_option() ::
  {:symbol, String.t()}
  | {:side, String.t()}
  | {:type, String.t()}
  | {:quantity, float()}
  | {:quoteOrderQty, float()}
  | {:price, float()}
  | {:newClientOrderId, String.t()}
  | {:recvWindow, integer()}
Link to this type

open_orders_option()

@type open_orders_option() :: {:symbol, String.t()} | {:recvWindow, integer()}
Link to this type

order_book_option()

@type order_book_option() :: {:limit, integer()} | {:symbol, String.t()}
Link to this type

public_option()

@type public_option() ::
  {:headers, headers()}
  | {:adapter, Tesla.Client.adapter()}
  | {:base_url, String.t()}
Link to this type

query_order_option()

@type query_order_option() ::
  {:symbol, String.t()}
  | {:origClientOrderId, String.t()}
  | {:orderId, integer()}
  | {:recvWindow, integer()}
Link to this type

recent_trades_option()

@type recent_trades_option() :: {:limit, integer()} | {:symbol, String.t()}
@type response() :: {:ok, map()} | {:error, any()} | no_return()
Link to this type

subaccount_api_key_create_option()

@type subaccount_api_key_create_option() ::
  {:subAccount, String.t()}
  | {:note, String.t()}
  | {:permissions, String.t()}
  | {:ip, String.t()}
  | {:recvWindow, integer()}
Link to this type

subaccount_api_key_delete_option()

@type subaccount_api_key_delete_option() ::
  {:subAccount, String.t()} | {:apiKey, String.t()} | {:recvWindow, integer()}
Link to this type

subaccount_api_key_query_option()

@type subaccount_api_key_query_option() ::
  {:subAccount, String.t()} | {:recvWindow, integer()}
Link to this type

subaccount_create_option()

@type subaccount_create_option() ::
  {:subAccount, String.t()} | {:note, String.t()} | {:recvWindow, integer()}
Link to this type

subaccount_futures_enable_option()

@type subaccount_futures_enable_option() ::
  {:subAccount, String.t()} | {:recvWindow, integer()}
Link to this type

subaccount_list_option()

@type subaccount_list_option() ::
  {:subAccount, String.t()}
  | {:isFreeze, boolean()}
  | {:page, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
Link to this type

subaccount_margin_enable_option()

@type subaccount_margin_enable_option() ::
  {:subAccount, String.t()} | {:recvWindow, integer()}
Link to this type

subaccount_universal_transfer_create_option()

@type subaccount_universal_transfer_create_option() ::
  {:fromAccount, String.t()}
  | {:toAccount, String.t()}
  | {:fromAccountType, String.t()}
  | {:toAccountType, String.t()}
  | {:symbol, String.t()}
  | {:asset, String.t()}
  | {:amount, float()}
  | {:recvWindow, integer()}
Link to this type

subaccount_universal_transfer_history_option()

@type subaccount_universal_transfer_history_option() ::
  {:fromAccount, String.t()}
  | {:toAccount, String.t()}
  | {:fromAccountType, String.t()}
  | {:toAccountType, String.t()}
  | {:startTime, integer()}
  | {:endTime, integer()}
  | {:page, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}
Link to this type

test_new_order_option()

@type test_new_order_option() ::
  {:symbol, String.t()}
  | {:side, String.t()}
  | {:type, String.t()}
  | {:quantity, float()}
  | {:quoteOrderQty, float()}
  | {:price, float()}
  | {:newClientOrderId, String.t()}
  | {:recvWindow, integer()}
Link to this type

ticker_24hr_option()

@type ticker_24hr_option() :: {:symbol, String.t()}
Link to this type

ticker_book_option()

@type ticker_book_option() :: {:symbol, String.t()}
Link to this type

ticker_price_option()

@type ticker_price_option() :: {:symbol, String.t()}
Link to this type

withdrawal_history_option()

@type withdrawal_history_option() ::
  {:coin, String.t()}
  | {:status, integer()}
  | {:startTime, integer()}
  | {:endTime, integer()}
  | {:limit, integer()}
  | {:recvWindow, integer()}

Link to this section API

Link to this function

authorized_client(opts \\ [])

@spec authorized_client(Tesla.Env.headers()) :: client()

Create a client for the private endpoints.

options

Options

  • :base_url - The base URL to be used for the client. Defaults to "https://api.mexc.com".
  • :headers - A list of headers to be sent with each request.
  • :adapter - The adapter to be used for the client. Defaults to Tesla.Adapter.Hackney.
  • :api_key - The API key to be used for the client. Defaults to "api_key".

example

Example

iex> Emxc.Global.Spot.V3.authorized_client()
%Tesla.Client{
        fun: nil,
        pre: [
          {Tesla.Middleware.BaseUrl, :call,
           ["https://api.mexc.com"]},
          {Tesla.Middleware.JSON, :call, [[]]},
          {Tesla.Middleware.Headers, :call,
           [
             [
               {"X-MEXC-APIKEY", "api_key"},
               {"Content-Type", "application/json"}
             ]
           ]}
        ],
        post: [],
        adapter: {Tesla.Adapter.Hackney, :call, [[]]}
      }
Link to this function

public_client(opts \\ [])

@spec public_client([public_option()]) :: client()

Create a client for the public endpoints.

options

Options

  • :base_url - The base URL to be used for the client. Defaults to "https://api.mexc.com".
  • :headers - A list of headers to be sent with each request.
  • :adapter - The adapter to be used for the client. Defaults to Tesla.Adapter.Hackney.

example

Example

iex> Emxc.Global.Spot.V3.public_client()
%Tesla.Client{
        fun: nil,
        pre: [
          {Tesla.Middleware.BaseUrl, :call,
           ["https://api.mexc.com"]},
          {Tesla.Middleware.JSON, :call, [[]]},
          {Tesla.Middleware.Headers, :call,
           [[{"Content-Type", "application/json"}]]}
        ],
        post: [],
        adapter: {Tesla.Adapter.Hackney, :call, [[]]}
      }

Link to this section Market Data (Public)

Link to this function

average_price(client, opts \\ [])

@spec average_price(client(), [average_price_option()]) :: response()

Current average price.

options

Options

  • :symbol - The symbol to get the average price for.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.average_price(symbol: "BTCUSDT")
iex> response.result["price"] > 0
...> && Decimal.gt?(Decimal.new(response.result["price"]), 0)
true
Link to this function

compressed_trades(client, opts \\ [])

@spec compressed_trades(client(), [compressed_trades_option()]) :: response()

Compressed/Aggregate trades.

options

Options

  • :limit - Default 500; max 1000.
  • :symbol - The symbol to get trades for.
  • :startTime - Timestamp in ms to get aggregate trades from INCLUSIVE.
  • :endTime - Timestamp in ms to get aggregate trades until INCLUSIVE.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.compressed_trades(symbol: "BTCUSDT", limit: 1)
iex> response.result |> length()
1
Link to this function

etf_info(client, opts \\ [])

@spec etf_info(client(), [etf_info_option()]) :: response()

Get ETF info.

options

Options

  • :symbol - The symbol to get the ticker for.
  • If no symbol is provided, all symbols will be returned in a list.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.etf_info(symbol: "BTCUSDT")
iex> response.result["symbol"] == "BTCUSDT" && response.result["price"] > 0
true
Link to this function

exchange_info(client, opts \\ [])

@spec exchange_info(client(), [exchange_info_option()]) :: response()

Exchange information.

options

Options

  • :symbol - The symbol to get the exchange information for.
  • :symbols - A list of symbols to get the exchange information for.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.exchange_info(symbols: "BTCUSDT,SNTUSDT")
iex> response.result["symbols"] |> Enum.map(& &1["symbol"]) |> Enum.sort()
["BTCUSDT", "SNTUSDT"]
Link to this function

kline(client, opts \\ [])

@spec kline(client(), [kline_option()]) :: response()

Kline/candlestick bars.

options

Options

  • :limit - Default 500; max 1000.
  • :symbol - The symbol to get klines for.
  • :interval - The interval to get klines for. One of: 1m, 5m, 15m, 30m, 60m, 4h, 1d, 1M.
  • :startTime - The start time to get klines for. In milliseconds.
  • :endTime - The end time to get klines for. In milliseconds.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.kline(symbol: "BTCUSDT", interval: "1m", limit: 1)
iex> response.result |> length()
1
Link to this function

order_book(client, opts \\ [])

@spec order_book(client(), [order_book_option()]) :: response()

Order book.

options

Options

  • :limit - Default 100; max 1000.
  • :symbol - The symbol to get the order book for.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.order_book(symbol: "BTCUSDT", limit: 1)
iex> response.result["bids"] |> length() |> then(& &1 == response.result["asks"] |> length())
true
@spec ping(client()) :: response()

Test connectivity to the Rest API.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.ping()
iex> response.status
200
Link to this function

recent_trades(client, opts \\ [])

@spec recent_trades(client(), [recent_trades_option()]) :: response()

Recent trades.

options

Options

  • :limit - Default 500; max 1000.
  • :symbol - The symbol to get trades for.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.recent_trades(symbol: "BTCUSDT", limit: 1)
iex> response.result |> length()
1
Link to this function

ticker_24hr(client, opts \\ [])

@spec ticker_24hr(client(), [ticker_24hr_option()]) :: response()

24hr ticker price change statistics.

options

Options

  • :symbol - The symbol to get the ticker for.
  • If no symbol is provided, all tickers will be returned in a list.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.ticker_24hr(symbol: "BTCUSDT")
iex> response.result["symbol"]
"BTCUSDT"
Link to this function

ticker_book(client, opts \\ [])

@spec ticker_book(client(), [ticker_book_option()]) :: response()

Symbol order book ticker.

options

Options

  • :symbol - The symbol to get the ticker for.
  • If no symbol is provided, all tickers will be returned in a list.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.ticker_book(symbol: "BTCUSDT")
iex> response.result["symbol"] == "BTCUSDT" && response.result["bidPrice"] > 0
true
Link to this function

ticker_price(client, opts \\ [])

@spec ticker_price(client(), [ticker_price_option()]) :: response()

Symbol price ticker.

options

Options

  • :symbol - The symbol to get the ticker for.
  • If no symbol is provided, all tickers will be returned in a list.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.ticker_price(symbol: "BTCUSDT")
iex> response.result["symbol"] == "BTCUSDT" && response.result["price"] > 0
true
@spec time(client()) :: response()

Check server time.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.public_client() |> Spot.time()
iex> response.result["serverTime"] <= :calendar.universal_time()
true

Link to this section Sub Accounts (Signed)

Link to this function

subaccount_api_key_create(client, secret_key, opts \\ [])

@spec subaccount_api_key_create(client(), String.t(), [
  subaccount_api_key_create_option()
]) ::
  response()

Create a sub-account API key (for master account).

options

Options

  • :subAccount - Sub-account name.
  • :note - API-key notes.
  • :permissions - API-key permissions, as a comma-separated string. Any combination of: SPOT_ACCOUNT_READ, SPOT_ACCOUNT_WRITE, SPOT_DEAL_READ, SPOT_DEAL_WRITE, ISOLATED_MARGIN_ACCOUNT_READ, ISOLATED_MARGIN_ACCOUNT_WRITE, ISOLATED_MARGIN_DEAL_READ, ISOLATED_MARGIN_DEAL_WRITE, CONTRACT_ACCOUNT_READ, CONTRACT_ACCOUNT_WRITE, CONTRACT_DEAL_READ, CONTRACT_DEAL_WRITE, SPOT_TRANSFER_READ, SPOT_TRANSFER_WRITE
  • :ip - IP address whitelist as a comma-separated string, up to a maximum of 20.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

  iex> alias Emxc.Global.Spot.V3, as: Spot
  iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_api_key_create("45d0b3c26f2644f19bfb98b07741b2f5", subAccount: "test_sub_account", note: "test_note", permissions: "SPOT_ACCOUNT_READ, SPOT_ACCOUNT_WRITE, SPOT_DEAL_READ, SPOT_DEAL_WRITE, ISOLATED_MARGIN_ACCOUNT_READ, ISOLATED_MARGIN_ACCOUNT_WRITE, ISOLATED_MARGIN_DEAL_READ, ISOLATED_MARGIN_DEAL_WRITE, CONTRACT_ACCOUNT_READ, CONTRACT_ACCOUNT_WRITE, CONTRACT_DEAL_READ, CONTRACT_DEAL_WRITE, SPOT_TRANSFER_READ, SPOT_TRANSFER_WRITE")
  iex> response.status
  401
Link to this function

subaccount_api_key_delete(client, secret_key, opts \\ [])

@spec subaccount_api_key_delete(client(), String.t(), [
  subaccount_api_key_delete_option()
]) ::
  response()

Delete sub-account API key (for master account).

options

Options

  • :subAccount - Sub-account name.
  • :apiKey - API-key to delete.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_api_key_delete("45d0b3c26f2644f19bfb98b07741b2f5", subAccount: "test_sub_account", apiKey: "mx0aBYs33eIilxBWC5")
iex> response.status
401
Link to this function

subaccount_api_key_query(client, secret_key, opts \\ [])

@spec subaccount_api_key_query(client(), String.t(), [
  subaccount_api_key_query_option()
]) :: response()

Query sub-account API key (for master account).

options

Options

  • :subAccount - Sub-account name.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_api_key_query("45d0b3c26f2644f19bfb98b07741b2f5", subAccount: "test_sub_account")
iex> response.status
401
Link to this function

subaccount_create(client, secret_key, opts \\ [])

@spec subaccount_create(client(), String.t(), [subaccount_create_option()]) ::
  response()

Create a sub-account (for master account).

options

Options

  • :subAccount - Sub-account name.
  • :note - Sub-account notes.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_create("45d0b3c26f2644f19bfb98b07741b2f5", subAccount: "test_sub_account", note: "test_note")
iex> response.status
401
Link to this function

subaccount_futures_enable(client, secret_key, opts \\ [])

@spec subaccount_futures_enable(client(), String.t(), [
  subaccount_futures_enable_option()
]) ::
  response()

Enable futures for sub-account (for master account).

options

Options

  • :subAccount - Sub-account to enable futures for.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_futures_enable("45d0b3c26f2644f19bfb98b07741b2f5", subAccount: "test_sub_account")
iex> response.status
401
Link to this function

subaccount_list(client, secret_key, opts \\ [])

@spec subaccount_list(client(), String.t(), [subaccount_list_option()]) :: response()

Get sub-account list.

options

Options

  • :subAccount - Sub-account name.
  • :isFreeze - Frozen or unfrozen status. (true or false)
  • :page - Page number. Defaults to 1.
  • :limit - Number of items per page. Defaults to 10. Max 200.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_list("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
Link to this function

subaccount_margin_enable(client, secret_key, opts \\ [])

@spec subaccount_margin_enable(client(), String.t(), [
  subaccount_margin_enable_option()
]) :: response()

Enable margin for sub-account (for master account).

options

Options

  • :subAccount - Sub-account to enable margin for.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_margin_enable("45d0b3c26f2644f19bfb98b07741b2f5", subAccount: "test_sub_account")
iex> response.status
401
Link to this function

subaccount_universal_transfer_create(client, secret_key, opts \\ [])

@spec subaccount_universal_transfer_create(client(), String.t(), [
  subaccount_universal_transfer_create_option()
]) :: response()

Universal transfer (for master account).

options

Options

  • :fromAccount - Account to transfer from. Will transfer from master account by default if fromAccount is not sent.
  • :toAccount - Account to transfer to. Will transfer to master account by default if toAccount is not sent.
  • :fromAccountType - Account type to transfer from. One of: "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :toAccountType - Account type to transfer to. One of: "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :symbol - Asset to transfer. Only supported for "ISOLATED_MARGIN" account type.
  • :asset - Asset to transfer.
  • :amount - Amount to transfer.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_universal_transfer_create("45d0b3c26f2644f19bfb98b07741b2f5", fromAccount: "test_sub_account", toAccount: "test_sub_account", asset: "BTC", amount: 0.1)
iex> response.status
401
Link to this function

subaccount_universal_transfer_history(client, secret_key, opts \\ [])

@spec subaccount_universal_transfer_history(client(), String.t(), [
  subaccount_universal_transfer_history_option()
]) :: response()

Query universal transfer history (for master account).

options

Options

  • :fromAccount - Account to transfer from. Will transfer from master account by default if fromAccount is not sent.
  • :toAccount - Account to transfer to. Will transfer to master account by default if toAccount is not sent.
  • :fromAccountType - Account type to transfer from. One of: "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :toAccountType - Account type to transfer to. One of: "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :startTime - Start time of transfer.
  • :endTime - End time of transfer.
  • :page - Current page. Defaults to 1.
  • :limit - Page size. Defaults to 500, max 500.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.subaccount_universal_transfer_history("45d0b3c26f2644f19bfb98b07741b2f5", fromAccount: "test_sub_account", toAccount: "test_sub_account", fromAccountType: "SPOT", toAccountType: "SPOT")
iex> response.status
401

Link to this section Spot Account/Trade (Signed)

Link to this section Wallet (Signed)

Link to this function

cancel_withdrawal(client, secret_key, opts \\ [])

@spec cancel_withdrawal(client(), String.t(), [cancel_withdrawal_option()]) ::
  response()

Cancel withdrawal.

options

Options

  • :id - Withdraw id.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

examples

Examples

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.cancel_withdrawal("45d0b3c26f2644f19bfb98b07741b2f5", id: "123456")
iex> response.status
401
Link to this function

create_dust_transfer(client, secret_key, opts \\ [])

@spec create_dust_transfer(client(), String.t(), [create_dust_transfer_option()]) ::
  response()

Create Dust transfer.

options

Options

  • :asset - Asset(s) to transfer. Up to 15 assets can be transferred in a single request, separated by commas.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.create_dust_transfer("45d0b3c26f2644f19bfb98b07741b2f5", asset: "BTC,FIL,ETH")
iex> response.status
401
Link to this function

create_universal_transfer(client, secret_key, opts \\ [])

@spec create_universal_transfer(client(), String.t(), [
  create_universal_transfer_option()
]) ::
  response()

Create universal transfer.

options

Options

  • :fromAccountType - Account type to transfer from. One of "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :toAccountType - Account type to transfer to. One of "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :asset - Asset to transfer.
  • :amount - Amount to transfer.
  • :symbol - Symbol, needed when fromAccountType is "ISOLATED_MARGIN".
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.create_universal_transfer("45d0b3c26f2644f19bfb98b07741b2f5", fromAccountType: "SPOT", toAccountType: "FUTURES", asset: "BTC", amount: 0.1)
iex> response.status
401
Link to this function

create_withdrawal(client, secret_key, opts \\ [])

@spec create_withdrawal(client(), String.t(), [create_withdrawal_option()]) ::
  response()

Create withdrawal.

options

Options

  • :coin - Coin to withdraw.
  • :withdrawOrderId - Withdraw order id.
  • :network - Network.
  • :address - Address to withdraw.
  • :memo - Memo.
  • :amount - Amount to withdraw.
  • :remark - Remark.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

examples

Examples

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.create_withdrawal("45d0b3c26f2644f19bfb98b07741b2f5", coin: "BTC", withdrawOrderId: "123456", network: "BTC", address: "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2", memo: "123", amount: 0.0001, remark: "123")
iex> response.status
401
Link to this function

currency_details(client, secret_key, opts \\ [])

@spec currency_details(client(), String.t(), [currency_details_option()]) ::
  response()

Query currency details.

options

Options

  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.currency_details("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
Link to this function

deposit_history(client, secret_key, opts \\ [])

@spec deposit_history(client(), String.t(), [deposit_history_option()]) :: response()

Deposit history.

options

Options

  • :coin - Coin to withdraw.
  • :status - Status.
  • :startTime - Start time.
  • :endTime - End time.
  • :limit - Limit. Defaults to 1000, max 1000.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

examples

Examples

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.deposit_history("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
Link to this function

generate_deposit_address(client, secret_key, opts \\ [])

@spec generate_deposit_address(client(), String.t(), [
  generate_deposit_address_option()
]) :: response()

Generate deposit address.

options

Options

  • :coin - Coin to withdraw.
  • :network - Network.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.generate_deposit_address("45d0b3c26f2644f19bfb98b07741b2f5", coin: "BTC", network: "BTC")
iex> response.status
401
Link to this function

get_convertible_assets(client, secret_key)

@spec get_convertible_assets(client(), String.t()) :: response()

Get assets that can be converted into MX.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.get_convertible_assets("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
Link to this function

get_deposit_address(client, secret_key, opts \\ [])

@spec get_deposit_address(client(), String.t(), [get_deposit_address_option()]) ::
  response()

Get deposit address.

options

Options

  • :coin - Coin to withdraw.
  • :network - Network.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.get_deposit_address("45d0b3c26f2644f19bfb98b07741b2f5", coin: "BTC", network: "BTC")
iex> response.status
401
Link to this function

get_dust_transfer_log(client, secret_key, opts \\ [])

@spec get_dust_transfer_log(client(), String.t(), [get_dust_transfer_log_option()]) ::
  response()

Get Dust transfer log.

options

Options

  • :startTime - Start time.
  • :endTime - End time.
  • :page - Page.
  • :limit - Limit. Defaults to 10, max 100.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.get_dust_transfer_log("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
Link to this function

get_universal_transfer(client, secret_key, opts \\ [])

@spec get_universal_transfer(client(), String.t(), [get_universal_transfer_option()]) ::
  response()

Get user universal transfer history by transaction id.

options

Options

  • :tranId - Transaction id.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.get_universal_transfer("45d0b3c26f2644f19bfb98b07741b2f5", tranId: "123456")
iex> response.status
401
Link to this function

get_universal_transfer_history(client, secret_key, opts \\ [])

@spec get_universal_transfer_history(client(), String.t(), [
  get_universal_transfer_history_option()
]) ::
  response()

Get universal transfer history.

options

Options

  • :fromAccountType - Account type to transfer from. One of "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :toAccountType - Account type to transfer to. One of "SPOT", "FUTURES", "ISOLATED_MARGIN".
  • :startTime - Start time.
  • :endTime - End time.
  • :page - Page.
  • :size - Size. Defaults to 10, max 100.
  • :symbol - Symbol, needed when fromAccountType is "ISOLATED_MARGIN".
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.get_universal_transfer_history("45d0b3c26f2644f19bfb98b07741b2f5", fromAccountType: "SPOT", toAccountType: "FUTURES")
iex> response.status
401
Link to this function

get_withdrawal_address(client, secret_key, opts \\ [])

@spec get_withdrawal_address(client(), String.t(), [get_withdrawal_address_option()]) ::
  response()

Get withdrawal address.

options

Options

  • :coin - Coin to withdraw.
  • :page - Page.
  • :limit - Limit.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

example

Example

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.get_withdrawal_address("45d0b3c26f2644f19bfb98b07741b2f5", coin: "BTC")
iex> response.status
401
Link to this function

withdrawal_history(client, secret_key, opts \\ [])

@spec withdrawal_history(client(), String.t(), [withdrawal_history_option()]) ::
  response()

Withdrawal history.

options

Options

  • :coin - Coin to withdraw.
  • :status - Status.
  • :startTime - Start time.
  • :endTime - End time.
  • :limit - Limit. Defaults to 1000, max 1000.
  • :recvWindow - the number of milliseconds after timestamp the request is valid for. Defaults to 5000.

examples

Examples

iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5")
...> |> Spot.withdrawal_history("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401