Binance.SpotAlgo (binance v2.0.1)

Binance Spot Execution Algorithm API solution aims to provide users ability to programmatically leverage Binance in-house algorithmic trading capability to automate order execution strategy, improve execution transparency and give users smart access to the available market liquidity. During the introductory period, there will be no additional fees for TWAP orders. Standard trading fees apply. Order size exceeds to maximum API supported size (100,000 USDT). Please contact liquidity@binance.com for larger sizes.

Summary

Functions

Cancel Algo Order (TRADE)

Query Historical Algo Orders (USER_DATA)

Query Current Algo Open Orders (USER_DATA)

Query Sub Orders (USER_DATA)

Functions

Link to this function

delete_algo_spot_order(algoId, opts \\ [])

@spec delete_algo_spot_order(any(), recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Cancel Algo Order (TRADE)

Cancel an open TWAP order

Weight(IP): 1

Details:

  • METHOD: delete
  • URL: /sapi/v1/algo/spot/order

Mandatory params:

  • algoId - eg. 14511

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

get_algo_spot_historical_orders(opts \\ [])

@spec get_algo_spot_historical_orders(
  recvWindow: any(),
  pageSize: any(),
  page: any(),
  endTime: any(),
  startTime: any(),
  side: any(),
  symbol: any(),
  timestamp: any()
) :: {:ok, any()} | {:error, any()}

Query Historical Algo Orders (USER_DATA)

Get all historical SPOT TWAP orders

Weight(IP): 1

Details:

  • METHOD: get
  • URL: /sapi/v1/algo/spot/historicalOrders

Mandatory params:

Optional params:

  • timestamp - timestamp
  • symbol - Trading symbol eg. BTCUSDT
  • side - BUY or SELL
  • startTime - in milliseconds eg.1641522717552
  • endTime - in milliseconds eg.1641522526562
  • page - Default is 1
  • pageSize - MIN 1, MAX 100; Default 100
  • recvWindow - The value cannot be greater than 60000
Link to this function

get_algo_spot_open_orders(opts \\ [])

@spec get_algo_spot_open_orders(recvWindow: any(), timestamp: any()) ::
  {:ok, any()} | {:error, any()}

Query Current Algo Open Orders (USER_DATA)

Get all open SPOT TWAP orders

Weight(IP): 1

Details:

  • METHOD: get
  • URL: /sapi/v1/algo/spot/openOrders

Mandatory params:

Optional params:

  • timestamp - timestamp
  • recvWindow - The value cannot be greater than 60000
Link to this function

get_algo_spot_sub_orders(algoId, opts \\ [])

@spec get_algo_spot_sub_orders(any(),
  recvWindow: any(),
  pageSize: any(),
  page: any(),
  timestamp: any()
) ::
  {:ok, any()} | {:error, any()}

Query Sub Orders (USER_DATA)

Get respective sub orders for a specified algoId

Weight(IP): 1

Details:

  • METHOD: get
  • URL: /sapi/v1/algo/spot/subOrders

Mandatory params:

  • algoId -

Optional params:

  • timestamp - timestamp
  • page - Default is 1
  • pageSize - MIN 1, MAX 100; Default 100
  • recvWindow - The value cannot be greater than 60000
Link to this function

post_algo_spot_new_order_twap(symbol, side, quantity, duration, opts \\ [])

@spec post_algo_spot_new_order_twap(any(), any(), any(), any(),
  recvWindow: any(),
  limitPrice: any(),
  clientAlgoId: any(),
  timestamp: any()
) :: {:ok, any()} | {:error, any()}

Time-Weighted Average Price New Order (TRADE)

Place a new spot TWAP order with Algo service.

Total Algo open orders max allowed: 10 orders.

Weight(UID): 3000

Details:

  • METHOD: post
  • URL: /sapi/v1/algo/spot/newOrderTwap

Mandatory params:

  • symbol - Trading symbol eg. BTCUSDT
  • side - Trading side ( BUY or SELL )
  • quantity - Quantity of base asset; The notional (quantity * last price(base asset)) must be more than the equivalent of 1,000 USDT and less than the equivalent of 100,000 USDT
  • duration - Duration for TWAP orders in seconds. [300, 86400]

Optional params:

  • timestamp - timestamp
  • clientAlgoId - A unique id among Algo orders (length should be 32 characters), If it is not sent, we will give default value
  • limitPrice - Limit price of the order; If it is not sent, will place order by market price by default
  • recvWindow - The value cannot be greater than 60000