Binance Connector JS
    Preparing search index...

    TradeApi - interface TradeApi

    interface TradeApiInterface {
        cancelAllCmOpenConditionalOrders(
            requestParameters: CancelAllCmOpenConditionalOrdersRequest,
        ): Promise<RestApiResponse<CancelAllCmOpenConditionalOrdersResponse>>;
        cancelAllCmOpenOrders(
            requestParameters: CancelAllCmOpenOrdersRequest,
        ): Promise<RestApiResponse<CancelAllCmOpenOrdersResponse>>;
        cancelAllUmOpenConditionalOrders(
            requestParameters: CancelAllUmOpenConditionalOrdersRequest,
        ): Promise<RestApiResponse<CancelAllUmOpenConditionalOrdersResponse>>;
        cancelAllUmOpenOrders(
            requestParameters: CancelAllUmOpenOrdersRequest,
        ): Promise<RestApiResponse<CancelAllUmOpenOrdersResponse>>;
        cancelCmConditionalOrder(
            requestParameters: CancelCmConditionalOrderRequest,
        ): Promise<RestApiResponse<CancelCmConditionalOrderResponse>>;
        cancelCmOrder(
            requestParameters: CancelCmOrderRequest,
        ): Promise<RestApiResponse<CancelCmOrderResponse>>;
        cancelMarginAccountAllOpenOrdersOnASymbol(
            requestParameters: CancelMarginAccountAllOpenOrdersOnASymbolRequest,
        ): Promise<
            RestApiResponse<CancelMarginAccountAllOpenOrdersOnASymbolResponse>,
        >;
        cancelMarginAccountOcoOrders(
            requestParameters: CancelMarginAccountOcoOrdersRequest,
        ): Promise<RestApiResponse<CancelMarginAccountOcoOrdersResponse>>;
        cancelMarginAccountOrder(
            requestParameters: CancelMarginAccountOrderRequest,
        ): Promise<RestApiResponse<CancelMarginAccountOrderResponse>>;
        cancelUmConditionalOrder(
            requestParameters: CancelUmConditionalOrderRequest,
        ): Promise<RestApiResponse<CancelUmConditionalOrderResponse>>;
        cancelUmOrder(
            requestParameters: CancelUmOrderRequest,
        ): Promise<RestApiResponse<CancelUmOrderResponse>>;
        cmAccountTradeList(
            requestParameters?: CmAccountTradeListRequest,
        ): Promise<RestApiResponse<CmAccountTradeListResponse>>;
        cmPositionAdlQuantileEstimation(
            requestParameters?: CmPositionAdlQuantileEstimationRequest,
        ): Promise<RestApiResponse<CmPositionAdlQuantileEstimationResponse>>;
        getUmFuturesBnbBurnStatus(
            requestParameters?: GetUmFuturesBnbBurnStatusRequest,
        ): Promise<RestApiResponse<GetUmFuturesBnbBurnStatusResponse>>;
        marginAccountBorrow(
            requestParameters: MarginAccountBorrowRequest,
        ): Promise<RestApiResponse<MarginAccountBorrowResponse>>;
        marginAccountNewOco(
            requestParameters: DerivativesTradingPortfolioMarginRestAPI.MarginAccountNewOcoRequest,
        ): Promise<
            RestApiResponse<
                DerivativesTradingPortfolioMarginRestAPI.MarginAccountNewOcoResponse,
            >,
        >;
        marginAccountRepay(
            requestParameters: MarginAccountRepayRequest,
        ): Promise<RestApiResponse<MarginAccountRepayResponse>>;
        marginAccountRepayDebt(
            requestParameters: MarginAccountRepayDebtRequest,
        ): Promise<RestApiResponse<MarginAccountRepayDebtResponse>>;
        marginAccountTradeList(
            requestParameters: MarginAccountTradeListRequest,
        ): Promise<RestApiResponse<MarginAccountTradeListResponse>>;
        modifyCmOrder(
            requestParameters: ModifyCmOrderRequest,
        ): Promise<RestApiResponse<ModifyCmOrderResponse>>;
        modifyUmOrder(
            requestParameters: ModifyUmOrderRequest,
        ): Promise<RestApiResponse<ModifyUmOrderResponse>>;
        newCmConditionalOrder(
            requestParameters: NewCmConditionalOrderRequest,
        ): Promise<RestApiResponse<NewCmConditionalOrderResponse>>;
        newCmOrder(
            requestParameters: NewCmOrderRequest,
        ): Promise<RestApiResponse<NewCmOrderResponse>>;
        newMarginOrder(
            requestParameters: NewMarginOrderRequest,
        ): Promise<RestApiResponse<NewMarginOrderResponse>>;
        newUmConditionalOrder(
            requestParameters: NewUmConditionalOrderRequest,
        ): Promise<RestApiResponse<NewUmConditionalOrderResponse>>;
        newUmOrder(
            requestParameters: NewUmOrderRequest,
        ): Promise<RestApiResponse<NewUmOrderResponse>>;
        queryAllCmConditionalOrders(
            requestParameters?: QueryAllCmConditionalOrdersRequest,
        ): Promise<RestApiResponse<QueryAllCmConditionalOrdersResponse>>;
        queryAllCmOrders(
            requestParameters: QueryAllCmOrdersRequest,
        ): Promise<RestApiResponse<QueryAllCmOrdersResponse>>;
        queryAllCurrentCmOpenConditionalOrders(
            requestParameters?: QueryAllCurrentCmOpenConditionalOrdersRequest,
        ): Promise<RestApiResponse<QueryAllCurrentCmOpenConditionalOrdersResponse>>;
        queryAllCurrentCmOpenOrders(
            requestParameters?: QueryAllCurrentCmOpenOrdersRequest,
        ): Promise<RestApiResponse<QueryAllCurrentCmOpenOrdersResponse>>;
        queryAllCurrentUmOpenConditionalOrders(
            requestParameters?: QueryAllCurrentUmOpenConditionalOrdersRequest,
        ): Promise<RestApiResponse<QueryAllCurrentUmOpenConditionalOrdersResponse>>;
        queryAllCurrentUmOpenOrders(
            requestParameters?: QueryAllCurrentUmOpenOrdersRequest,
        ): Promise<RestApiResponse<QueryAllCurrentUmOpenOrdersResponse>>;
        queryAllMarginAccountOrders(
            requestParameters: QueryAllMarginAccountOrdersRequest,
        ): Promise<RestApiResponse<QueryAllMarginAccountOrdersResponse>>;
        queryAllUmConditionalOrders(
            requestParameters?: QueryAllUmConditionalOrdersRequest,
        ): Promise<RestApiResponse<QueryAllUmConditionalOrdersResponse>>;
        queryAllUmOrders(
            requestParameters: QueryAllUmOrdersRequest,
        ): Promise<RestApiResponse<QueryAllUmOrdersResponse>>;
        queryCmConditionalOrderHistory(
            requestParameters: QueryCmConditionalOrderHistoryRequest,
        ): Promise<RestApiResponse<QueryCmConditionalOrderHistoryResponse>>;
        queryCmModifyOrderHistory(
            requestParameters: QueryCmModifyOrderHistoryRequest,
        ): Promise<RestApiResponse<QueryCmModifyOrderHistoryResponse>>;
        queryCmOrder(
            requestParameters: QueryCmOrderRequest,
        ): Promise<RestApiResponse<QueryCmOrderResponse>>;
        queryCurrentCmOpenConditionalOrder(
            requestParameters: QueryCurrentCmOpenConditionalOrderRequest,
        ): Promise<RestApiResponse<QueryCurrentCmOpenConditionalOrderResponse>>;
        queryCurrentCmOpenOrder(
            requestParameters: QueryCurrentCmOpenOrderRequest,
        ): Promise<RestApiResponse<QueryCurrentCmOpenOrderResponse>>;
        queryCurrentMarginOpenOrder(
            requestParameters: QueryCurrentMarginOpenOrderRequest,
        ): Promise<RestApiResponse<QueryCurrentMarginOpenOrderResponse>>;
        queryCurrentUmOpenConditionalOrder(
            requestParameters: QueryCurrentUmOpenConditionalOrderRequest,
        ): Promise<RestApiResponse<QueryCurrentUmOpenConditionalOrderResponse>>;
        queryCurrentUmOpenOrder(
            requestParameters: QueryCurrentUmOpenOrderRequest,
        ): Promise<RestApiResponse<QueryCurrentUmOpenOrderResponse>>;
        queryMarginAccountOrder(
            requestParameters: QueryMarginAccountOrderRequest,
        ): Promise<RestApiResponse<QueryMarginAccountOrderResponse>>;
        queryMarginAccountsAllOco(
            requestParameters?: DerivativesTradingPortfolioMarginRestAPI.QueryMarginAccountsAllOcoRequest,
        ): Promise<
            RestApiResponse<
                DerivativesTradingPortfolioMarginRestAPI.QueryMarginAccountsAllOcoResponse,
            >,
        >;
        queryMarginAccountsOco(
            requestParameters?: DerivativesTradingPortfolioMarginRestAPI.QueryMarginAccountsOcoRequest,
        ): Promise<
            RestApiResponse<
                DerivativesTradingPortfolioMarginRestAPI.QueryMarginAccountsOcoResponse,
            >,
        >;
        queryMarginAccountsOpenOco(
            requestParameters?: DerivativesTradingPortfolioMarginRestAPI.QueryMarginAccountsOpenOcoRequest,
        ): Promise<
            RestApiResponse<
                DerivativesTradingPortfolioMarginRestAPI.QueryMarginAccountsOpenOcoResponse,
            >,
        >;
        queryUmConditionalOrderHistory(
            requestParameters: QueryUmConditionalOrderHistoryRequest,
        ): Promise<RestApiResponse<QueryUmConditionalOrderHistoryResponse>>;
        queryUmModifyOrderHistory(
            requestParameters: QueryUmModifyOrderHistoryRequest,
        ): Promise<RestApiResponse<QueryUmModifyOrderHistoryResponse>>;
        queryUmOrder(
            requestParameters: QueryUmOrderRequest,
        ): Promise<RestApiResponse<QueryUmOrderResponse>>;
        queryUsersCmForceOrders(
            requestParameters?: QueryUsersCmForceOrdersRequest,
        ): Promise<RestApiResponse<QueryUsersCmForceOrdersResponse>>;
        queryUsersMarginForceOrders(
            requestParameters?: QueryUsersMarginForceOrdersRequest,
        ): Promise<RestApiResponse<QueryUsersMarginForceOrdersResponse>>;
        queryUsersUmForceOrders(
            requestParameters?: QueryUsersUmForceOrdersRequest,
        ): Promise<RestApiResponse<QueryUsersUmForceOrdersResponse>>;
        toggleBnbBurnOnUmFuturesTrade(
            requestParameters: ToggleBnbBurnOnUmFuturesTradeRequest,
        ): Promise<RestApiResponse<ToggleBnbBurnOnUmFuturesTradeResponse>>;
        umAccountTradeList(
            requestParameters: UmAccountTradeListRequest,
        ): Promise<RestApiResponse<UmAccountTradeListResponse>>;
        umPositionAdlQuantileEstimation(
            requestParameters?: UmPositionAdlQuantileEstimationRequest,
        ): Promise<RestApiResponse<UmPositionAdlQuantileEstimationResponse>>;
    }

    Implemented by

    Index

    Methods

    • Get trades for a specific account and CM symbol.

      Either symbol or pair must be sent symbol and pair cannot be sent together pair and fromId cannot be sent together OrderId can only be sent together with symbol If a pair is sent, tickers for all symbols of the pair will be returned The parameter fromId cannot be sent with startTime or endTime If startTime and endTime are both not sent, then the last '24 hours' data will be returned. The time between startTime and endTime cannot be longer than 24 hours.

      Weight: 20 with symbol, 40 with pair

      Parameters

      Returns Promise<RestApiResponse<CmAccountTradeListResponse>>

      TradeApiInterface

    • Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue

      Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. Both quantity and price must be sent When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. However the order will be cancelled by the amendment in the following situations: when the order is in partially filled status and the new quantity <= executedQty When the order is GTX and the new price will cause it to be executed immediately

      Weight: 1

      Parameters

      Returns Promise<RestApiResponse<ModifyCmOrderResponse>>

      TradeApiInterface

    • Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue

      Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent. Both quantity and price must be sent When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is. However the order will be cancelled by the amendment in the following situations: when the order is in partially filled status and the new quantity <= executedQty When the order is GTX and the new price will cause it to be executed immediately

      Weight: 1

      Parameters

      Returns Promise<RestApiResponse<ModifyUmOrderResponse>>

      TradeApiInterface

    • New CM Conditional Order

      Order with type STOP/TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). Condition orders will be triggered when: STOP, STOP_MARKET: BUY: "MARK_PRICE" >= stopPrice SELL: "MARK_PRICE" <= stopPrice TAKE_PROFIT, TAKE_PROFIT_MARKET: BUY: "MARK_PRICE" <= stopPrice SELL: "MARK_PRICE" >= stopPrice TRAILING_STOP_MARKET: BUY: the lowest mark price after order placed <= activationPrice, and the latest mark price >= the lowest mark price * (1 + callbackRate) SELL: the highest mark price after order placed >= activationPrice, and the latest mark price <= the highest mark 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: activationPrice should be smaller than latest mark price. SELL: activationPrice should be larger than latest mark price. Condition orders will be triggered when: If parameterpriceProtectis sent as true: when price reaches the stopPrice ,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") >= stopPrice SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice TAKE_PROFIT, TAKE_PROFIT_MARKET: BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice

      Weight: 1

      Parameters

      Returns Promise<RestApiResponse<NewCmConditionalOrderResponse>>

      TradeApiInterface

    • Place new UM conditional order

      Order with type STOP/TAKE_PROFIT, parameter timeInForce can be sent ( default GTC). Condition orders will be triggered when: STOP, STOP_MARKET: BUY: "MARK_PRICE" >= stopPrice SELL: "MARK_PRICE" <= stopPrice TAKE_PROFIT, TAKE_PROFIT_MARKET: BUY: "MARK_PRICE" <= stopPrice SELL: "MARK_PRICE" >= stopPrice TRAILING_STOP_MARKET: BUY: the lowest mark price after order placed <= activationPrice, and the latest mark price >= the lowest mark price * (1 + callbackRate) SELL: the highest mark price after order placed >= activationPrice, and the latest mark price <= the highest mark 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: activationPrice should be smaller than latest mark price. SELL: activationPrice should be larger than latest mark price. Condition orders will be triggered when: If parameterpriceProtectis sent as true: when price reaches the stopPrice ,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") >= stopPrice SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice TAKE_PROFIT, TAKE_PROFIT_MARKET: BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD. In extreme market conditions, timeInForce GTD order auto cancel time might be delayed comparing to goodTillDate

      Weight: 1

      Parameters

      Returns Promise<RestApiResponse<NewUmConditionalOrderResponse>>

      TradeApiInterface

    • Place new UM order

      If newOrderRespType is sent as RESULT : MARKET order: the final FILLED result of the order will be return directly. LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly. selfTradePreventionMode is only effective when timeInForce set to IOC or GTC or GTD. In extreme market conditions, timeInForce GTD order auto cancel time might be delayed comparing to goodTillDate

      Weight: 1

      Parameters

      Returns Promise<RestApiResponse<NewUmOrderResponse>>

      TradeApiInterface