头图

功能:实时查询股票价格,逐笔更新的高频数据(非普通延迟行情数据)

支持查询:A股、港股、美股、外汇、商品、加密货币

适用于量化交易、交易所、自营交易、新闻咨询等场景。

官网:AllTick.co
备用地址:AllTick.io

注册地址:https://alltick.co/register

API文档:官方文档Github

通过API获取股价 - 请求示例:

import time
 
import requests    # pip3 install requests
import json
 
# Extra headers
test_headers = {
    'Content-Type' : 'application/json'
}
 
'''
github:https://github.com/alltick/realtime-forex-crypto-stock-tick-finance-websocket-api
申请免费token:https://alltick.co/register
官网:https://alltick.co
 
code    请查看code列表,选择你要查询的code
kline_type k线类型,1分钟K,2为5分钟K,3为15分钟K,4为30分钟K,5为小时K,6为2小时K,7为4小时K,8为日K,9为周K,10为月K
query_kline_num    查询多少根K线,最多1000根
 
将如下JSON进行url的encode,复制到http的查询字符串的query字段里
{"trace" : "python_http_test1","data" : {"code" : "USDJPY","kline_type" : 1,"kline_timestamp_end" : 0,"query_kline_num" : 2,"adjust_type": 0}}
{"trace" : "python_http_test2","data" : {"symbol_list": [{"code": "GOLD"}]}}
{"trace" : "python_http_test3","data" : {"symbol_list": [{"code": "GOLD"}]}}
'''
test_url1 = 'https://quote.aatest.online/quote-b-api/kline?token=3662a972-1a5d-4bb1-88b4-66ca0c402a03-1688712831841&query=%7B%22trace%22%20%3A%20%22python_http_test1%22%2C%22data%22%20%3A%20%7B%22code%22%20%3A%20%22USDJPY%22%2C%22kline_type%22%20%3A%201%2C%22kline_timestamp_end%22%20%3A%200%2C%22query_kline_num%22%20%3A%202%2C%22adjust_type%22%3A%200%7D%7D'
 
resp1 = requests.get(url=test_url1, headers=test_headers)
 
# Decoded text returned by the request
text1 = resp1.text
print(text1)

返回结果:

{
    "ret":200,
    "msg":"ok",
    "cmd_id":14015,
    "seq_id":123,
    "ext":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
    "data":{
        "data_list":[
            {
        "symbol_id": 1123,
                "trade_type": 1,
                "trade_mode": 0,
                "kline_type": 1,
                "price_digits": 2,
                "kline_list":[
                    {
                        "timestamp": 1605509068,
                        "open_price": "651.12",
                        "close_price": "623.12",
                        "high_price": "674.12",
                        "low_price": "619.12",
                        "last_tick_time": 1605509068000001,
                        "last_tick_seq": 1605509068000001,
                        "transactions_number": "12345.6",
                    },
                ]
            },
        ],
    }    
}

TickTank
2 声望1 粉丝

高频tick数据行情接口