BinanceApi (binance_api v0.2.0) View Source
This library interacts with binance in a very simple way and doesn't make attempts to deserialize the results of the api into a struct.
To utilize this library we need to first set up some configuration
Config
config :binance_api,
api_key: "<BINANCE_API_KEY>", # required
secret_key: "<BINANCE_SECRET_KEY>", # required
base_url: "https://api.binance.com" # default,
secure_receive_window: 5_000 # default,
request: [
pool_timeout: 5_000 # default,
receive_timeout: 15_000 # default
]Options
For all requests we can provide the same options to override any of the default config, however it's not required to pass them at all as long as the config is set
:secured?- The default value isfalse.:secret_key- The default value is"<BINANCE_SECRET_KEY>".:api_key- The default value is"<BINANCE_API_KEY>".:base_url- The default value is"https://api.binance.com".:secure_receive_window- The default value is5000.:pool_timeout- The default value is5000.:receive_timeout- The default value is15000.
Link to this section Summary
Functions
Get account details
Cancels an order for a specific symbol by the order_id
Exchange info
Opens and order in binance, see: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#new-order--trade
Get all active open orders
Get all active open orders for a specific symbol
Ping Binance servers to get pong
Server time from Binance
System status
Get the last price for a ticker
Link to this section Functions
Specs
account(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Get account details
Specs
cancel_order( symbol :: String.t(), order_id :: String.t(), BinanceApi.HTTP.opts() ) :: BinanceApi.HTTP.res_single()
Cancels an order for a specific symbol by the order_id
Specs
exchange_info(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Exchange info
Specs
open_order(params :: map(), BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Opens and order in binance, see: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#new-order--trade
Specs
open_orders(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_multi()
Get all active open orders
Specs
open_orders_by_symbol(symbol :: String.t(), BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_multi()
Get all active open orders for a specific symbol
Specs
ping(BinanceApi.HTTP.opts()) :: :pong | BinanceApi.HTTP.error()
Ping Binance servers to get pong
Specs
server_time(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Server time from Binance
Specs
system_status(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
System status
Specs
ticker_price(symbol :: String.t(), BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Get the last price for a ticker