Binance Connector JS
    Preparing search index...

    TradeApi - interface

    TradeApi

    interface TradeApiInterface {
        cancelAlgoOrder(
            requestParameters?: DerivativesTradingUsdsFuturesWebsocketAPI.CancelAlgoOrderRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.CancelAlgoOrderResponse,
            >,
        >;
        cancelOrder(
            requestParameters: DerivativesTradingUsdsFuturesWebsocketAPI.CancelOrderRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.CancelOrderResponse,
            >,
        >;
        modifyOrder(
            requestParameters: DerivativesTradingUsdsFuturesWebsocketAPI.ModifyOrderRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.ModifyOrderResponse,
            >,
        >;
        newAlgoOrder(
            requestParameters: DerivativesTradingUsdsFuturesWebsocketAPI.NewAlgoOrderRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.NewAlgoOrderResponse,
            >,
        >;
        newOrder(
            requestParameters: DerivativesTradingUsdsFuturesWebsocketAPI.NewOrderRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.NewOrderResponse,
            >,
        >;
        positionInformation(
            requestParameters?: DerivativesTradingUsdsFuturesWebsocketAPI.PositionInformationRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.PositionInformationResponse,
            >,
        >;
        positionInformationV2(
            requestParameters?: DerivativesTradingUsdsFuturesWebsocketAPI.PositionInformationV2Request,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.PositionInformationV2Response,
            >,
        >;
        queryOrder(
            requestParameters: DerivativesTradingUsdsFuturesWebsocketAPI.QueryOrderRequest,
        ): Promise<
            WebsocketApiResponse<
                DerivativesTradingUsdsFuturesWebsocketAPI.QueryOrderResponse,
            >,
        >;
    }

    Implemented by

    Index

    Methods

    • Send in a new algo order.

      Weight(IP): 0

      Security Type: TRADE

      Notes:

      • Condition orders will be triggered when:
      • If parameterpriceProtectis sent as true:

      • when price reaches the triggerPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol

      • "triggerProtect" of a symbol can be got from GET /fapi/v1/exchangeInfo

      • STOP, STOP_MARKET:

      • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= triggerPrice

      • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= triggerPrice

      • TAKE_PROFIT, TAKE_PROFIT_MARKET:

      • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= triggerPrice

      • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= triggerPrice

      • TRAILING_STOP_MARKET:

      • BUY: the lowest price after order placed <= activatePrice, and the latest price >= the lowest price * (1 + callbackRate)

      • SELL: the highest price after order placed >= activatePrice, and the latest price <= the highest price * (1 - callbackRate)

      • For TRAILING_STOP_MARKET, if you got such error code.

      {"code": -2021, "msg": "Order would immediately trigger."}

      means that the parameters you send do not meet the following requirements:

      • BUY: activatePrice should be smaller than latest price.

      • SELL: activatePrice should be larger than latest price.

      • STOP_MARKET, TAKE_PROFIT_MARKET with closePosition=true:

      • Follow the same rules for condition orders.

      • If triggered,close all current long position( if SELL) or current short position( if BUY).

      • Cannot be used with quantity paremeter

      • Cannot be used with reduceOnly parameter

      • In Hedge Mode,cannot be used with BUY orders in LONG position side. and cannot be used with SELL orders in SHORT position side

      • selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD.

      Parameters

      Returns Promise<
          WebsocketApiResponse<
              DerivativesTradingUsdsFuturesWebsocketAPI.NewAlgoOrderResponse,
          >,
      >

      TradeApiInterface