> For the complete documentation index, see [llms.txt](https://en.apis.alltick.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.apis.alltick.co/websocket-api/websocket-interface-api/ping-pong-1.md).

# K-line push (not supported)

English / [中文](https://apis.alltick.co/websocket-api/stock-websocket-interface-api/ping-pong-1)

## K-line Push Explanation

Alltick's WebSocket interface does not support K-line data push. Both historical and real-time K-lines can only be accessed through the HTTP interface. Recommended implementation methods are as follows:

**Implementation Suggestions (for reference):**

**1、Periodic K-line Retrieval:** To ensure quick updates, consider purchasing a high-frequency request plan.

**2、Combine HTTP Interfaces:** It is recommended to use both `/kline` and `/batch-kline` interfaces as follows:

* First, use the `/kline` interface to poll and store historical data in a local database. Subsequent historical data can be retrieved directly from the database without additional requests.
* Then, continuously use the `/batch-kline` interface to request the latest two K-lines for multiple products and update the database.

This method allows for quick updates of the latest K-lines while avoiding limitations from frequent historical requests.

### Price Change Calculation <a href="#interface-limitations" id="interface-limitations"></a>

**Alltick API does not provide price change or 24-hour price change fields.** Users can calculate price changes using Alltick data.

**1、Daily Price Change Calculation：**

**Method 1:** Use the HTTP API to get the daily K-line closing price for today and the previous day.

**Formula:** `Price Change (%) = (Today's Closing Price - Previous Day's Closing Price) / Previous Day's Closing Price * 100%`

**Method 2:** Use the WebSocket API to get the latest price and the HTTP API to fetch the previous day's closing price.

**Formula:** `Price Change (%) = (Latest Price - Previous Day's Closing Price) / Previous Day's Closing Price * 100%`

**2、24-Hour Price Change Calculation：**

Use the WebSocket trade price API (Request Protocol: 22004) to receive real-time tick data.

To calculate, store the latest price from 24 hours ago and use the following formula:

**Formula:** `24H Price Change (%) = (Latest Price - Price 24 Hours Ago) / Price 24 Hours Ago * 100%`

### Official Website

{% hint style="info" %}
Official website: <https://alltick.co/>
{% endhint %}


---

# 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 dynamically by asking a question.

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

```
GET https://en.apis.alltick.co/websocket-api/websocket-interface-api/ping-pong-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
