binance_api v0.1.3 Binance.TradePair

Struct for representing a normalized trade pair.

@enforce_keys [:from, :to]
defstruct @enforce_keys

Link to this section Summary

Functions

Searches and normalizes the symbol as it is listed on binance

Link to this section Functions

Link to this function find_symbol(tp)

Searches and normalizes the symbol as it is listed on binance.

To retrieve this information, a request to the binance API is done. The result is then cached to ensure the request is done only once.

Order of which symbol comes first, and case sensitivity does not matter.

Returns {:ok, "SYMBOL"} if successfully, or {:error, reason} otherwise.

Examples

These 3 calls will result in the same result string:

find_symbol(%Binance.TradePair{from: "ETH", to: "REQ"})
find_symbol(%Binance.TradePair{from: "REQ", to: "ETH"})
find_symbol(%Binance.TradePair{from: "rEq", to: "eTH"})

Result: {:ok, "REQETH"}