# Get Earnings Price History
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_financials_earnings_price_history(code)
Description
Get earnings price history
Parameters
Parameter Type Description code str Stock code Returns
Parameter Type Description ret RET_CODE API call result data pd.DataFrame When ret == RET_OK, returns price history data expanded by trading day str When ret != RET_OK, returns error description Each row contains both earnings metadata and daily price data:
Field Type Description fiscal_year int Fiscal year e.g. 2024financial_type F10Type Report type 0=Unknown, 1=Q1, 2=Q2, 3=Q3, 4=Q4, 7=Annual, 9=Quarterly, etc.period_text str Earnings period e.g. "2024/Q3", "2024/FY"is_current bool Whether this is the current (latest) earnings period pub_trading_day int Earnings announcement trading day timestamp (seconds) pub_trading_day_str str Earnings announcement trading day Format: yyyy-MM-dd; market timezonepub_time int Earnings actual release timestamp (seconds, includes time) pub_time_str str Earnings release datetime Format: yyyy-MM-dd HH:mm:ss; market timezonepub_type EarningsPubTimeType Announcement time type 0=Unknown, 1=Pre-market, 2=After-market, 3=During-marketpredict_vola_ratio_newest float Latest predicted volatility ratio Percentage value, e.g. 12.34 means 12.34%predict_vola_ratio_highest float Highest predicted volatility ratio Percentage value, e.g. 12.34 means 12.34%predict_vola_val_newest float Latest predicted volatility amount predict_vola_val_highest float Highest predicted volatility amount option_iv_crush float Option implied volatility crush Percentage value, e.g. 12.34 means 12.34%option_strike_date_iv_crush float Strike date option IV crush Percentage value, e.g. 12.34 means 12.34%trading_day int Trading day timestamp (seconds) trading_day_str str Trading date Format: yyyy-MM-dd; market timezoneclose_price float Close price open_price float Open price highest_price float High price lowest_price float Low price last_close_price float Previous close price volume float Volume (shares) schedule_delta int Trading day offset from announcement date Negative=before announcement, 0=announcement day, positive=after announcementschedule_close_price float Close price at the given day offset
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_financials_earnings_price_history("HK.00700")
if ret == RET_OK:
print(data)
print(data['period_text'][0])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
- Output
fiscal_year financial_type ... schedule_delta schedule_close_price
0 2026 1 ... -15 504.000000
1 2026 1 ... -14 495.200000
2 2026 1 ... -13 493.400000
3 2026 1 ... -12 478.600000
4 2026 1 ... -11 473.800000
.. ... ... ... ... ...
579 2021 2 ... 10 445.420633
580 2021 2 ... 11 438.045790
581 2021 2 ... 12 453.717332
582 2021 2 ... 13 463.396813
583 2021 2 ... 14 471.693512
[584 rows x 25 columns]
2026/Q1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Qot_GetFinancialsEarningsPriceHistory.proto
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- Report type, see F10Type
- Announcement time type, see EarningsPubTimeType
Protocol ID
3226
uint GetFinancialsEarningsPriceHistory(QotGetFinancialsEarningsPriceHistory.Request req);
virtual void OnReply_GetFinancialsEarningsPriceHistory(FTAPI_Conn client, uint nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp);
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- 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();
QotGetFinancialsEarningsPriceHistory.C2S c2s = QotGetFinancialsEarningsPriceHistory.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetFinancialsEarningsPriceHistory.Request req = QotGetFinancialsEarningsPriceHistory.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetFinancialsEarningsPriceHistory(req);
Console.Write("Send QotGetFinancialsEarningsPriceHistory: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetFinancialsEarningsPriceHistory(FTAPI_Conn client, uint nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp)
{
Console.Write("Reply: QotGetFinancialsEarningsPriceHistory: {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 {
detailList {
fiscalYear: 2026
financialType: 1
periodText: "2026/Q1"
isCurrent: true
pubTradingDay: 1778601600
pubTradingDayStr: "2026-05-13"
pubTime: 1778601600
pubTimeStr: "2026-05-13 00:00:00"
pubType: EarningsPubTimeType_Unknown
predictVolaRatioNewest: 3.511
predictVolaRatioHighest: 4.225
predictVolaValNewest: 16.603
predictVolaValHighest: 20.037
scheduleInfoList {
delta: -15
closePrice: 504
}
scheduleInfoList {
//...
}
}
detailList {
//...
}
}
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
int getFinancialsEarningsPriceHistory(QotGetFinancialsEarningsPriceHistory.Request req);
void onReply_GetFinancialsEarningsPriceHistory(FTAPI_Conn client, int nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp);
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- 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();
QotGetFinancialsEarningsPriceHistory.C2S c2s = QotGetFinancialsEarningsPriceHistory.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetFinancialsEarningsPriceHistory.Request req = QotGetFinancialsEarningsPriceHistory.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getFinancialsEarningsPriceHistory(req);
System.out.printf("Send QotGetFinancialsEarningsPriceHistory: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetFinancialsEarningsPriceHistory(FTAPI_Conn client, int nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetFinancialsEarningsPriceHistory failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetFinancialsEarningsPriceHistory: %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=7459212553211430465
Send Qot_GetFinancialsEarningsPriceHistory: 2
Receive Qot_GetFinancialsEarningsPriceHistory: retType: 0
retMsg: ""
errCode: 0
s2c {
detailList {
fiscalYear: 2026
financialType: 1
periodText: "2026/Q1"
isCurrent: true
pubTradingDay: 1778601600
pubTradingDayStr: "2026-05-13"
pubTime: 1778601600
pubTimeStr: "2026-05-13 00:00:00"
pubType: EarningsPubTimeType_Unknown
predictVolaRatioNewest: 3.511
predictVolaRatioHighest: 4.225
predictVolaValNewest: 16.603
predictVolaValHighest: 20.037
scheduleInfoList {
delta: -15
closePrice: 504.0
}
scheduleInfoList {
//...
}
}
detailList {
//...
}
}
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
Futu::u32_t GetFinancialsEarningsPriceHistory(const Qot_GetFinancialsEarningsPriceHistory::Request &stReq);
virtual void OnReply_GetFinancialsEarningsPriceHistory(Futu::u32_t nSerialNo, const Qot_GetFinancialsEarningsPriceHistory::Response &stRsp) = 0;
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- 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_GetFinancialsEarningsPriceHistory::Request req;
Qot_GetFinancialsEarningsPriceHistory::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->GetFinancialsEarningsPriceHistory(req);
cout << "GetFinancialsEarningsPriceHistory" << endl;
}
virtual void OnReply_GetFinancialsEarningsPriceHistory(Futu::u32_t nSerialNo, const Qot_GetFinancialsEarningsPriceHistory::Response &stRsp){
cout << "OnReply_GetFinancialsEarningsPriceHistory:" << 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_GetFinancialsEarningsPriceHistory seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
detailList {
fiscalYear: 2026
financialType: 1
periodText: "2026/Q1"
isCurrent: true
pubTradingDay: 1778601600
pubTradingDayStr: "2026-05-13"
pubTime: 1778601600
pubTimeStr: "2026-05-13 00:00:00"
pubType: EarningsPubTimeType_Unknown
predictVolaRatioNewest: 3.511
predictVolaRatioHighest: 4.225
predictVolaValNewest: 16.603
predictVolaValHighest: 20.037
scheduleInfoList {
delta: -15
closePrice: 504
}
scheduleInfoList {
//...
}
}
detailList {
//...
}
}
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
GetFinancialsEarningsPriceHistory(req);
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetFinancialsEarningsPriceHistory(){
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.GetFinancialsEarningsPriceHistory(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetFinancialsEarningsPriceHistory: 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
GetFinancialsEarningsPriceHistory: errCode 0, retMsg , retType 0
{
"detailList": [{
"fiscalYear": 2026,
"financialType": 1,
"periodText": "2026/Q1",
"isCurrent": true,
"pubTradingDay": "1778601600",
"pubTradingDayStr": "2026-05-13",
"pubTime": "1778601600",
"pubTimeStr": "2026-05-13 00:00:00",
"pubType": "EarningsPubTimeType_Unknown",
"predictVolaRatioNewest": 3.511,
"predictVolaRatioHighest": 4.225,
"predictVolaValNewest": 16.603,
"predictVolaValHighest": 20.037,
"scheduleInfoList": [{
"delta": -15,
"closePrice": 504
//...
}]
//...
}]
}
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
Restrictions
- Max 30 requests per 30 seconds.
- Supports HK and US equities only.
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_financials_earnings_price_history(code)
Description
Get earnings price history
Parameters
Parameter Type Description code str Stock code Returns
Parameter Type Description ret RET_CODE API call result data pd.DataFrame When ret == RET_OK, returns price history data expanded by trading day str When ret != RET_OK, returns error description Each row contains both earnings metadata and daily price data:
Field Type Description fiscal_year int Fiscal year e.g. 2024financial_type F10Type Report type 0=Unknown, 1=Q1, 2=Q2, 3=Q3, 4=Q4, 7=Annual, 9=Quarterly, etc.period_text str Earnings period e.g. "2024/Q3", "2024/FY"is_current bool Whether this is the current (latest) earnings period pub_trading_day int Earnings announcement trading day timestamp (seconds) pub_trading_day_str str Earnings announcement trading day Format: yyyy-MM-dd; market timezonepub_time int Earnings actual release timestamp (seconds, includes time) pub_time_str str Earnings release datetime Format: yyyy-MM-dd HH:mm:ss; market timezonepub_type EarningsPubTimeType Announcement time type 0=Unknown, 1=Pre-market, 2=After-market, 3=During-marketpredict_vola_ratio_newest float Latest predicted volatility ratio Percentage value, e.g. 12.34 means 12.34%predict_vola_ratio_highest float Highest predicted volatility ratio Percentage value, e.g. 12.34 means 12.34%predict_vola_val_newest float Latest predicted volatility amount predict_vola_val_highest float Highest predicted volatility amount option_iv_crush float Option implied volatility crush Percentage value, e.g. 12.34 means 12.34%option_strike_date_iv_crush float Strike date option IV crush Percentage value, e.g. 12.34 means 12.34%trading_day int Trading day timestamp (seconds) trading_day_str str Trading date Format: yyyy-MM-dd; market timezoneclose_price float Close price open_price float Open price highest_price float High price lowest_price float Low price last_close_price float Previous close price volume float Volume (shares) schedule_delta int Trading day offset from announcement date Negative=before announcement, 0=announcement day, positive=after announcementschedule_close_price float Close price at the given day offset
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_financials_earnings_price_history("HK.00700")
if ret == RET_OK:
print(data)
print(data['period_text'][0])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
- Output
fiscal_year financial_type ... schedule_delta schedule_close_price
0 2026 1 ... -15 504.000000
1 2026 1 ... -14 495.200000
2 2026 1 ... -13 493.400000
3 2026 1 ... -12 478.600000
4 2026 1 ... -11 473.800000
.. ... ... ... ... ...
579 2021 2 ... 10 445.420633
580 2021 2 ... 11 438.045790
581 2021 2 ... 12 453.717332
582 2021 2 ... 13 463.396813
583 2021 2 ... 14 471.693512
[584 rows x 25 columns]
2026/Q1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Qot_GetFinancialsEarningsPriceHistory.proto
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- Report type, see F10Type
- Announcement time type, see EarningsPubTimeType
Protocol ID
3226
uint GetFinancialsEarningsPriceHistory(QotGetFinancialsEarningsPriceHistory.Request req);
virtual void OnReply_GetFinancialsEarningsPriceHistory(MMAPI_Conn client, uint nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp);
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- 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();
QotGetFinancialsEarningsPriceHistory.C2S c2s = QotGetFinancialsEarningsPriceHistory.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetFinancialsEarningsPriceHistory.Request req = QotGetFinancialsEarningsPriceHistory.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetFinancialsEarningsPriceHistory(req);
Console.Write("Send QotGetFinancialsEarningsPriceHistory: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetFinancialsEarningsPriceHistory(MMAPI_Conn client, uint nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp)
{
Console.Write("Reply: QotGetFinancialsEarningsPriceHistory: {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 {
detailList {
fiscalYear: 2026
financialType: 1
periodText: "2026/Q1"
isCurrent: true
pubTradingDay: 1778601600
pubTradingDayStr: "2026-05-13"
pubTime: 1778601600
pubTimeStr: "2026-05-13 00:00:00"
pubType: EarningsPubTimeType_Unknown
predictVolaRatioNewest: 3.511
predictVolaRatioHighest: 4.225
predictVolaValNewest: 16.603
predictVolaValHighest: 20.037
scheduleInfoList {
delta: -15
closePrice: 504
}
scheduleInfoList {
//...
}
}
detailList {
//...
}
}
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
int getFinancialsEarningsPriceHistory(QotGetFinancialsEarningsPriceHistory.Request req);
void onReply_GetFinancialsEarningsPriceHistory(MMAPI_Conn client, int nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp);
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- 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();
QotGetFinancialsEarningsPriceHistory.C2S c2s = QotGetFinancialsEarningsPriceHistory.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetFinancialsEarningsPriceHistory.Request req = QotGetFinancialsEarningsPriceHistory.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getFinancialsEarningsPriceHistory(req);
System.out.printf("Send QotGetFinancialsEarningsPriceHistory: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetFinancialsEarningsPriceHistory(MMAPI_Conn client, int nSerialNo, QotGetFinancialsEarningsPriceHistory.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetFinancialsEarningsPriceHistory failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetFinancialsEarningsPriceHistory: %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=7459212553211430465
Send Qot_GetFinancialsEarningsPriceHistory: 2
Receive Qot_GetFinancialsEarningsPriceHistory: retType: 0
retMsg: ""
errCode: 0
s2c {
detailList {
fiscalYear: 2026
financialType: 1
periodText: "2026/Q1"
isCurrent: true
pubTradingDay: 1778601600
pubTradingDayStr: "2026-05-13"
pubTime: 1778601600
pubTimeStr: "2026-05-13 00:00:00"
pubType: EarningsPubTimeType_Unknown
predictVolaRatioNewest: 3.511
predictVolaRatioHighest: 4.225
predictVolaValNewest: 16.603
predictVolaValHighest: 20.037
scheduleInfoList {
delta: -15
closePrice: 504.0
}
scheduleInfoList {
//...
}
}
detailList {
//...
}
}
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
moomoo::u32_t GetFinancialsEarningsPriceHistory(const Qot_GetFinancialsEarningsPriceHistory::Request &stReq);
virtual void OnReply_GetFinancialsEarningsPriceHistory(moomoo::u32_t nSerialNo, const Qot_GetFinancialsEarningsPriceHistory::Response &stRsp) = 0;
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see 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_GetFinancialsEarningsPriceHistory::Request req;
Qot_GetFinancialsEarningsPriceHistory::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->GetFinancialsEarningsPriceHistory(req);
cout << "GetFinancialsEarningsPriceHistory" << endl;
}
virtual void OnReply_GetFinancialsEarningsPriceHistory(moomoo::u32_t nSerialNo, const Qot_GetFinancialsEarningsPriceHistory::Response &stRsp){
cout << "OnReply_GetFinancialsEarningsPriceHistory:" << 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_GetFinancialsEarningsPriceHistory seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
detailList {
fiscalYear: 2026
financialType: 1
periodText: "2026/Q1"
isCurrent: true
pubTradingDay: 1778601600
pubTradingDayStr: "2026-05-13"
pubTime: 1778601600
pubTimeStr: "2026-05-13 00:00:00"
pubType: EarningsPubTimeType_Unknown
predictVolaRatioNewest: 3.511
predictVolaRatioHighest: 4.225
predictVolaValNewest: 16.603
predictVolaValHighest: 20.037
scheduleInfoList {
delta: -15
closePrice: 504
}
scheduleInfoList {
//...
}
}
detailList {
//...
}
}
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
GetFinancialsEarningsPriceHistory(req);
Description
Get earnings price history
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Security
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
- Security structure, see Security
- Returns
// Price data for the earnings announcement day
message PriceInfo
{
optional int64 tradingDay = 1; // Trading day timestamp (seconds)
optional string tradingDayStr = 2; // Trading day string, format YYYY-MM-DD, market timezone
optional double closePrice = 3; // Close price
optional double openPrice = 4; // Open price
optional double highestPrice = 5; // High price
optional double lowestPrice = 6; // Low price
optional double lastClosePrice = 7; // Previous close price
optional double volume = 8; // Volume (shares)
}
// Close price at a single trading day offset relative to the earnings date
message FinScheduleInfo
{
optional int32 delta = 1; // Trading day offset from announcement date (negative=before, 0=announcement day, positive=after)
optional double closePrice = 2; // Close price on that trading day
}
// Historical price data for a single earnings period, including metadata, predicted volatility, and full price data for the announcement day
message PriceHistoryOnEarningsDays
{
optional int32 fiscalYear = 1; // Fiscal year, e.g. 2024
optional int32 financialType = 2; // Report type, see Qot_Common.F10Type definition
optional string periodText = 3; // Earnings period, e.g. "2024/Q3", "2024/FY"
optional bool isCurrent = 4; // Whether this is the current (latest) earnings period
optional int64 pubTradingDay = 5; // Earnings announcement trading day timestamp (seconds)
optional string pubTradingDayStr = 6; // Earnings announcement trading day string, format YYYY-MM-DD, market timezone
optional int64 pubTime = 7; // Earnings actual release timestamp (seconds, includes time)
optional string pubTimeStr = 8; // Earnings release datetime string, format YYYY-MM-DD HH:MM:SS, market timezone
optional Qot_Common.EarningsPubTimeType pubType = 9; // Announcement time type, see Qot_Common.EarningsPubTimeType definition
optional double predictVolaRatioNewest = 10; // Latest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaRatioHighest = 11; // Highest predicted volatility ratio (percentage value, e.g. 12.34 means 12.34%)
optional double predictVolaValNewest = 12; // Latest predicted volatility amount
optional double predictVolaValHighest = 13; // Highest predicted volatility amount
optional double optionIVCrush = 14; // Option implied volatility crush (percentage value, e.g. 12.34 means 12.34%)
optional double optionStrikeDateIVCrush = 15; // Strike date option IV crush (percentage value, e.g. 12.34 means 12.34%)
optional PriceInfo priceInfo = 16; // Price data for the earnings announcement day
repeated FinScheduleInfo scheduleInfoList = 17; // Close price list at each trading day offset, ascending by delta
}
message S2C
{
repeated PriceHistoryOnEarningsDays detailList = 1; // Historical price data list for each earnings period, descending by announcement date
}
message Response
{
required int32 retType = 1 [default = -400]; // Return type, see Common.RetType, 0=success, negative=failure
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code, valid on failure
optional S2C s2c = 4; // Response data
}
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
- API result, see RetType
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetFinancialsEarningsPriceHistory(){
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.GetFinancialsEarningsPriceHistory(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetFinancialsEarningsPriceHistory: 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
GetFinancialsEarningsPriceHistory: errCode 0, retMsg , retType 0
{
"detailList": [{
"fiscalYear": 2026,
"financialType": 1,
"periodText": "2026/Q1",
"isCurrent": true,
"pubTradingDay": "1778601600",
"pubTradingDayStr": "2026-05-13",
"pubTime": "1778601600",
"pubTimeStr": "2026-05-13 00:00:00",
"pubType": "EarningsPubTimeType_Unknown",
"predictVolaRatioNewest": 3.511,
"predictVolaRatioHighest": 4.225,
"predictVolaValNewest": 16.603,
"predictVolaValHighest": 20.037,
"scheduleInfoList": [{
"delta": -15,
"closePrice": 504
//...
}]
//...
}]
}
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
Restrictions
- Max 30 requests per 30 seconds.
- Supports HK and US equities only.