Binance icon

Binance

Consume Binance API (v.0.1.9)

Overview

This node interacts with the Binance API to manage cryptocurrency orders. Specifically, the 'Cancel an Existing Order and Send a New Order (TRADE)' operation allows users to cancel an existing order and place a new order in a single request. This is useful for traders who want to modify their orders quickly without manually canceling and then creating a new order. Practical examples include adjusting a limit order price or changing the order quantity while ensuring the original order is canceled first.

Use Case Examples

  1. A trader wants to cancel a limit buy order for BTCUSDT and immediately place a new limit buy order with a different price.
  2. A user wants to stop a current sell order and replace it with a market sell order to exit a position quickly.

Properties

Name Meaning
Symbol The trading pair symbol for the order, e.g., BTCUSDT. Required to identify which market the order applies to.
Side The side of the new order, either BUY or SELL. Indicates whether the new order is a buy or sell order.
Type The type of the new order, such as LIMIT, MARKET, STOP_LOSS, etc. Determines the order execution method.
Cancel Replace Mode Defines behavior if the cancel request fails. STOP_ON_FAILURE stops new order placement if cancel fails; ALLOW_FAILURES attempts new order placement regardless of cancel success.
Timestamp The timestamp of the request, used for API request validation.
Add Optional Operations Additional optional parameters for the new order and cancel request, such as time in force, quantity, price, client order IDs, stop price, trailing delta, iceberg quantity, response type, and receive window.

Output

JSON

  • symbol - The trading pair symbol for the order.
  • side - The side of the new order (BUY or SELL).
  • type - The type of the new order (e.g., LIMIT, MARKET).
  • cancelReplaceMode - The mode defining behavior if cancel request fails.
  • timestamp - Timestamp of the request.
  • optionalPostOperations - Additional optional parameters included in the request.
  • response - The response from the Binance API after attempting to cancel the existing order and place the new order.

Dependencies

  • Binance API

Troubleshooting

  • Ensure the API key and secret used for authentication are correct and have the necessary permissions for trading operations.
  • If the cancel request fails and 'STOP_ON_FAILURE' mode is used, the new order will not be placed. Consider using 'ALLOW_FAILURES' if you want to place the new order regardless.
  • Check that the symbol and order parameters are valid and supported by Binance to avoid API errors.
  • Timestamp must be accurate and within the allowed window to prevent request rejection due to timing issues.

Links

Discussion