BinanceApi (binance_api v0.2.1) 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"ls2MumrOXWvrslvWJSHGHVDjanm4dxe8QlcTsbtZ0F4rsubs7OXi1I5xDLAqOKQZ"
.:api_key
- The default value is"PKXk4AJ7rS3jSG9bCq74tt69isicgRMiM2kcVRsuB0tWelezvXM5OUzijao1vpwq"
.:base_futures_url
- The default value is"https://fapi.binance.com"
.: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
Exchange info
Cancels an order for a specific symbol by the order_id
Opens and order in binance futures
Get all active open orders
Get all active open orders for a specific symbol
Ping Binance servers to get pong
Server time from Binance
Cancels an order for a specific symbol by the order_id
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
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
exchange_info(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Exchange info
Specs
futures_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
futures_open_order(params :: map(), BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_single()
Opens and order in binance futures
Specs
futures_open_orders(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_multi()
Get all active open orders
Specs
futures_open_orders_by_symbol(symbol :: String.t(), BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_multi()
Get all active open orders for a specific symbol
Specs
futures_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
spot_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
spot_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
spot_open_orders(BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_multi()
Get all active open orders
Specs
spot_open_orders_by_symbol(symbol :: String.t(), BinanceApi.HTTP.opts()) :: BinanceApi.HTTP.res_multi()
Get all active open orders for a specific symbol
Specs
spot_ping(BinanceApi.HTTP.opts()) :: :pong | BinanceApi.HTTP.error()
Ping Binance servers to get pong
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