K-Line Push Description
AllTick WebSocket interfaces do not support K-line data push. Because many customers have questions about this, this document explains that both historical K-lines and real-time K-lines are currently supported only through direct HTTP interface retrieval. The recommended implementation is as follows: Implementation suggestions (for reference only): 1. Periodically pull K-lines: To quickly update K-lines, it is recommended to purchase a plan with a higher request frequency to increase the pull frequency. 2. Use HTTP interfaces together: We recommend using/kline and /batch-kline together as follows:
- First, use the
/klineinterface to poll historical data and store it in a local database. Later historical data can be obtained directly from the customer’s database without requesting the interface again. - Then, continuously use the
/batch-klineinterface to batch request the latest two K-lines for multiple products and update the database with the data.
Price Change Description
AllTick interfaces do not provide a price change or 24-hour price change field. Customers can calculate price changes themselves by obtaining AllTick data. 1. Daily price change calculation methods:- Method 1: Use the HTTP interface to obtain today’s daily K-line closing price and the previous day’s daily K-line closing price. The formula is:
- Method 2: Use the WebSocket interface to obtain the latest price, and use the HTTP interface to obtain today’s daily K-line closing price. The formula is:
- Use the WebSocket latest trade price interface (request protocol number: 22004) to receive tick-by-tick trade prices in real time.
- You need to store the latest price from 24 hours ago pushed by the WebSocket interface for subsequent calculation.
- Formula:
AllTick Website
Official website: https://alltick.co/