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

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-order

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

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

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

Function Name:

Usage:

Cancel Order

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

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

Function Name:

Usage:

Cancel Multiple Orders

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

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

Function Name:

Usage:

Amend Order

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

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

Function Name:

Usage:

Amend Multiple Orders

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

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

Function Name:

Usage:

Close Positions

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

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

Function Name:

Usage:

Order Details And Transaction History

Get Order Details

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

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

Function Name:

Usage:

Get Order List

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

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

Function Name:

Usage:

Get Order History (last 7 days)

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-days

Function Name:

Usage:

Get Order History (last 3 months)

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-months

Function Name:

Usage:

Get Transaction Details (last 3 days)

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-days

Function Name:

Usage:

Get Transaction Details (last 3 months)

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-months

Function Name:

Usage:

Placing & Editing Algo Orders

Place Algo Order

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

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

Function Name:

Usage:

Cancel Algo Order

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

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

Function Name:

Usage:

Cancel Advance Algo Order

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

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

Function Name:

Usage:

Get Algo Order List

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

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

Function Name:

Usage:

Get Algo Order History

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

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

Function Name:

Usage:

One-Click & Easy Convert

Get Easy Convert Currency List

Place Easy Convert

Get Easy Convert History

Get One-Click Repay Currency List

Trade One-Click Repay

Get One-Click Repay History

Block Trading

Get Counterparties

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

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

Function Name:

Usage:

Create RFQ

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

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

Function Name:

Usage:

Cancel RFQ

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

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

Function Name:

Usage:

Cancel Multiple RFQ's

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

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

Function Name:

Usage:

Cancel All RFQ's

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

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

Function Name:

Usage:

Execute Quote

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

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

Function Name:

Usage:

Set Quote Products

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

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

Function Name:

Usage:

Reset MMP Status

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

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

Function Name:

Usage:

Create Quote

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

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

Function Name:

Usage:

Cancel Quote

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

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

Function Name:

Usage:

Cancel Multiple Quotes

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

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

Function Name:

Usage:

Cancel All Quotes

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

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

Function Name:

Usage:

Get RFQ's

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

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

Function Name:

Usage:

Get Quotes

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

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

Function Name:

Usage:

Get Trades

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

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

Function Name:

Usage:

Get Public Trades

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

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

Function Name:

Usage:

Last updated