Binance icon

Binance

Consume Binance API (v.0.1.9)

Overview

This node interacts with the Binance API to perform various trading operations, specifically supporting the creation of a new OCO (One-Cancels-the-Other) order. It allows users to place complex conditional orders where one order cancels the other if executed. This is useful for traders who want to manage risk and automate exit strategies by setting both a limit order and a stop-limit order simultaneously.

Use Case Examples

  1. A trader wants to place an OCO order on Binance to sell a cryptocurrency if the price reaches a certain high (limit order) or to stop losses if the price drops to a certain level (stop-limit order).
  2. Automating the placement of OCO orders to manage trades without manual intervention, ensuring timely execution of exit strategies.

Properties

Name Meaning
Symbol The trading pair symbol for the order, e.g., BTCUSDT. Required to specify which market the OCO order applies to.
Side The side of the trade, either BUY or SELL, indicating the direction of the order.
Quantity The quantity of the asset to trade in the OCO order, with precision up to two decimal places.
Price The limit price for the OCO order, with precision up to two decimal places.
Stop Price The stop price for the stop-limit leg of the OCO order, with precision up to two decimal places.
Timestamp The timestamp of the request, used for request validation and synchronization with Binance server time.
Add Optional Operations A collection of optional parameters to customize the OCO order, such as client order IDs, iceberg quantities, trailing delta, stop limit price, time in force, response type, and receive window.

Output

JSON

  • orderListId - The unique identifier for the OCO order list returned by Binance.
  • contingencyType - Type of contingency, typically 'OCO' for this operation.
  • listStatusType - Status of the OCO order list (e.g., EXEC_STARTED, ALL_DONE).
  • listOrderStatus - Overall status of the OCO order list.
  • listClientOrderId - Client-supplied unique ID for the entire OCO order list.
  • transactionTime - Timestamp of the transaction execution.
  • symbol - Trading pair symbol for the OCO order.
  • orders - Array of individual orders within the OCO list, each with details like orderId, clientOrderId, and order status.
  • orderReports - Array of detailed reports for each order in the OCO list, including execution details.

Dependencies

  • Binance API
  • An API key credential for Binance with necessary permissions

Troubleshooting

  • Common issues include invalid or missing required parameters such as symbol, side, quantity, price, or stopPrice. Ensure all required fields are correctly filled.
  • Timestamp errors may occur if the timestamp parameter is not synchronized with Binance server time; ensure the timestamp is accurate and within allowed limits.
  • Errors related to client order IDs may arise if duplicate IDs are used; use unique identifiers for each order or order list.
  • API rate limits may cause request failures; respect Binance API rate limits and use the recvWindow parameter appropriately.

Links

Discussion