# Trade Book

This API endpoint Retrieves the complete trade book/ledger for a client's trading account. Provides a comprehensive record of all trades executed, including order details, product information, prices, quantities, timestamps, and other relevant trade data for auditing and regulatory compliance purposes.

**Endpoint**

{% code title="Base URL" overflow="wrap" fullWidth="false" %}

```
https://connects.torusdigital.com/api/v1/trade/book
```

{% endcode %}

#### Header Parameters <a href="#header-parameters" id="header-parameters"></a>

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

#### **Request Parameter**

<table><thead><tr><th width="122">Name</th><th width="94">Value</th><th width="55">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td>source</td><td>N</td><td>Y</td><td>Source of the request (e.g., "<br>N")</td></tr></tbody></table>

#### **Request**

{% tabs %}
{% tab title="curl" %}
{% code overflow="wrap" %}

```javascript
curl --location 'https://connects.torusdigital.com/api/v1/trade/book' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "source": "N"
}'
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code title="Java-Unirest" fullWidth="false" %}

```java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("connects.torusdigital.com/api/v1/trade/book")
  .header("Authorization", "Bearer {{token}}")
  .header("Content-Type", "application/json")
  .body("{\r\n  \"source\": \"N\"\r\n}")
  .asString();
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code title="cURL" overflow="wrap" fullWidth="true" %}

```go
package main
import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {
    url := "https://connects.torusdigital.com/api/v1/trade/book"
    method := "POST"

    payload := strings.NewReader(`{
    "source": "N"
    }`)

    client := &http.Client{}
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
        fmt.Println(err)
        return
    }

    req.Header.Add("Authorization", "Bearer {{token}}")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
        fmt.Println(err)
        return
    }

    defer res.Body.Close()

    body, err := ioutil.ReadAll(res.Body)
    if err != nil {
        fmt.Println(err)
        return
    }

    fmt.Println(string(body))
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code title="JavaScript-jQuery" overflow="wrap" lineNumbers="true" %}

```javascript
var settings = {
  "url": "https://connects.torusdigital.com/api/v1/trade/book",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "source": "N"
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response**

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

```json
{
    "data": [
     {
            "algo_id": "0",
            "client_id": "TOR001",
            "display_name": "VODAFONE IDEA LIMITED",
            "encash_flag": "N",
            "exch_order_no": "1400000000177679",
            "exch_order_time": "2024-05-28 10:50:52",
            "exch_trade_time": "2024-05-28 10:50:52",
            "exchange": "NSE",
            "exchange_inst_name": "Other",
            "expiry_date": "0001-01-01",
            "instrument": "EQUITY",
            "isin": "INE669E01016",
            "last_updated_time": "2024-05-28 10:50:52",
            "lot_size": 1,
            "mkt_pro_flag": "N",
            "mkt_pro_value": 0,
            "mkt_type": "NL",
            "opt_type": "XX",
            "order_date_time": "2024-05-28 10:50:51",
            "order_no": "1141240528106",
            "order_type": "MKT",
            "pan_no": "BBTPS7354E",
            "participant_type": "B",
            "placed_by": "CUSTOMER",
            "placed_by_entity_id": "TOR001",
            "product": "C",
            "product_name": "CNC",
            "quantity": 2,
            "row_no": 0,
            "security_id": "14366",
            "segment": "E",
            "series": "EQ",
            "settlor": "90245",
            "strike_price": 0,
            "symbol": "IDEA",
            "tick_size": 5,
            "trade_no": "80103634",
            "trade_value": 29.3,
            "traded_price": 14.65,
            "txn_type": "B"
        }
    ],
    "message": "Success",
    "status": "success"
}
```

{% endtab %}
{% endtabs %}

&#x20;   **Response Parameter**

| Parameter              | Description                                                                       |
| ---------------------- | --------------------------------------------------------------------------------- |
| order\_date\_time      | Order Entry Date Time - The date and time when the order was entered.             |
| exch\_order\_time      | Exchange Order Time - The time when the order was received by the exchange.       |
| exch\_trade\_time      | Exchange Trade Time - The time when the trade was executed on the exchange.       |
| last\_updated\_time    | Last Updated Time - The last time the order details were updated.                 |
| order\_no              | Order Number - Unique identifier for the order.                                   |
| exch\_order\_no        | Exchange Order Number - Unique identifier for the order assigned by the exchange. |
| exchange               | Exchange - The exchange where the order is placed (e.g., NSE, BSE).               |
| txn\_type              | Transaction Type - Type of transaction (e.g., Buy, Sell).                         |
| segment                | Segment - The segment of the market (e.g., Equity, Derivatives).                  |
| order\_type            | Order Type - Type of order (e.g., Limit, Market, Stop Loss).                      |
| symbol                 | Symbol - The trading symbol of the security.                                      |
| product                | Product - Type of product (e.g., Cash, Margin).                                   |
| product\_name          | Product Name - Name of the product.                                               |
| quantity               | Quantity - The number of shares or contracts.                                     |
| traded\_price          | Trade Price - The price at which the trade was executed.                          |
| trade\_value           | Trade Value - The total value of the trade.                                       |
| trade\_no              | Trade Number - Unique identifier for the trade.                                   |
| security\_id           | Security Id - Identifier for the security being traded.                           |
| row\_no                | Row Number/Index - The row number in the dataset.                                 |
| pan\_no                | PAN Number - Permanent Account Number of the client.                              |
| participant\_type      | Participant Type - Type of participant (e.g., Client, Dealer).                    |
| mkt\_pro\_flag         | Market Protection Flag - Indicator for market protection.                         |
| mkt\_pro\_value        | Market Protection Value - Value associated with market protection.                |
| settlor                | Settlor - The entity responsible for settlement.                                  |
| encash\_flag           | Encash Flag - Indicator if the encashment is allowed.                             |
| mkt\_type              | Market Type - Type of market (e.g., Normal, Odd Lot, Auction).                    |
| strike\_price          | Strike Price - The strike price for options.                                      |
| expiry\_date           | Expiry Date - The expiry date for derivatives.                                    |
| opt\_type              | Option Type - The type of option (e.g., Call, Put).                               |
| instrument             | Instrument Name - Name of the financial instrument.                               |
| lot\_size              | Lot Size - The lot size for the instrument.                                       |
| series                 | Series - Series of the security (e.g., EQ for equities).                          |
| isin                   | ISIN Code - International Securities Identification Number.                       |
| display\_name          | Custom Symbol Name - Custom name for the symbol.                                  |
| exchange\_inst\_name   | Instrument Name - Name of the instrument on the exchange.                         |
| placed\_by             | Placed By - The entity or person who placed the order.                            |
| tick\_size             | Tick Size - The minimum price movement for the security.                          |
| algo\_id               | Algo ID - Identifier for the algorithm used, if any.                              |
| placed\_by\_entity\_id | Placed By Entity Id - Identifier for the entity that placed the order.            |
