Dwarves.BinanceFutures (dwarves_binancex v0.1.0)
Link to this section Summary
Functions
Creates a new order on binance
Searches and normalizes the symbol as it is listed on binance.
Get all symbols and current prices listed in binance
Creates a new limit buy order
Creates a new limit sell order
Creates a new market buy order
Creates a new market sell order
Pings binance API. Returns {:ok, %{}}
if successful, {:error, reason}
otherwise
Link to this section Functions
create_order(params, api_secret, api_key, is_testnet \\ false)
Creates a new order on binance
Returns {:ok, %{}}
or {:error, reason}
.
In the case of a error on binance, for example with invalid parameters, {:error, {:binance_error, %{code: code, msg: msg}}}
will be returned.
Please read https://www.binance.com/restapipub.html#user-content-account-endpoints to understand all the parameters
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"}
get_all_prices(is_testnet \\ false)
Get all symbols and current prices listed in binance
Returns {:ok, [%Binance.SymbolPrice{}]}
or {:error, reason}
.
Example
{:ok,
[%Binance.SymbolPrice{price: "0.07579300", symbol: "ETHBTC"},
%Binance.SymbolPrice{price: "0.01670200", symbol: "LTCBTC"},
%Binance.SymbolPrice{price: "0.00114550", symbol: "BNBBTC"},
%Binance.SymbolPrice{price: "0.00640000", symbol: "NEOBTC"},
%Binance.SymbolPrice{price: "0.00030000", symbol: "123456"},
%Binance.SymbolPrice{price: "0.04895000", symbol: "QTUMETH"},
...]}
order_limit_buy(params, api_secret, api_key, is_testnet \\ false)
Creates a new limit buy order
Symbol can be a binance symbol in the form of "ETHBTC"
or %Binance.TradePair{}
.
Returns {:ok, %{}}
or {:error, reason}
order_limit_sell(params, api_secret, api_key, is_testnet \\ false)
Creates a new limit sell order
Symbol can be a binance symbol in the form of "ETHBTC"
or %Binance.TradePair{}
.
Returns {:ok, %{}}
or {:error, reason}
order_market_buy(symbol, quantity)
Creates a new market buy order
Symbol can be a binance symbol in the form of "ETHBTC"
or %Binance.TradePair{}
.
Returns {:ok, %{}}
or {:error, reason}
order_market_buy(params, api_secret, api_key, is_testnet \\ false)
order_market_sell(symbol, quantity)
Creates a new market sell order
Symbol can be a binance symbol in the form of "ETHBTC"
or %Binance.TradePair{}
.
Returns {:ok, %{}}
or {:error, reason}
order_market_sell(params, api_secret, api_key, is_testnet \\ false)
ping(is_testnet \\ false)
Pings binance API. Returns {:ok, %{}}
if successful, {:error, reason}
otherwise