Trading & Orders

Documentation on interacting with a variety of OKX trading and order API functions through the PENDAX SDK.

All Trading & Order API endpoints require authentication. Please create OKX API keys to interact with these functions successfully. Accounts must be funded or collateralized for any trades to successfully post. Please note that some endpoints for Algo & Block trading are currently under development.

Placing and Manipulating Orders

Place Order

circle-info

Please refer to the official OKX API Docs for the required parameters. You can place an order only if you have sufficient funds.

https://www.okx.com/docs-v5/en/#rest-api-trade-place-orderarrow-up-right

Function Name:

placeOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

  let myOkxAccount = createExchange({
      exchange: "okx",
      authenticate: true,
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "okx",
      marginType: "usdt"
});

    async function placeOrder(exchange, options) {
        try {
            let result = await exchange.placeOrder(options);
            return result
            console.log(result);
        } catch (error) {
            console.log(error.message);
        }
    }
  
    const result = await placeOrder(myOkxAccount, {
         instId: "BTC-USDT",
         tdMode: "cash",
         side: "buy",
         ordType: "limit",
         px: "10000",
         sz: ".01",         // for SWAPS sz is number of contracts which is .01 BTC
    })

Place Multiple Orders

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-place-multiple-ordersarrow-up-right

Function Name:

Usage:

Cancel Order

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-orderarrow-up-right

Function Name:

Usage:

Cancel Multiple Orders

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-multiple-ordersarrow-up-right

Function Name:

Usage:

Amend Order

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-amend-orderarrow-up-right

Function Name:

Usage:

Amend Multiple Orders

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-amend-multiple-ordersarrow-up-right

Function Name:

Usage:

Close Positions

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-close-positionsarrow-up-right

Function Name:

Usage:

Order Details And Transaction History

Get Order Details

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-detailsarrow-up-right

Function Name:

Usage:

Get Order List

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-listarrow-up-right

Function Name:

Usage:

Get Order History (last 7 days)

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-7-daysarrow-up-right

Function Name:

Usage:

Get Order History (last 3 months)

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-3-monthsarrow-up-right

Function Name:

Usage:

Get Transaction Details (last 3 days)

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-daysarrow-up-right

Function Name:

Usage:

Get Transaction Details (last 3 months)

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-monthsarrow-up-right

Function Name:

Usage:

Placing & Editing Algo Orders

Place Algo Order

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-place-algo-orderarrow-up-right

Function Name:

Usage:

Cancel Algo Order

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-algo-orderarrow-up-right

Function Name:

Usage:

Cancel Advance Algo Order

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-orderarrow-up-right

Function Name:

Usage:

Get Algo Order List

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-algo-order-listarrow-up-right

Function Name:

Usage:

Get Algo Order History

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-trade-get-algo-order-historyarrow-up-right

Function Name:

Usage:

One-Click & Easy Convert

Get Easy Convert Currency List

circle-exclamation

Place Easy Convert

circle-exclamation

Get Easy Convert History

circle-exclamation

Get One-Click Repay Currency List

circle-exclamation

Trade One-Click Repay

circle-exclamation

Get One-Click Repay History

circle-exclamation

Block Trading

Get Counterparties

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-get-counterpartiesarrow-up-right

Function Name:

Usage:

Create RFQ

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-create-rfqarrow-up-right

Function Name:

Usage:

Cancel RFQ

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-cancel-rfqarrow-up-right

Function Name:

Usage:

Cancel Multiple RFQ's

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-cancel-multiple-rfqsarrow-up-right

Function Name:

Usage:

Cancel All RFQ's

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-cancel-all-rfqsarrow-up-right

Function Name:

Usage:

Execute Quote

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-execute-quotearrow-up-right

Function Name:

Usage:

Set Quote Products

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-set-quote-productsarrow-up-right

Function Name:

Usage:

Reset MMP Status

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-reset-mmp-statusarrow-up-right

Function Name:

Usage:

Create Quote

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-create-quotearrow-up-right

Function Name:

Usage:

Cancel Quote

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-cancel-quotearrow-up-right

Function Name:

Usage:

Cancel Multiple Quotes

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-cancel-multiple-quotesarrow-up-right

Function Name:

Usage:

Cancel All Quotes

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-cancel-all-quotesarrow-up-right

Function Name:

Usage:

Get RFQ's

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-get-rfqsarrow-up-right

Function Name:

Usage:

Get Quotes

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-get-quotesarrow-up-right

Function Name:

Usage:

Get Trades

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-get-tradesarrow-up-right

Function Name:

Usage:

Get Public Trades

circle-exclamation
circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-block-trading-get-public-tradesarrow-up-right

Function Name:

Usage:

Last updated