lhb-api-skill
功能
A股龙虎榜数据API,7天免费试用。
调用方式
- 服务地址:
http://fffy520.gicp.net:8003 - 自动注册7天试用,无需配置
API接口
1. 获取账户信息
GET /api/lhb/account
2. 获取当日龙虎榜
GET /api/lhb/daily?date=2026-05-08
3. 获取历史龙虎榜
GET /api/lhb/history?start_date=2026-05-01&end_date=2026-05-08
GET /api/lhb/history?code=000534
4. 获取营业部明细
GET /api/lhb/broker?date=2026-05-08&code=000534
5. 查询游资操作记录
GET /api/lhb/broker-trades?broker_name=中信证券
GET /api/lhb/broker-trades?broker_name=华鑫证券&start_date=2026-05-01
Header参数
| 参数 | 说明 |
|---|---|
| Authorization | 手动Key(可选) |
| X-Device-ID | 设备ID(自动生成) |
数据返回示例
{
"code": 200,
"data": [
{
"date": "2026-05-08",
"rank": 1,
"code": "000534",
"name": "万泽股份",
"close": 39.4,
"change": -7.98,
"amount": 59600,
"entry_type": "daily",
"net_buy": -21000,
"reason": "日跌幅偏离"
}
],
"remaining": 10
}
Python使用(直接复制此代码)
import os
import uuid
import requests
from pathlib import Path
BASE_URL = "http://fffy520.gicp.net:8003"
DEVICE_FILE = Path.home() / ".lhb_api_device_id"
def get_device_id():
"""获取或生成设备ID"""
if DEVICE_FILE.exists():
return DEVICE_FILE.read_text().strip()
device_id = f"dev_{uuid.uuid4().hex[:12]}"
DEVICE_FILE.write_text(device_id)
return device_id
class LHBClient:
"""龙虎榜API客户端"""
def __init__(self, api_key=None):
self.base_url = BASE_URL
self.device_id = get_device_id()
self.headers = {"X-Device-ID": self.device_id}
if api_key:
self.headers["Authorization"] = f"Bearer {api_key}"
# 便捷函数
def get_daily(date=None):
"""获取当日龙虎榜"""
client = LHBClient()
url = f"{client.base_url}/api/lhb/daily"
params = {"date": date} if date else {}
resp = requests.get(url, params=params, headers=client.headers)
return resp.json()
def get_history(start_date, end_date=None, code=None):
"""获取历史龙虎榜"""
client = LHBClient()
url = f"{client.base_url}/api/lhb/history"
params = {"start_date": start_date}
if end_date:
params["end_date"] = end_date
if code:
params["code"] = code
resp = requests.get(url, params=params, headers=client.headers)
return resp.json()
if __name__ == "__main__":
print(get_daily())
使用示例
from lhb_api import get_daily, get_history
# 获取今日龙虎榜
data = get_daily()
# 获取历史
data = get_history("2026-05-01", "2026-05-08")
# 查询个股
data = get_history(code="000534")
套餐
- 试用:7天 0元
- 月卡:30天 9.9元
- 季卡:90天 19.9元
- 年卡:365天 59.9元
- 长期:无限 99.9元
注意事项
- 首次调用自动注册7天试用
- 到期后需续费使用QQ165696237 微信18623023623