# 获取财务报表
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_financials_statements(code, statement_type=None, financial_type=None, currency_code=None, next_key=None, num=None)
介绍
获取指定股票的财务报表(利润表/资产负债表/现金流量表/关键指标),支持分页拉取
参数
参数 类型 说明 code str 股票代码 statement_type FinancialStatementsType 财务报表类型 0=未知,1=利润表(Income),2=资产负债表(BalanceSheet),3=现金流量表(CashFlow),4=关键指标(MainIndex);默认 1=利润表financial_type F10Type 财报类型 0=不限,1=Q1,2=Q2,3=Q3,4=Q4,5=Q6累计(Q1+Q2),6=Q9累计(Q1+Q2+Q3),7=年报,9=单季报组合,10=单季报+年报,11=累计季报;默认 10=单季报+年报currency_code str 币种代码 ISO 4217,如 CNY、USD、HKD、SGD、JPY、CAD、AUD;不填返回原始货币数据next_key str 分页标识 首次不传,续拉填上次返回的 next_key;"-1" 表示无更多数据num int 每页返回数量 默认 10,范围 1~50返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回财务报表数据字典 str 当 ret != RET_OK,返回错误描述 返回字典包含以下字段:
字段 类型 说明 structure_list list 字段结构列表 report_list list 财报数据列表 next_key str 分页标识 "-1" 表示无更多数据structure_list 每项包含的字段:
字段 类型 说明 field_id int 财务字段 ID display_name str 字段展示名 如"营业收入";当前语言report_list 每项包含的字段:
字段 类型 说明 date_time int 财报截止日时间戳(秒) date_time_str str 财报截止日字符串 格式:YYYY-MM-DD;对应市场时区fiscal_year int 财务年度 如 2024financial_type F10Type 财报类型 0=未知,下次请求可原样传入period_text str 财报周期 如 "2024/Q3"、"2024/FY"item_list list 财务数据项列表 currency_info str 货币单位 展示型,如 "人民币"、"美元"accounting_standards str 会计准则 如 "国际会计准则"auditor_report str 审计意见 如 "无保留意见"currency_code str 币种代码 ISO 4217,如 "CNY"、"USD"item_list 每项包含的字段:
字段 类型 说明 field_id int 财务字段 ID data float 财务数据 yoy float 同比 百分号前的值,如 13.86 表示 13.86%;无同比数据时不含此字段qoq float 环比 百分号前的值,如 1.23 表示 1.23%;无环比数据时不含此字段display_name str 字段展示名 与 structure_list 中对应条目的 display_name 一致
Example
import pandas as pd
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_financials_statements("HK.00700")
if ret == RET_OK:
df = pd.DataFrame(data['report_list'][0]['item_list'])
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
field_id display_name data yoy
0 5001 营业总收入 7.517660e+11 13.859603
1 5002 营业额 7.517660e+11 13.859603
2 5005 营业总成本 -3.291730e+11 -5.839665
3 5008 销售成本 -3.291730e+11 -5.839665
4 5010 毛利 4.225930e+11 21.001529
5 5013 营业费用 -1.778540e+11 -19.245855
6 5015 销售费用 -4.172700e+10 -14.672419
7 5016 行政费用 -1.361270e+11 -20.721703
8 5032 经营利润特殊项目 -3.177000e+09 -139.702574
9 5034 营业利润 2.415620e+11 16.080327
10 5035 融资收入 1.690900e+10 5.654836
11 5036 融资成本 -1.513000e+10 -26.283282
12 5037 应占联营公司利润 2.374000e+10 -5.703845
13 5040 税前利润 2.772490e+11 14.810030
14 5041 利润特殊项目 1.016800e+10 142.846907
15 5043 所得税 -4.744800e+10 -5.397841
16 5045 净利润 2.298010e+11 16.966717
17 5046 持续经营利润 2.298010e+11 16.966717
18 5050 少数股东损益 4.959000e+09 107.142857
19 5051 归属母公司净利润 2.248420e+11 15.854343
20 5052 归属普通股股东净利润 2.248420e+11 15.854343
21 5054 基本每股收益 2.474900e+01 18.201356
22 5055 稀释每股收益 2.415300e+01 17.900029
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Qot_GetFinancialsStatements.proto
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型(详见 Qot_Common.FinancialStatementsType 定义),默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,详见 Qot_Common.F10Type 定义,支持 0-7, 9-11,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217),如 CNY、USD、HKD、SGD、JPY、CAD、AUD;不填返回原始货币数据
optional string nextKey = 5; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
协议 ID
3227
uint GetFinancialsStatements(QotGetFinancialsStatements.Request req);
virtual void OnReply_GetFinancialsStatements(FTAPI_Conn client, uint nSerialNo, QotGetFinancialsStatements.Response rsp);
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
public class Program : FTSPI_Qot, FTSPI_Conn
{
FTAPI_Qot qot = new FTAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(FTAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("00700")
.Build();
QotGetFinancialsStatements.C2S c2s = QotGetFinancialsStatements.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetFinancialsStatements.Request req = QotGetFinancialsStatements.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetFinancialsStatements(req);
Console.Write("Send QotGetFinancialsStatements: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetFinancialsStatements(FTAPI_Conn client, uint nSerialNo, QotGetFinancialsStatements.Response rsp)
{
Console.Write("Reply: QotGetFinancialsStatements: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
Program qot = new Program();
qot.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "营业总收入"
}
structureList {
//...
}
reportList {
dateTime: 1767110400
dateTimeStr: "2025-12-31"
fiscalYear: 2025
financialType: F10Type_Annual
periodText: "2025/FY"
itemList {
fieldId: 5001
data: 751766000000
yoy: 13.859603154529221
}
itemList {
//...
}
currencyInfo: "人民币"
accountingStandards: "国际会计准则"
auditorReport: "无保留意见"
currencyCode: "CNY"
}
reportList {
//...
}
nextKey: "1711814401,2024_1"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
int getFinancialsStatements(QotGetFinancialsStatements.Request req);
void onReply_GetFinancialsStatements(FTAPI_Conn client, int nSerialNo, QotGetFinancialsStatements.Response rsp);
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
public class QotDemo implements FTSPI_Qot, FTSPI_Conn {
FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("00700")
.build();
QotGetFinancialsStatements.C2S c2s = QotGetFinancialsStatements.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetFinancialsStatements.Request req = QotGetFinancialsStatements.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getFinancialsStatements(req);
System.out.printf("Send QotGetFinancialsStatements: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetFinancialsStatements(FTAPI_Conn client, int nSerialNo, QotGetFinancialsStatements.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetFinancialsStatements failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetFinancialsStatements: %s\n", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
FTAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
- Output
Qot onInitConnect: ret=0 desc= connID=7459213508733962245
Send Qot_GetFinancialsStatements: 2
Receive Qot_GetFinancialsStatements: retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "营业总收入"
}
structureList {
//...
}
reportList {
dateTime: 1767110400
dateTimeStr: "2025-12-31"
fiscalYear: 2025
financialType: F10Type_Annual
periodText: "2025/FY"
itemList {
fieldId: 5001
data: 7.51766E11
yoy: 13.859603154529221
}
itemList {
//...
}
currencyInfo: "人民币"
accountingStandards: "国际会计准则"
auditorReport: "无保留意见"
currencyCode: "CNY"
}
reportList {
//...
}
nextKey: "1711814401,2024_1"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Futu::u32_t GetFinancialsStatements(const Qot_GetFinancialsStatements::Request &stReq);
virtual void OnReply_GetFinancialsStatements(Futu::u32_t nSerialNo, const Qot_GetFinancialsStatements::Response &stRsp) = 0;
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
class Program : public FTSPI_Qot, public FTSPI_Trd, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetFinancialsStatements::Request req;
Qot_GetFinancialsStatements::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("00700");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetFinancialsStatements(req);
cout << "GetFinancialsStatements" << endl;
}
virtual void OnReply_GetFinancialsStatements(Futu::u32_t nSerialNo, const Qot_GetFinancialsStatements::Response &stRsp){
cout << "OnReply_GetFinancialsStatements:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
FTAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
FTAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetFinancialsStatements seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "营业总收入"
}
structureList {
//...
}
reportList {
dateTime: 1767110400
dateTimeStr: "2025-12-31"
fiscalYear: 2025
financialType: F10Type_Annual
periodText: "2025/FY"
itemList {
fieldId: 5001
data: 751766000000
yoy: 13.859603154529221
}
itemList {
//...
}
currencyInfo: "人民币"
accountingStandards: "国际会计准则"
auditorReport: "无保留意见"
currencyCode: "CNY"
}
reportList {
//...
}
nextKey: "1711814401,2024_1"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
GetFinancialsStatements(req);
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetFinancialsStatements(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_HK_Security,
code: "00700",
},
},
};
websocket.GetFinancialsStatements(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetFinancialsStatements: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(data);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- Output
GetFinancialsStatements: errCode 0, retMsg , retType 0
{
"structureList": [{
"fieldId": "5001",
"displayName": "营业总收入"
//...
}],
"reportList": [{
"dateTime": "1767110400",
"dateTimeStr": "2025-12-31",
"fiscalYear": 2025,
"financialType": "F10Type_Annual",
"periodText": "2025/FY",
"itemList": [{
"fieldId": "5001",
"data": 751766000000,
"yoy": 13.859603154529221
//...
}],
"currencyInfo": "人民币",
"accountingStandards": "国际会计准则",
"auditorReport": "无保留意见",
"currencyCode": "CNY"
//...
}],
"nextKey": "1711814401,2024_1"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
接口限制
- 每 30 秒内最多请求 30 次。
- 支持正股及基金。
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_financials_statements(code, statement_type=None, financial_type=None, currency_code=None, next_key=None, num=None)
介绍
获取指定股票的财务报表(利润表/资产负债表/现金流量表/关键指标),支持分页拉取
参数
参数 类型 说明 code str 股票代码 statement_type FinancialStatementsType 财务报表类型 0=未知,1=利润表(Income),2=资产负债表(BalanceSheet),3=现金流量表(CashFlow),4=关键指标(MainIndex);默认 1=利润表financial_type F10Type 财报类型 0=不限,1=Q1,2=Q2,3=Q3,4=Q4,5=Q6累计(Q1+Q2),6=Q9累计(Q1+Q2+Q3),7=年报,9=单季报组合,10=单季报+年报,11=累计季报;默认 10=单季报+年报currency_code str 币种代码 ISO 4217,如 CNY、USD、HKD、SGD、JPY、CAD、AUD;不填返回原始货币数据next_key str 分页标识 首次不传,续拉填上次返回的 next_key;"-1" 表示无更多数据num int 每页返回数量 默认 10,范围 1~50返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回财务报表数据字典 str 当 ret != RET_OK,返回错误描述 返回字典包含以下字段:
字段 类型 说明 structure_list list 字段结构列表 report_list list 财报数据列表 next_key str 分页标识 "-1" 表示无更多数据structure_list 每项包含的字段:
字段 类型 说明 field_id int 财务字段 ID display_name str 字段展示名 如"营业收入";当前语言report_list 每项包含的字段:
字段 类型 说明 date_time int 财报截止日时间戳(秒) date_time_str str 财报截止日字符串 格式:YYYY-MM-DD;对应市场时区fiscal_year int 财务年度 如 2024financial_type F10Type 财报类型 0=未知,下次请求可原样传入period_text str 财报周期 如 "2024/Q3"、"2024/FY"item_list list 财务数据项列表 currency_info str 货币单位 展示型,如 "人民币"、"美元"accounting_standards str 会计准则 如 "国际会计准则"auditor_report str 审计意见 如 "无保留意见"currency_code str 币种代码 ISO 4217,如 "CNY"、"USD"item_list 每项包含的字段:
字段 类型 说明 field_id int 财务字段 ID data float 财务数据 yoy float 同比 百分号前的值,如 13.86 表示 13.86%;无同比数据时不含此字段qoq float 环比 百分号前的值,如 1.23 表示 1.23%;无环比数据时不含此字段display_name str 字段展示名 与 structure_list 中对应条目的 display_name 一致
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_financials_statements("HK.00700")
if ret == RET_OK:
print(data['report_list'][0]['period_text'])
print(data['next_key'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
- Output
field_id display_name data yoy
0 5001 营业总收入 7.517660e+11 13.859603
1 5002 营业额 7.517660e+11 13.859603
2 5005 营业总成本 -3.291730e+11 -5.839665
3 5008 销售成本 -3.291730e+11 -5.839665
4 5010 毛利 4.225930e+11 21.001529
5 5013 营业费用 -1.778540e+11 -19.245855
6 5015 销售费用 -4.172700e+10 -14.672419
7 5016 行政费用 -1.361270e+11 -20.721703
8 5032 经营利润特殊项目 -3.177000e+09 -139.702574
9 5034 营业利润 2.415620e+11 16.080327
10 5035 融资收入 1.690900e+10 5.654836
11 5036 融资成本 -1.513000e+10 -26.283282
12 5037 应占联营公司利润 2.374000e+10 -5.703845
13 5040 税前利润 2.772490e+11 14.810030
14 5041 利润特殊项目 1.016800e+10 142.846907
15 5043 所得税 -4.744800e+10 -5.397841
16 5045 净利润 2.298010e+11 16.966717
17 5046 持续经营利润 2.298010e+11 16.966717
18 5050 少数股东损益 4.959000e+09 107.142857
19 5051 归属母公司净利润 2.248420e+11 15.854343
20 5052 归属普通股股东净利润 2.248420e+11 15.854343
21 5054 基本每股收益 2.474900e+01 18.201356
22 5055 稀释每股收益 2.415300e+01 17.900029
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Qot_GetFinancialsStatements.proto
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型(详见 Qot_Common.FinancialStatementsType 定义),默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,详见 Qot_Common.F10Type 定义,支持 0-7, 9-11,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217),如 CNY、USD、HKD、SGD、JPY、CAD、AUD;不填返回原始货币数据
optional string nextKey = 5; // 分页标识,首次不填,续拉时填上次返回的 nextKey;"-1" 表示无更多数据
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
协议 ID
3227
uint GetFinancialsStatements(QotGetFinancialsStatements.Request req);
virtual void OnReply_GetFinancialsStatements(MMAPI_Conn client, uint nSerialNo, QotGetFinancialsStatements.Response rsp);
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
public class Program : MMSPI_Qot, MMSPI_Conn
{
MMAPI_Qot qot = new MMAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(MMAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("00700")
.Build();
QotGetFinancialsStatements.C2S c2s = QotGetFinancialsStatements.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetFinancialsStatements.Request req = QotGetFinancialsStatements.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetFinancialsStatements(req);
Console.Write("Send QotGetFinancialsStatements: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetFinancialsStatements(MMAPI_Conn client, uint nSerialNo, QotGetFinancialsStatements.Response rsp)
{
Console.Write("Reply: QotGetFinancialsStatements: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
Program qot = new Program();
qot.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "营业总收入"
}
structureList {
//...
}
reportList {
dateTime: 1767110400
dateTimeStr: "2025-12-31"
fiscalYear: 2025
financialType: F10Type_Annual
periodText: "2025/FY"
itemList {
fieldId: 5001
data: 751766000000
yoy: 13.859603154529221
}
itemList {
//...
}
currencyInfo: "人民币"
accountingStandards: "国际会计准则"
auditorReport: "无保留意见"
currencyCode: "CNY"
}
reportList {
//...
}
nextKey: "1711814401,2024_1"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
int getFinancialsStatements(QotGetFinancialsStatements.Request req);
void onReply_GetFinancialsStatements(MMAPI_Conn client, int nSerialNo, QotGetFinancialsStatements.Response rsp);
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
public class QotDemo implements MMSPI_Qot, MMSPI_Conn {
MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("00700")
.build();
QotGetFinancialsStatements.C2S c2s = QotGetFinancialsStatements.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetFinancialsStatements.Request req = QotGetFinancialsStatements.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getFinancialsStatements(req);
System.out.printf("Send QotGetFinancialsStatements: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetFinancialsStatements(MMAPI_Conn client, int nSerialNo, QotGetFinancialsStatements.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetFinancialsStatements failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetFinancialsStatements: %s\n", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
MMAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
- Output
Qot onInitConnect: ret=0 desc= connID=7459213508733962245
Send Qot_GetFinancialsStatements: 2
Receive Qot_GetFinancialsStatements: retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "营业总收入"
}
structureList {
//...
}
reportList {
dateTime: 1767110400
dateTimeStr: "2025-12-31"
fiscalYear: 2025
financialType: F10Type_Annual
periodText: "2025/FY"
itemList {
fieldId: 5001
data: 7.51766E11
yoy: 13.859603154529221
}
itemList {
//...
}
currencyInfo: "人民币"
accountingStandards: "国际会计准则"
auditorReport: "无保留意见"
currencyCode: "CNY"
}
reportList {
//...
}
nextKey: "1711814401,2024_1"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
moomoo::u32_t GetFinancialsStatements(const Qot_GetFinancialsStatements::Request &stReq);
virtual void OnReply_GetFinancialsStatements(moomoo::u32_t nSerialNo, const Qot_GetFinancialsStatements::Response &stRsp) = 0;
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- Example
class Program : public MMSPI_Qot, public MMSPI_Trd, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, moomoo::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetFinancialsStatements::Request req;
Qot_GetFinancialsStatements::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("00700");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetFinancialsStatements(req);
cout << "GetFinancialsStatements" << endl;
}
virtual void OnReply_GetFinancialsStatements(moomoo::u32_t nSerialNo, const Qot_GetFinancialsStatements::Response &stRsp){
cout << "OnReply_GetFinancialsStatements:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
MMAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
MMAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetFinancialsStatements seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "营业总收入"
}
structureList {
//...
}
reportList {
dateTime: 1767110400
dateTimeStr: "2025-12-31"
fiscalYear: 2025
financialType: F10Type_Annual
periodText: "2025/FY"
itemList {
fieldId: 5001
data: 751766000000
yoy: 13.859603154529221
}
itemList {
//...
}
currencyInfo: "人民币"
accountingStandards: "国际会计准则"
auditorReport: "无保留意见"
currencyCode: "CNY"
}
reportList {
//...
}
nextKey: "1711814401,2024_1"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
GetFinancialsStatements(req);
介绍
获取财务报表
参数
message C2S
{
required Qot_Common.Security security = 1; // 股票
optional Qot_Common.FinancialStatementsType statementType = 2; // 财务报表类型,默认利润表(Income=1)
optional Qot_Common.F10Type financialType = 3; // 财报类型,默认 10(QuarterlyAnnual)
optional string currencyCode = 4; // 币种代码(ISO 4217)
optional string nextKey = 5; // 分页标识
optional int32 num = 6; // 每页返回数量,默认 10,范围 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 股票结构参见 Security
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- 返回
// 财报字段结构信息
message FinancialFieldInfo
{
optional int64 fieldId = 1; // 财务字段 ID
optional string displayName = 2; // 字段展示名(当前语言,如"营业收入")
}
// 单条财务数据项
message FinancialItem
{
optional int64 fieldId = 1; // 财务字段 ID,与 structureList 中 fieldId 对应
optional double data = 2; // 财务数据
optional double yoy = 3; // 同比(%)
optional double qoq = 4; // 环比(%)
}
// 财务报表
message FinancialReport
{
optional int64 dateTime = 1; // 财报截止日时间戳(秒)
optional string dateTimeStr = 2; // 财报截止日时间字符串,格式 YYYY-MM-DD,对应市场时区
optional int32 fiscalYear = 3; // 财务年度,如 2024;0 表示无数据
optional Qot_Common.F10Type financialType = 4; // 财报类型,详见 Qot_Common.F10Type 定义;0 表示未知,下次请求可原样传入
optional string periodText = 5; // 财报周期,如 "2024/Q3"、"2024/FY"
repeated FinancialItem itemList = 6; // 财务数据项列表
optional string currencyInfo = 7; // 货币单位(展示型),如 "人民币"、"美元"
optional string accountingStandards = 8; // 会计准则,如 "国际会计准则"
optional string auditorReport = 9; // 审计意见,如 "无保留意见"
optional string currencyCode = 10; // 币种代码(ISO 4217),如 "CNY"、"USD"
}
message S2C
{
repeated FinancialFieldInfo structureList = 1; // 字段结构列表,仅收集返回数据中有的字段
repeated FinancialReport reportList = 2; // 财报数据列表,按时间顺序
optional string nextKey = 3; // 分页标识,"-1" 表示无更多数据
}
message Response
{
required int32 retType = 1 [default = -400]; // RetType,返回结果
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
- 接口调用结果,结构参见 RetType
- 财报类型参见 F10Type
- 财务报表类型参见 FinancialStatementsType
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetFinancialsStatements(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_HK_Security,
code: "00700",
},
},
};
websocket.GetFinancialsStatements(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetFinancialsStatements: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(data);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- Output
GetFinancialsStatements: errCode 0, retMsg , retType 0
{
"structureList": [{
"fieldId": "5001",
"displayName": "营业总收入"
//...
}],
"reportList": [{
"dateTime": "1767110400",
"dateTimeStr": "2025-12-31",
"fiscalYear": 2025,
"financialType": "F10Type_Annual",
"periodText": "2025/FY",
"itemList": [{
"fieldId": "5001",
"data": 751766000000,
"yoy": 13.859603154529221
//...
}],
"currencyInfo": "人民币",
"accountingStandards": "国际会计准则",
"auditorReport": "无保留意见",
"currencyCode": "CNY"
//...
}],
"nextKey": "1711814401,2024_1"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
接口限制
- 每 30 秒内最多请求 30 次。
- 支持正股及基金。
← 获取财报日前后股价历史 获取主营构成 →