# 財務報告書を取得
- 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)financial_type F10Type 財報種別 0=全て、1=Q1、2=Q2、3=Q3、4=Q4、5=上半期(Q1+Q2)、6=9ヶ月(Q1+Q2+Q3)、7=通年、9=単四半期組合せ、10=単四半期+通年(デフォルト)、11=累計四半期currency_code str 通貨コード ISO 4217、例: CNY、USD、HKD、SGD、JPY、CAD、AUD;未入力の場合は原通貨データを返しますnext_key str ページングキー 初回は不要、続きのページは前回返却の next_key を指定;"-1" はデータなしnum int 1ページあたりの件数 デフォルト 10、範囲 1~50戻り値
パラメータ 型 説明 ret RET_CODE API呼び出し結果 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 Total Revenue 7.517660e+11 13.859603
1 5002 Operating Revenue 7.517660e+11 13.859603
2 5005 Cost of Revenue -3.291730e+11 -5.839665
3 5008 Cost of Goods Sold -3.291730e+11 -5.839665
4 5010 Gross Profit 4.225930e+11 21.001529
5 5013 Operating Expense -1.778540e+11 -19.245855
6 5015 Selling Expenses -4.172700e+10 -14.672419
7 5016 Administrative Expenses -1.361270e+11 -20.721703
8 5032 Special Items of Operating Income -3.177000e+09 -139.702574
9 5034 Operating Profit 2.415620e+11 16.080327
10 5035 Financing Income 1.690900e+10 5.654836
11 5036 Financing Cost -1.513000e+10 -26.283282
12 5037 Share of Profits of Associates 2.374000e+10 -5.703845
13 5040 Pretax Profit 2.772490e+11 14.810030
14 5041 Special Items of Pretax Income 1.016800e+10 142.846907
15 5043 Tax -4.744800e+10 -5.397841
16 5045 Net Profit 2.298010e+11 16.966717
17 5046 Profit from Continuing Operations 2.298010e+11 16.966717
18 5050 Minority Interests 4.959000e+09 107.142857
19 5051 Net Income to Parent Company 2.248420e+11 15.854343
20 5052 Net Income to Common Stockholders 2.248420e+11 15.854343
21 5054 Basic EPS 2.474900e+01 18.201356
22 5055 Diluted EPS 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; // 1ページあたりの件数、デフォルト 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
- API結果については 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; // 1ページあたりの件数、デフォルト 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
- API結果については 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: "Total Revenue"
}
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: "CNY"
accountingStandards: "IAS"
auditorReport: "Unqualified opinion"
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; // 1ページあたりの件数、デフォルト 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
- API結果については 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=7459212560278706625
Send Qot_GetFinancialsStatements: 2
Receive Qot_GetFinancialsStatements: retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "Total Revenue"
}
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: "CNY"
accountingStandards: "IAS"
auditorReport: "Unqualified opinion"
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; // 1ページあたりの件数、デフォルト 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
- API結果については 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: "Total Revenue"
}
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: "CNY"
accountingStandards: "IAS"
auditorReport: "Unqualified opinion"
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; // 1ページあたりの件数、デフォルト 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
- API結果については 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": "Total Revenue"
//...
}],
"reportList": [{
"dateTime": "1767110400",
"dateTimeStr": "2025-12-31",
"fiscalYear": 2025,
"financialType": "F10Type_Annual",
"periodText": "2025/FY",
"itemList": [{
"fieldId": "5001",
"data": 751766000000,
"yoy": 13.859603154529221
//...
}],
"currencyInfo": "CNY",
"accountingStandards": "IAS",
"auditorReport": "Unqualified opinion",
"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)financial_type F10Type 財報種別 0=全て、1=Q1、2=Q2、3=Q3、4=Q4、5=上半期(Q1+Q2)、6=9ヶ月(Q1+Q2+Q3)、7=通年、9=単四半期組合せ、10=単四半期+通年(デフォルト)、11=累計四半期currency_code str 通貨コード ISO 4217、例: CNY、USD、HKD、SGD、JPY、CAD、AUD;未入力の場合は原通貨データを返しますnext_key str ページングキー 初回は不要、続きのページは前回返却の next_key を指定;"-1" はデータなしnum int 1ページあたりの件数 デフォルト 10、範囲 1~50戻り値
パラメータ 型 説明 ret RET_CODE API呼び出し結果 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 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:
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 Total Revenue 7.517660e+11 13.859603
1 5002 Operating Revenue 7.517660e+11 13.859603
2 5005 Cost of Revenue -3.291730e+11 -5.839665
3 5008 Cost of Goods Sold -3.291730e+11 -5.839665
4 5010 Gross Profit 4.225930e+11 21.001529
5 5013 Operating Expense -1.778540e+11 -19.245855
6 5015 Selling Expenses -4.172700e+10 -14.672419
7 5016 Administrative Expenses -1.361270e+11 -20.721703
8 5032 Special Items of Operating Income -3.177000e+09 -139.702574
9 5034 Operating Profit 2.415620e+11 16.080327
10 5035 Financing Income 1.690900e+10 5.654836
11 5036 Financing Cost -1.513000e+10 -26.283282
12 5037 Share of Profits of Associates 2.374000e+10 -5.703845
13 5040 Pretax Profit 2.772490e+11 14.810030
14 5041 Special Items of Pretax Income 1.016800e+10 142.846907
15 5043 Tax -4.744800e+10 -5.397841
16 5045 Net Profit 2.298010e+11 16.966717
17 5046 Profit from Continuing Operations 2.298010e+11 16.966717
18 5050 Minority Interests 4.959000e+09 107.142857
19 5051 Net Income to Parent Company 2.248420e+11 15.854343
20 5052 Net Income to Common Stockholders 2.248420e+11 15.854343
21 5054 Basic EPS 2.474900e+01 18.201356
22 5055 Diluted EPS 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; // 1ページあたりの件数、デフォルト 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
- API結果については 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; // 1ページあたりの件数、デフォルト 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
- API結果については 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: "Total Revenue"
}
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: "CNY"
accountingStandards: "IAS"
auditorReport: "Unqualified opinion"
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; // 1ページあたりの件数、デフォルト 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
- API結果については 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=7459212560278706625
Send Qot_GetFinancialsStatements: 2
Receive Qot_GetFinancialsStatements: retType: 0
retMsg: ""
errCode: 0
s2c {
structureList {
fieldId: 5001
displayName: "Total Revenue"
}
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: "CNY"
accountingStandards: "IAS"
auditorReport: "Unqualified opinion"
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; // 1ページあたりの件数、デフォルト 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
- API結果については RetType 参照
- 財報種別については F10Type 参照
- 財務報告書種別については FinancialStatementsType 参照
- 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: "Total Revenue"
}
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: "CNY"
accountingStandards: "IAS"
auditorReport: "Unqualified opinion"
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; // 1ページあたりの件数、デフォルト 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
- API結果については 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": "Total Revenue"
//...
}],
"reportList": [{
"dateTime": "1767110400",
"dateTimeStr": "2025-12-31",
"fiscalYear": 2025,
"financialType": "F10Type_Annual",
"periodText": "2025/FY",
"itemList": [{
"fieldId": "5001",
"data": 751766000000,
"yoy": 13.859603154529221
//...
}],
"currencyInfo": "CNY",
"accountingStandards": "IAS",
"auditorReport": "Unqualified opinion",
"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リクエスト。
- 株式および投資信託に対応。
← 決算日前後の株価履歴を取得 主営構成を取得 →