> For the complete documentation index, see [llms.txt](https://satangdev.gitbook.io/satang-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://satangdev.gitbook.io/satang-api/apis/private/orders.md).

# Orders

NOTE: This endpoint requires API key and request signing, for more information please refer to Authentication section.

The Orders API has V1 and V3, If use V3 the URL will be <https://satangcorp.com/api/v3>

## Create

<mark style="color:green;">`POST`</mark> `https://satangcorp.com/api/orders/`

\*\*Please check that the price and amount field must be **string**.&#x20;

#### Headers

| Name          | Type   | Description                                          |
| ------------- | ------ | ---------------------------------------------------- |
| Signature     | string | This field require encrypt of API key and API Secret |
| Authorization | string | This field require API key                           |

#### Request Body

| Name   | Type    | Description                                                            |
| ------ | ------- | ---------------------------------------------------------------------- |
| type   | string  | A string representing order type, can be 'limit' or 'merket'           |
| pair   | string  | A string representing paring, can be 'btc\_thb'  'eth\_thb' ...        |
| side   | string  | A string representing order side, can be 'sell' or 'buy'               |
| price  | string  | A string representing price you want to buy or sell, in smallest unit  |
| amount | string  | A string representing quantity you want to buy or sell                 |
| nonce  | integer | An unique integer for each request, normally this will unix time stamp |

{% tabs %}
{% tab title="202 " %}

```javascript
{
  "id": 1293
}
```

{% endtab %}
{% endtabs %}

## List user orders

<mark style="color:blue;">`GET`</mark> `https://satangcorp.com/api/orders/user`

<https://satangcorp.com/api/v3/orders/user>

#### Query Parameters

| Name   | Type   | Description                                            |
| ------ | ------ | ------------------------------------------------------ |
| pair   | string | A string representing pairing                          |
| limit  | string | A string representing limit to return                  |
| offset | string | A string representing offset                           |
| status | string | A string representing order status ("open" or "close") |
| side   | string | A string representing side                             |

#### Headers

| Name          | Type   | Description                                          |
| ------------- | ------ | ---------------------------------------------------- |
| Signature     | string | This field require encrypt of API key and API secret |
| Authorization | string | This field require API key                           |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    "id": 7033371,
    "price": "32.897531",
    "amount": "532.870154",
    "remaining_amount": "532.870154",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:17:18.419747+01:00",
    "status": "created"
  },
  {
    "id": 7033346,
    "price": "32.882336",
    "amount": "222.017572",
    "remaining_amount": "222.017572",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:17:11.33432+01:00",
    "status": "created"
  },
  {
    "id": 7033329,
    "price": "32.562438",
    "amount": "484.427136",
    "remaining_amount": "484.427136",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:17:06.304916+01:00",
    "status": "created"
  },
  {
    "id": 7033314,
    "price": "32.570467",
    "amount": "915.08836",
    "remaining_amount": "915.08836",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:17:01.087918+01:00",
    "status": "created"
  },
  {
    "id": 7033311,
    "price": "32.551656",
    "amount": "1128.126593",
    "remaining_amount": "1128.126593",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:17:00.184203+01:00",
    "status": "created"
  },
  {
    "id": 7033307,
    "price": "32.764417",
    "amount": "235.979696",
    "remaining_amount": "235.979696",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:16:58.309938+01:00",
    "status": "created"
  },
  {
    "id": 7033300,
    "price": "32.888194",
    "amount": "432.81729",
    "remaining_amount": "432.81729",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:16:57.309632+01:00",
    "status": "created"
  },
  {
    "id": 7033288,
    "price": "32.823571",
    "amount": "458.850473",
    "remaining_amount": "458.850473",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:16:53.881117+01:00",
    "status": "created"
  },
  {
    "id": 7033265,
    "price": "32.887462",
    "amount": "406.845988",
    "remaining_amount": "406.845988",
    "side": "sell",
    "cost": "0",
    "created_at": "2018-12-04T13:16:46.226628+01:00",
    "status": "created"
  }
]
```

{% endtab %}
{% endtabs %}

## Cancel order

<mark style="color:red;">`DELETE`</mark> `https://satangcorp.com/api/orders/{order_id}`

<https://satangcorp.com/api/v3/orders/{order\\_id}>

#### Headers

| Name          | Type   | Description                                             |
| ------------- | ------ | ------------------------------------------------------- |
| Signature     | string | This field require an encrypt of API key and API secret |
| Authorization | string | This field require API key                              |

#### Request Body

| Name | Type   | Description                |
| ---- | ------ | -------------------------- |
| pair | string | A string representing pair |

{% tabs %}
{% tab title="202 " %}

```
```

{% endtab %}
{% endtabs %}

## Cancel all order

<mark style="color:red;">`DELETE`</mark> `https://satangcorp.com/api/orders/all`

<https://satangcorp.com/api/v3/orders/all\\>
\
Cancel all open orders of a user

#### Headers

| Name          | Type   | Description                                             |
| ------------- | ------ | ------------------------------------------------------- |
| Signature     | string | This field require an encrypt of API key and API secret |
| Authorization | string | This field require API key                              |

{% tabs %}
{% tab title="200 " %}

```
{}
```

{% endtab %}
{% endtabs %}
