# Margin

**Trade** Security Type: TRADE Endpoints under Trade require an API-key and a signature.

#### New Order

**POST**\
`https://openapi.fokawa.com/sapi/v1/margin/order`

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

**Headers:**

* `X-CH-SIGN`: String (Sign)
* `X-CH-TS`: String (Timestamp)
* `X-CH-APIKEY`: String (Your API-key)

**Request Body:**

* `type`: String (Type of the order, LIMIT/MARKET)
* `recwwindow`: String (Time window)
* `price`: Number (Order price, REQUIRED for LIMIT orders)
* `newClientOrderId`: String (Unique order ID generated by users, 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., BTCUSDT)

**Response Example:**

```json
{
  "symbol": "LXTUSDT",
  "orderId": "494736827050147840",
  "clientOrderId": "157371322565051",
  "transactTime": "1573713225668",
  "price": "0.005452",
  "origQty": "110",
  "executedQty": "0",
  "status": "NEW",
  "type": "LIMIT",
  "side": "SELL"
}
```

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

#### Query Order

**GET**\
`https://openapi.fokawa.com/sapi/v1/margin/order`

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

**Query Parameters:**

* `orderId`: String (Order ID)
* `newClientOrderId`: String (Unique order ID generated by users, e.g., 354444heihieddada)
* `symbol`: String (Symbol Name, e.g., BTCUSDT)

**Headers:**

* `X-CH-SIGN`: String (Sign)
* `X-CH-TS`: String (Timestamp)
* `X-CH-APIKEY`: String (Your API-key)

**Response Example:**

```json
{
  "orderId": "499890200602846976",
  "clientOrderId": "157432755564968",
  "symbol": "BHTUSDT",
  "price": "0.01",
  "origQty": "50",
  "executedQty": "0",
  "avgPrice": "0",
  "status": "NEW",
  "type": "LIMIT",
  "side": "BUY",
  "transactTime": "1574327555669"
}
```

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

#### Cancel Order

**POST**\
`https://openapi.fokawa.com/sapi/v1/margin/cancel`

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

**Headers:**

* `X-CH-SIGN`: String (Sign)
* `X-CH-TS`: String (Timestamp)
* `X-CH-APIKEY`: String (Your API-key)

**Request Body:**

* `newClientOrderId`: String (Unique order ID generated by users, e.g., 354444heihieddada)
* `symbol`: String (Symbol Name, e.g., BTCUSDT)
* `orderId`: String (Order ID)

**Response Example:**

```json
{
  "symbol": "BHTUSDT",
  "clientOrderId": "0",
  "orderId": "499890200602846976",
  "status": "CANCELED"
}
```

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

#### Current Open Orders

**GET**\
`https://openapi.fokawa.com/sapi/v1/margin/openOrders`

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

**Query Parameters:**

* `symbol`: String (Symbol Name, e.g., BTCUSDT)
* `limit`: String (Default 100; Max 1000)

**Headers:**

* `X-CH-SIGN`: String (Sign)
* `X-CH-TS`: String (Timestamp)
* `X-CH-APIKEY`: String (Your API-key)

**Response Example:**

```json
[
  {
    "orderId": "499902955766523648",
    "symbol": "BHTUSDT",
    "price": "0.01",
    "origQty": "50",
    "executedQty": "0",
    "avgPrice": "0",
    "status": "NEW",
    "type": "LIMIT",
    "side": "BUY",
    "time": "1574329076202"
  }
]
```

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

#### Trades

**GET**\
`https://openapi.fokawa.com/sapi/v1/margin/myTrades`

**Query Parameters:**

* `symbol`: String (Symbol Name, e.g., BTCUSDT)
* `limit`: String (Default 100; Max 1000)
* `fromId`: String (Trade ID to fetch from)

**Headers:**

* `X-CH-SIGN`: String (Sign)
* `X-CH-TS`: String (Timestamp)
* `X-CH-APIKEY`: String (Your API-key)

**Response Example:**

```json
[
  {
    "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"
  }
]
```

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.fokawa.com/openapi-basic-information/margin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
