# 获取主窗口信息get_mainwnd_info
# 返回通达信客户端主窗口当前显示的证券与视图信息,含当前代码、名称、视图类型、主窗口与活动视图矩形
get_mainwnd_info() -> Dict
1
# 返回数据
| 数据字段 | 默认返回 | 数据类型 | 数据说明 |
|---|---|---|---|
| ViewStr | Y | str | 当前主窗口视图类型标识 |
| Title | Y | str | 视图标题,无标题时为空串 |
| Code | Y | str | 主窗口当前证券代码,如 000001.SZ |
| Name | Y | str | 主窗口当前证券名称,如 平安银行 |
| GPType | Y | int | 证券类型标识 |
| BlockType | Y | int | 板块类型标识 |
| MainPad | Y | int | 主窗口标识 |
| Url | Y | str | 关联链接地址,无链接时为空串 |
| MainFrameRect | Y | List[int] | 主窗口矩形,[左, 上, 右, 下],单位为像素 |
| ActiveViewRect | Y | List[int] | 当前活动视图矩形,[左, 上, 右, 下],单位为像素 |
# 接口使用
读取客户端主窗口当前显示的证券与视图信息。
from tqcenter import tq
tq.initialize(__file__)
info = tq.get_mainwnd_info()
print(info)
1
2
3
4
2
3
4
# 数据样本
{
"ViewStr": "Com",
"Title": "",
"Code": "000001.SZ",
"Name": "平安银行",
"GPType": 0,
"BlockType": 0,
"MainPad": 131072,
"Url": "",
"MainFrameRect": [0, 0, 0, 0],
"ActiveViewRect": [-32007, -31984, -30082, -30941]
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12