Gangtise Knowledge Base Skill
This skill provides access to Gangtise's knowledge base API for querying financial and market information.
First Time Setup
Before using this skill, you need to configure your API credentials:
CODEBLOCK0
You will be prompted to enter your Access Key and Secret Key, which can be obtained from: https://open.gangtise.com
Authentication
The API uses OAuth2-style authentication:
- 1. Use Access Key + Secret Access Key to get an access token via INLINECODE0
- V2 接口返回的 accessToken 已经携带了 Bearer 前缀,后续接口调用不需要再拼接
Auth Request
CODEBLOCK1
Auth Response
CODEBLOCK2
Base URL
Available Scripts
Configuration (First Time Setup)
CODEBLOCK3
Interactive setup for API credentials. Run this first before using any other scripts.
Get Access Token
CODEBLOCK4
Returns a valid access token for API calls.
Query Knowledge Base
CODEBLOCK5
API Endpoints
Authentication
- Body:
{ "accessKey": "...", "secretAccessKey": "..." }
- Returns:
{ "code": "000000", "data": { "accessToken": "..." } }
-
Note: V2接口返回的accessToken已经携带了Bearer前缀
Knowledge Base Query
- Header:
Authorization: Bearer {token}
- Content-Type: INLINECODE7
Request Parameters
| 参数名 | 必选 | 类型 | 说明 |
|---|
| queries | 是 | List<String> | 查询条件列表,最大支持5个查询条件 |
| top |
否 | Integer | 返回文档数量,默认10,最大支持20 |
| resourceTypes | 否 | List
| 知识库资源类型列表 |
| knowledgeNames | 否 | List | 知识库类型(默认只使用系统库) |
| startTime | 否 | Long | 数据查询开始时间(13位时间戳) |
| endTime | 否 | Long | 数据查询结束时间(13位时间戳) |
Resource Types
| 代码 | 类型 | 说明 |
|---|
| 10 | 券商研究报告 | 证券公司发布的研究报告 |
| 20 |
内部研究报告 | 机构内部研究报告 |
| 40 | 首席分析师观点 | 分析师观点文章 |
| 50 | 公司公告 | 上市公司公告 |
| 60 | 会议平台纪要 | 会议纪要 |
| 70 | 调研纪要公告 | 调研纪要 |
| 80 | 网络资源纪要 | 网络资源 |
| 90 | 产业公众号 | 产业相关公众号文章 |
Knowledge Names
- -
system_knowledge_doc - 系统库(默认) - INLINECODE9 - 租户库
Response Format
CODEBLOCK6
HTTP Status Codes
接口繁忙,请稍后再试 |
Usage Examples
Query single topic
CODEBLOCK7
Query with specific resource types
CODEBLOCK8
Query with time range (last 30 days)
CODEBLOCK9
Raw JSON output
CODEBLOCK10
Configuration File
Credentials are stored in config.json (created automatically by configure.py):
CODEBLOCK11
Note: The configuration file has restricted permissions (600) to protect your credentials.
Gangtise 知识库技能
该技能提供对Gangtise知识库API的访问,用于查询金融和市场信息。
首次设置
使用此技能前,您需要配置API凭证:
bash
python3 scripts/configure.py
系统将提示您输入Access Key和Secret Key,可从以下地址获取:https://open.gangtise.com
身份认证
API使用OAuth2风格的身份认证:
- 1. 使用Access Key + Secret Access Key通过loginV2获取访问令牌
- V2接口返回的accessToken已经携带了Bearer前缀,后续接口调用不需要再拼接
认证请求
json
{
accessKey: your-access-key,
secretAccessKey: your-secret-key
}
认证响应
json
{
code: 000000,
data: {
accessToken: Bearer xxxx-xxxx-xxxx-xxxx,
expiresIn: 3600,
uid: 123,
userName: your-name,
tenantId: 1,
time: 1704067200
}
}
基础URL
- - 基础URL:https://open.gangtise.com
可用脚本
配置(首次设置)
bash
python3 scripts/configure.py
API凭证的交互式设置。使用其他脚本前请先运行此脚本。
获取访问令牌
bash
python3 scripts/get_token.py
返回用于API调用的有效访问令牌。
查询知识库
bash
基本查询
python3 scripts/query_kb.py 比亚迪最新消息
带选项查询
python3 scripts/query_kb.py 特斯拉 --type 10,40 --top 5 --days 180
显式指定令牌
python3 scripts/query
kb.py 宁德时代 --token YOURTOKEN
API端点
身份认证
- - POST /application/auth/oauth/open/loginV2
- 请求体:{ accessKey: ..., secretAccessKey: ... }
- 返回:{ code: 000000, data: { accessToken: ... } }
-
注意:V2接口返回的accessToken已经携带了Bearer前缀
知识库查询
- - POST /application/open-data/ai/search/knowledge/batch
- 请求头:Authorization: Bearer {token}
- 内容类型:application/json
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|
| queries | 是 | List<String> | 查询条件列表,最大支持5个查询条件 |
| top |
否 | Integer | 返回文档数量,默认10,最大支持20 |
| resourceTypes | 否 | List
| 知识库资源类型列表 |
| knowledgeNames | 否 | List | 知识库类型(默认只使用系统库) |
| startTime | 否 | Long | 数据查询开始时间(13位时间戳) |
| endTime | 否 | Long | 数据查询结束时间(13位时间戳) |
资源类型
| 代码 | 类型 | 说明 |
|---|
| 10 | 券商研究报告 | 证券公司发布的研究报告 |
| 20 |
内部研究报告 | 机构内部研究报告 |
| 40 | 首席分析师观点 | 分析师观点文章 |
| 50 | 公司公告 | 上市公司公告 |
| 60 | 会议平台纪要 | 会议纪要 |
| 70 | 调研纪要公告 | 调研纪要 |
| 80 | 网络资源纪要 | 网络资源 |
| 90 | 产业公众号 | 产业相关公众号文章 |
知识库名称
- - systemknowledgedoc - 系统库(默认)
- tenantknowledgedoc - 租户库
响应格式
json
{
code: 000000,
msg: 操作成功,
status: true,
data: [
{
query: 查询问题,
data: [
{
content: 文本切片内容,
resourceType: 10,
title: 文件标题,
company: 公司,
industry: 行业,
time: 1746506803000,
sourceId: 溯源id,
knowledgeName: 知识库名称,
extraInfo: {
position: {
page: [1],
totalPages: 14,
polygon: []
}
}
}
]
}
]
}
HTTP状态码
接口繁忙,请稍后再试 |
使用示例
查询单个主题
bash
python3 scripts/query_kb.py 比亚迪 --top 3
按特定资源类型查询
bash
python3 scripts/query_kb.py 新能源 --type 10,50 --top 5
按时间范围查询(最近30天)
bash
python3 scripts/query_kb.py AI芯片 --days 30 --top 10
原始JSON输出
bash
python3 scripts/query_kb.py 宁德时代 --json
配置文件
凭证存储在config.json中(由configure.py自动创建):
json
{
ACCESS_KEY: your-access-key,
SECRET_KEY: your-secret-key,
BASE_URL: https://open.gangtise.com
}
注意:配置文件具有受限权限(600),以保护您的凭证。