Emxc.Global.Spot.V3 (emxc v0.0.5)
Link to this section Summary
Market Data (Public)
Current average price.
Compressed/Aggregate trades.
Get ETF info.
Exchange information.
Kline/candlestick bars.
Order book.
Test connectivity to the Rest API.
Recent trades.
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).
Get sub-account list.
Enable margin for sub-account (for master account).
Universal transfer (for master account).
Query universal transfer history (for master account).
Spot Account/Trade (Signed)
Account information.
Account trade list.
Query all account orders.
Batch orders.
Cancel all open orders on a symbol.
Cancel order.
User API default symbols.
Enable MX Deduct.
Query MX Deduct status.
New order.
Get all open orders on a symbol. Careful when accessing this with no symbol.
Query order.
Test new order.
Wallet (Signed)
Cancel withdrawal.
Create Dust transfer.
Create universal transfer.
Create withdrawal.
Query currency details.
Deposit history.
Generate deposit address.
Get assets that can be converted into MX.
Get deposit address.
Get Dust transfer log.
Get user universal transfer history by transaction id.
Get universal transfer history.
Get withdrawal address.
Withdrawal history.
Link to this section Types
account_option()
@type account_option() :: {:recvWindow, integer()}
account_trades_option()
all_orders_option()
authorized_option()
@type authorized_option() :: {:headers, headers()} | {:api_key, String.t()} | {:adapter, Tesla.Client.adapter()} | {:base_url, String.t()}
average_price_option()
@type average_price_option() :: {:symbol, String.t()}
batch_orders_option()
cancel_all_open_orders_option()
cancel_order_option()
cancel_withdrawal_option()
client()
@type client() :: Tesla.Client.t()
compressed_trades_option()
create_dust_transfer_option()
create_universal_transfer_option()
create_withdrawal_option()
currency_details_option()
@type currency_details_option() :: {:recvWindow, integer()}
deposit_history_option()
enable_mx_deduct_option()
etf_info_option()
@type etf_info_option() :: {:symbol, String.t()}
exchange_info_option()
generate_deposit_address_option()
get_deposit_address_option()
get_dust_transfer_log_option()
get_universal_transfer_history_option()
get_universal_transfer_option()
get_withdrawal_address_option()
headers()
@type headers() :: Tesla.Env.headers()
kline_option()
mx_deduct_status_option()
@type mx_deduct_status_option() :: {:recvWindow, integer()}
new_order_option()
open_orders_option()
order_book_option()
public_option()
@type public_option() :: {:headers, headers()} | {:adapter, Tesla.Client.adapter()} | {:base_url, String.t()}
query_order_option()
recent_trades_option()
response()
subaccount_api_key_create_option()
subaccount_api_key_delete_option()
subaccount_api_key_query_option()
subaccount_create_option()
subaccount_futures_enable_option()
subaccount_list_option()
subaccount_margin_enable_option()
subaccount_universal_transfer_create_option()
subaccount_universal_transfer_history_option()
test_new_order_option()
ticker_24hr_option()
@type ticker_24hr_option() :: {:symbol, String.t()}
ticker_book_option()
@type ticker_book_option() :: {:symbol, String.t()}
ticker_price_option()
@type ticker_price_option() :: {:symbol, String.t()}
withdrawal_history_option()
Link to this section API
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 toTesla.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, [[]]}
}
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 toTesla.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)
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
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
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
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"]
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
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
ping(client)
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
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
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"
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
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
time(client)
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)
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 to5000
.
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
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 to5000
.
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
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 to5000
.
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
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 to5000
.
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
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 to5000
.
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
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
orfalse
):page
- Page number. Defaults to1
.:limit
- Number of items per page. Defaults to10
. Max200
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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
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 to5000
.
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
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 iffromAccount
is not sent.:toAccount
- Account to transfer to. Will transfer to master account by default iftoAccount
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 to5000
.
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
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 iffromAccount
is not sent.:toAccount
- Account to transfer to. Will transfer to master account by default iftoAccount
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 to1
.:limit
- Page size. Defaults to500
, max500
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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)
account(client, secret_key, opts \\ [])
@spec account(client(), String.t(), [account_option()]) :: response()
Account information.
options
Options
:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.account("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
account_trades(client, secret_key, opts \\ [])
@spec account_trades(client(), String.t(), [account_trades_option()]) :: response()
Account trade list.
options
Options
:symbol
- Symbol to trade.:orderId
- Order id.:startTime
- Start time.:endTime
- End time.:limit
- Limit. Default500
; max1000
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.account_trades("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT")
iex> response.status
401
all_orders(client, secret_key, opts \\ [])
@spec all_orders(client(), String.t(), [all_orders_option()]) :: response()
Query all account orders.
options
Options
:symbol
- Symbol to trade.:startTime
- Start time.:endTime
- End time.:limit
- Limit.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.all_orders("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT")
iex> response.status
401
batch_orders(client, secret_key, opts \\ [])
@spec batch_orders(client(), String.t(), [batch_orders_option()]) :: response()
Batch orders.
options
Options
:batchOrders
- Batch orders. A list of order structs.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
order-struct
Order struct
:symbol
- Symbol to trade.:side
- Trade side."BUY"
or"SELL"
.:type
- Order type. On of"LIMIT"
,"MARKET"
,"LIMIT_MAKER"
,"IMMEDIATE_OR_CANCEL"
,"FILL_OR_KILL"
.:quantity
- Order quantity.:quoteOrderQty
- Quote order quantity.:price
- Order price.:newClientOrderId
- A unique id for the order.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.batch_orders("45d0b3c26f2644f19bfb98b07741b2f5", batchOrders: [%{symbol: "BTCUSDT", side: "BUY", type: "LIMIT", quantity: 1, price: 100}])
iex> response.status
401
cancel_all_open_orders(client, secret_key, opts \\ [])
@spec cancel_all_open_orders(client(), String.t(), [cancel_all_open_orders_option()]) :: response()
Cancel all open orders on a symbol.
options
Options
:symbol
- Symbols to cancel, comma-separated list in a string. Maximum5
symbols per request.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.cancel_all_open_orders("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT")
iex> response.status
401
cancel_order(client, secret_key, opts \\ [])
@spec cancel_order(client(), String.t(), [cancel_order_option()]) :: response()
Cancel order.
options
Options
:symbol
- Symbol to trade.:orderId
- Order id.:origClientOrderId
- Original client order id.:newClientOrderId
- A unique id for the order.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.cancel_order("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT", orderId: 1)
iex> response.status
401
default_symbols(client, secret_key)
User API default symbols.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.default_symbols("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
enable_mx_deduct(client, secret_key, opts \\ [])
@spec enable_mx_deduct(client(), String.t(), [enable_mx_deduct_option()]) :: response()
Enable MX Deduct.
options
Options
:mxDeductEnable
-true
orfalse
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.enable_mx_deduct("45d0b3c26f2644f19bfb98b07741b2f5", mxDeductEnable: true)
iex> response.status
401
mx_deduct_status(client, secret_key, opts \\ [])
@spec mx_deduct_status(client(), String.t(), [mx_deduct_status_option()]) :: response()
Query MX Deduct status.
options
Options
:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.mx_deduct_status("45d0b3c26f2644f19bfb98b07741b2f5")
iex> response.status
401
new_order(client, secret_key, opts \\ [])
@spec new_order(client(), String.t(), [new_order_option()]) :: response()
New order.
options
Options
:symbol
- Symbol to trade.:side
- Trade side."BUY"
or"SELL"
.:type
- Order type. On of"LIMIT"
,"MARKET"
,"LIMIT_MAKER"
,"IMMEDIATE_OR_CANCEL"
,"FILL_OR_KILL"
.:quantity
- Order quantity.:quoteOrderQty
- Quote order quantity.:price
- Order price.:newClientOrderId
- A unique id for the order.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.new_order("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT", side: "BUY", type: "LIMIT", quantity: 1, price: 100)
iex> response.status
401
open_orders(client, secret_key, opts \\ [])
@spec open_orders(client(), String.t(), [open_orders_option()]) :: response()
Get all open orders on a symbol. Careful when accessing this with no symbol.
options
Options
:symbol
- Symbol to trade. If not sent, orders for all symbols will be returned in an array.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.open_orders("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT")
iex> response.status
401
query_order(client, secret_key, opts \\ [])
@spec query_order(client(), String.t(), [query_order_option()]) :: response()
Query order.
options
Options
:symbol
- Symbol to trade.:origClientOrderId
- Original client order id.:orderId
- Order id.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.query_order("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT", orderId: 1)
iex> response.status
401
test_new_order(client, secret_key, opts \\ [])
@spec test_new_order(client(), String.t(), [test_new_order_option()]) :: response()
Test new order.
options
Options
:symbol
- Symbol to trade.:side
- Trade side."BUY"
or"SELL"
.:type
- Order type. On of"LIMIT"
,"MARKET"
,"LIMIT_MAKER"
,"IMMEDIATE_OR_CANCEL"
,"FILL_OR_KILL"
.:quantity
- Order quantity.:quoteOrderQty
- Quote order quantity.:price
- Order price.:newClientOrderId
- A unique id for the order.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
example
Example
iex> alias Emxc.Global.Spot.V3, as: Spot
iex> {:ok, response} = Spot.authorized_client(api_key: "mx0aBYs33eIilxBWC5") |> Spot.test_new_order("45d0b3c26f2644f19bfb98b07741b2f5", symbol: "BTCUSDT", side: "BUY", type: "LIMIT", quantity: 1, price: 100)
iex> response.status
401
Link to this section Wallet (Signed)
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 to5000
.
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
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 to5000
.
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
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 whenfromAccountType
is"ISOLATED_MARGIN"
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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
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 to5000
.
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
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 to5000
.
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
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 to1000
, max1000
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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
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 to5000
.
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
get_convertible_assets(client, secret_key)
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
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 to5000
.
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
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 to10
, max100
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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
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 to5000
.
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
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 to10
, max100
.:symbol
- Symbol, needed whenfromAccountType
is"ISOLATED_MARGIN"
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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
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 to5000
.
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
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 to1000
, max1000
.:recvWindow
- the number of milliseconds after timestamp the request is valid for. Defaults to5000
.
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