Binance Connector JS
    Preparing search index...

    TradeApi - interface TradeApi

    interface TradeApiInterface {
        batchCancelOrders(
            requestParameters: BatchCancelOrdersRequest,
        ): Promise<RestApiResponse<BatchCancelOrdersResponse>>;
        getQuote(
            requestParameters: GetQuoteRequest,
        ): Promise<RestApiResponse<GetQuoteResponse>>;
        placeOrder(
            requestParameters: PlaceOrderRequest,
        ): Promise<RestApiResponse<PlaceOrderResponse>>;
        queryActiveOrders(
            requestParameters: QueryActiveOrdersRequest,
        ): Promise<RestApiResponse<QueryActiveOrdersResponse>>;
        queryOrderHistory(
            requestParameters: QueryOrderHistoryRequest,
        ): Promise<RestApiResponse<QueryOrderHistoryResponse>>;
    }

    Implemented by

    Index

    Methods

    • Cancel one or more active prediction orders in a single request. Requires SAS authorization.

      Known Issue — Bracket Encoding Incompatibility:* This endpoint uses indexed bracket notation (cancelInfoList[0].orderId). Binance SAPI signature verification runs over the raw, unencoded canonical string. However, mainstream HTTP libraries (Python requests, Java HttpURLConnection/URI, Go net/url, Node.js url) automatically percent-encode [ → %5B and ] → %5D, producing a signature mismatch with error -1022 Signature for this request is not valid. Postman is unaffected because it does not encode keys.

      Workarounds* (use low-level HTTP APIs that do not normalize URLs):

      • Python: use http.client (stdlib) and hand-build the body string.
      • Java: use HttpURLConnection and write the raw body bytes directly.
      • Go: use strings.NewReader with a hand-built body instead of url.Values.Encode().

      Weight(IP): 1

      Security Type: PREDICTION_TRADE

      Notes:

      • Use dot notation for nested list fields: cancelInfoList[0].orderId, cancelInfoList[1].orderId, etc.
      • vendor does not need to be supplied. The server automatically sets the correct vendor (predict_fun) for every item in the batch.

      Parameters

      Returns Promise<RestApiResponse<BatchCancelOrdersResponse>>

      TradeApiInterface

    • Get a price quote for a prediction order. The returned quoteId must be used in the subsequent Place Order request.

      Weight(IP): 1

      Security Type: PREDICTION_TRADE

      Response Notes:

      • feeAmount is a string because it is denominated in wei (18 decimals) and may exceed JavaScript's safe integer range. feeDiscountBps is also a string to allow fractional basis-point values in the future. feeRateBps and slippageBps are integers and will never exceed safe integer bounds.
      • Minimum order amount: The minimum order amount is set by the server and the upstream market rules and may change, so no fixed value is documented. BUY orders are checked by amount (amountIn) and SELL orders by share quantity, for both MARKET and LIMIT orders. If the amountIn of a BUY order is below the minimum, the server returns -9000 with the message Your order amount is too small. A successful quote does not guarantee that the order is accepted or filled, so check the error message and the final order status.

      Parameters

      Returns Promise<RestApiResponse<GetQuoteResponse>>

      TradeApiInterface