> ## Documentation Index
> Fetch the complete documentation index at: https://docs.idax.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Margin

## Trade

### Security Type: TRADE

Endpoints under Trade require an API key and a signature.

***

### New Order

<Note type="success">
  **`POST`** `https://openapi.idax.exchange/sapi/v2/margin/order`
</Note>

**Rate Limit: 100 times/2s**

#### Headers

| Name        | Type   | Description  |
| ----------- | ------ | ------------ |
| X-CH-SIGN   | string | Sign         |
| X-CH-TS     | string | Timestamp    |
| X-CH-APIKEY | string | Your API key |

#### Request Body

| Name             | Type   | Description                                                                           |
| ---------------- | ------ | ------------------------------------------------------------------------------------- |
| type             | string | Type of the order: `LIMIT/MARKET`                                                     |
| price            | number | Order price, REQUIRED for LIMIT orders                                                |
| newClientOrderId | string | Unique order ID generated by users to mark their orders. Cannot exceed 32 characters. |
| side             | string | Side of the order: `BUY/SELL`                                                         |
| volume           | number | Order volume. For MARKET BUY orders, vol = amount.                                    |
| symbol           | string | Symbol Name E.g. BTC/USDT                                                             |

<Tabs>
  <Tab title="200: OK">
    ```json theme={"system"}
    {
        "symbol": "LXTUSDT",
        "orderId": "494736827050147840",
        "clientOrderId": "157371322565051",
        "transactTime": "1573713225668",
        "price": "0.005452",
        "origQty": "110",
        "executedQty": "0",
        "status": "NEW",
        "type": "LIMIT",
        "side": "SELL"
    }
    ```
  </Tab>
</Tabs>

**weight(IP/UID): 5**

***

### Query Order

<Note type="info">
  **`GET`** `https://openapi.idax.exchange/sapi/v2/margin/order`
</Note>

**Rate Limit: 20 times/2s**

#### Query Parameters

| Name             | Type   | Description                                                                                        |
| ---------------- | ------ | -------------------------------------------------------------------------------------------------- |
| orderId          | string | Order ID                                                                                           |
| newClientOrderId | string | Client Order ID, unique order ID generated by users to mark their orders. E.g. `354444heihieddada` |
| symbol           | string | Symbol Name E.g. BTC/USDT                                                                          |

#### Headers

| Name        | Type   | Description  |
| ----------- | ------ | ------------ |
| X-CH-SIGN   | string | Sign         |
| X-CH-TS     | string | Timestamp    |
| X-CH-APIKEY | string | Your API key |

<Tabs>
  <Tab title="200: OK">
    ```json theme={"system"}
    {
        "orderId": "499890200602846976",
        "clientOrderId": "157432755564968",
        "symbol": "BHTUSDT",
        "price": "0.01",
        "origQty": "50",
        "executedQty": "0",
        "avgPrice": "0",
        "status": "NEW",
        "type": "LIMIT",
        "side": "BUY",
        "transactTime": "1574327555669"
    }
    ```
  </Tab>
</Tabs>

**weight(IP/UID): 5**

***

### Cancel Order

<Note type="success">
  **`POST`** `https://openapi.idax.exchange/sapi/v2/margin/cancel`
</Note>

**Rate Limit: 100 times/2s**

#### Headers

| Name        | Type   | Description  |
| ----------- | ------ | ------------ |
| X-CH-SIGN   | string | Sign         |
| X-CH-TS     | string | Timestamp    |
| X-CH-APIKEY | string | Your API key |

#### Request Body

| Name             | Type   | Description               |
| ---------------- | ------ | ------------------------- |
| newClientOrderId | string | Client Order ID           |
| symbol           | string | Symbol Name E.g. BTC/USDT |
| orderId          | string | Order ID                  |

<Tabs>
  <Tab title="200: OK">
    ```json theme={"system"}
    {
        "symbol": "BHTUSDT",
        "clientOrderId": "0",
        "orderId": "499890200602846976",
        "status": "CANCELED"
    }
    ```
  </Tab>
</Tabs>

**weight(IP/UID): 5**

***

### Current Open Orders

<Note type="info">
  **`GET`** `https://openapi.idax.exchange/sapi/v2/margin/openOrders`
</Note>

**Rate Limit: 20 times/2s**

#### Query Parameters

| Name   | Type   | Description               |
| ------ | ------ | ------------------------- |
| symbol | string | Symbol Name E.g. BTC/USDT |
| limit  | string | Default 100; Max 1000     |

#### Headers

| Name        | Type   | Description  |
| ----------- | ------ | ------------ |
| X-CH-SIGN   | string | Sign         |
| X-CH-TS     | string | Timestamp    |
| X-CH-APIKEY | string | Your API key |

<Tabs>
  <Tab title="200: OK">
    ```json theme={"system"}
    [
        {
            "orderId": "499902955766523648",
            "symbol": "BHTUSDT",
            "price": "0.01",
            "origQty": "50",
            "executedQty": "0",
            "avgPrice": "0",
            "status": "NEW",
            "type": "LIMIT",
            "side": "BUY",
            "time": "1574329076202"
        }
    ]
    ```
  </Tab>
</Tabs>

**weight(IP/UID): 1**

***

### Trades

<Note type="info">
  **`GET`** `https://openapi.idax.exchange/sapi/v2/margin/myTrades`
</Note>

#### Query Parameters

| Name   | Type   | Description               |
| ------ | ------ | ------------------------- |
| symbol | string | Symbol Name E.g. BTC/USDT |
| limit  | string | Default 100; Max 1000     |
| fromId | string | Trade ID to fetch from    |

#### Headers

| Name        | Type   | Description  |
| ----------- | ------ | ------------ |
| X-CH-SIGN   | string | Sign         |
| X-CH-TS     | string | Timestamp    |
| X-CH-APIKEY | string | Your API key |

<Tabs>
  <Tab title="200: OK">
    ```json theme={"system"}
    [
      {
        "symbol": "ETHBTC",
        "id": 100211,
        "bidId": 150695552109032492,
        "askId": 150695552109032493,
        "price": "4.00000100",
        "qty": "12.00000000",
        "time": 1499865549590,
        "isBuyer": true,
        "isMaker": false,
        "feeCoin": "ETH",
        "fee": "0.001"
      }
    ]
    ```
  </Tab>
</Tabs>

**weight(IP/UID): 1**
