Emxc.Utilities (emxc v0.0.5)
Link to this section Summary
Functions
Generates an HMAC-256 signature for a given set of query parameters.
Signs a given string using the HMAC SHA-256 algorithm.
Generates a timestamp in milliseconds.
Unwraps a Tesla response into a tuple of {:ok, map()}
or {:error, any()}
.
Link to this section Functions
Link to this function
docs_api_key()
Link to this function
docs_secret_key()
Link to this function
sign_get_query(query, secret_key)
@spec sign_get_query(Enumerable.t(), String.t()) :: String.t()
Generates an HMAC-256 signature for a given set of query parameters.
example
Example
iex> query = [symbol: "BTCUSDT", side: "BUY", type: "LIMIT", quantity: 1, price: 11, recvWindow: 5000, timestamp: 1644489390087]
iex> secret_key = "45d0b3c26f2644f19bfb98b07741b2f5"
iex> Emxc.Utilities.sign_get_query(query, secret_key)
"fd3e4e8543c5188531eb7279d68ae7d26a573d0fc5ab0d18eb692451654d837a"
Link to this function
sign_sha256(key, content)
Signs a given string using the HMAC SHA-256 algorithm.
example
Example
iex> Emxc.Utilities.sign_sha256("foo", "bar")
"f9320baf0249169e73850cd6156ded0106e2bb6ad8cab01b7bbbebe6d1065317"
Link to this function
timestamp()
@spec timestamp() :: integer()
Generates a timestamp in milliseconds.
example
Example
iex> Emxc.Utilities.timestamp() |> is_integer()
true
Link to this function
unwrap_response(arg1)
Unwraps a Tesla response into a tuple of {:ok, map()}
or {:error, any()}
.