> For the complete documentation index, see [llms.txt](https://support.tiger.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.tiger.com/english/development-for-tiger.trade-windows/tiger-api.md).

# Tiger API

## 🯩 What is Tiger API

Tiger API is a **local WebSocket server** embedded in the **Tiger.com Windows** terminal that allows **external systems (e.g., screeners)** to control the interface of the terminal.

### 🔗 Main Purpose

The `setLinkSymbol` command instantly **opens the specified symbol** (e.g., `BTCUSDT`) in the specified **link group** (e.g., `A`) inside the terminal.

## ⚙️ How to Enable Tiger API in the Terminal

1. Go to: `Settings → Local Signal Server`
2. Enable the option: `Enable Signal Server`
3. Press `Save`
4. Default WebSocket port: `7819`

## 📡 WebSocket Request Format

```
{
  "type": "setLinkSymbol",
  "e": "BINANCE",         // Exchange
  "m": "SPOT",            // Market type: SPOT or FUTURES
  "symbol": "BTCUSDT",    // Trading pair
  "linkGroup": "A"        // Link group: A–11
}
```

* All fields are **required**
* Case-insensitive
* Response normalizes values (e.g., `Spot`, `Futures`)

## ✅ Example of a Successful Response

```
{
  "title": "Successful request",
  "message": "Symbol linked successfully.",
  "request": {
    "e": "BINANCE",
    "m": "Spot",
    "symbol": "BTCUSDT",
    "linkGroup": "A",
    "type": "SetLinkSymbol"
  },
  "response": {
    "type": "successfully",
    "timestamp": "..."
  }
}
```

## ❌ Error Examples

### 1. Invalid Command Type

```
{
  "type": "InvalidType"
}
```

Result: error + connection is closed (`code: 400`, WebSocket `1007`)

### 2. Invalid JSON Format

```
{
  "type": "setLinkSymbol", e: "BINANCE"... // broken syntax
}
```

Result: error + `connection_close`

### 3. Validation Errors (do not close WS connection)

* Empty fields
* Unknown `symbol`
* Invalid `linkGroup` (e.g., `AX`)

## 🟢 Ping/Pong Support

### 1. Text-based:

```
ping → pong
```

### 2. JSON-based:

```
{
  "type": "ping", 
  "title": "...", 
  "message": "..."
}
→
{
  "title": "Pong", 
  "message": "Response 'pong' to 'ping'."
}
```

## 📘 Reference Tables

### Exchanges (`e`):

* BINANCE, BINANCE-FUT, BYBIT, OKX, MEXC, Bitfinex, Gate.io, Bitget, TigerX

### Market Types (`m`):

* SPOT, FUTURES

### Link Groups (`linkGroup`):

* Letters `A–Z` (e.g., A = `#FFF9C4`)
* Digits `0–11` (e.g., 0 = `#FFAA00`)

## 📌 Error Handling Table

| Error Type        | Code | Action           |
| ----------------- | ---- | ---------------- |
| Invalid JSON      | 400  | WS closed (1007) |
| Validation errors | 400  | WS remains open  |

## 📌 Request examples

```
socket.send('{"type": "setLinkSymbol", "e": "TigerX Binance", "m": "SPOT", "symbol": "BTCUSDT", "linkGroup": "A"}');
//socket.send('{"type": "setLinkSymbol", "e": "TigerX OKX", "m": "FUTURES", "symbol": "BTCUSDT", "linkGroup": "A"}');
//socket.send('{"type": "setLinkSymbol", "e": "Bitget", "m": "FUTURES", "symbol": "PARTIUSDT", "linkGroup": "A"}');
//socket.send('{"type": "setLinkSymbol", "e": "MOEX", "m": "FUTURES", "symbol": "CR", "linkGroup": "A"}');
//socket.send('{"type": "setLinkSymbol", "e": "MOEX", "m": "FUTURES", "symbol": "CRZ5", "linkGroup": "A"}');
```

## 📌 Recommendations for Clients

* **Always validate JSON locally before sending**
* **On parsing errors → reconnect using exponential backoff**
* **Send regular `ping` messages to keep the connection alive**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.tiger.com/english/development-for-tiger.trade-windows/tiger-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
