# Get Option Event Alert
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_event_alert(count=200, page=None)
Description
Query the list of configured option unusual activity alerts, with pagination support.
Parameters
Parameter Type Description count int Page size Range [1,500], default 200page str Pagination marker Pass None for the first request, pass next_page for subsequent pagesReturns
Parameter Type Description ret RET_CODE Interface call result data dict When ret == RET_OK, returns alert data str When ret != RET_OK, returns error description data dictionary contains:
Field Type Description alert_list pandas.DataFrame Alert settings list next_page str Next page marker (empty string means no more pages) all_count int Total alert count alert_list DataFrame columns:
Field Type Description key int Alert unique identifier enable bool Alert switch option_market str Market category (OptionMarket enum value) watchlist_group_name str Watchlist group name underlying str Specified underlying code option_type str Option type (CALL/PUT) side_type_list list Trade direction list (EventTickerType enum values) order_type_list list Order type list (AlertOrderType enum values) market_cap_range_min float Underlying market cap lower bound market_cap_range_max float Underlying market cap upper bound market_cap_min_inclusive bool Whether market cap lower bound is inclusive market_cap_max_inclusive bool Whether market cap upper bound is inclusive expiry_days_range_min float Days to expiration lower bound expiry_days_range_max float Days to expiration upper bound expiry_days_min_inclusive bool Whether days to expiration lower bound is inclusive expiry_days_max_inclusive bool Whether days to expiration upper bound is inclusive price_range_min float Event fill price lower bound price_range_max float Event fill price upper bound price_min_inclusive bool Whether fill price lower bound is inclusive price_max_inclusive bool Whether fill price upper bound is inclusive size_range_min float Event volume lower bound (contracts) size_range_max float Event volume upper bound (contracts) size_min_inclusive bool Whether volume lower bound is inclusive size_max_inclusive bool Whether volume upper bound is inclusive premium_range_min float Event turnover lower bound premium_range_max float Event turnover upper bound premium_min_inclusive bool Whether turnover lower bound is inclusive premium_max_inclusive bool Whether turnover upper bound is inclusive iv_range_min float Implied volatility lower bound (%) iv_range_max float Implied volatility upper bound (%) iv_min_inclusive bool Whether IV lower bound is inclusive iv_max_inclusive bool Whether IV upper bound is inclusive earnings_date_begin str Earnings date filter start date (yyyy-MM-dd) earnings_date_end str Earnings date filter end date (yyyy-MM-dd) note str Note
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_event_alert()
if ret == RET_OK:
print(data['alert_list'])
print('all_count:', data['all_count'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
- Output
key enable option_market watchlist_group_name underlying option_type side_type_list order_type_list market_cap_range_min market_cap_range_max market_cap_min_inclusive market_cap_max_inclusive expiry_days_range_min expiry_days_range_max expiry_days_min_inclusive expiry_days_max_inclusive price_range_min price_range_max price_min_inclusive price_max_inclusive size_range_min size_range_max size_min_inclusive size_max_inclusive premium_range_min premium_range_max premium_min_inclusive premium_max_inclusive iv_range_min iv_range_max iv_min_inclusive iv_max_inclusive earnings_date_begin earnings_date_end note
0 14743 False US_SECURITY N/A N/A CALL N/A [SWEEP] N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 100.0 N/A True N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A test
all_count: 1
2
3
# Qot_GetOptionEventAlert.proto
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
uint GetOptionEventAlert(Qot_GetOptionEventAlert.Request req); virtual void OnReply_GetOptionEventAlert(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionEventAlert.Response rsp);
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
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)
{
if (errCode != 0) return;
var c2s = Qot_GetOptionEventAlert.C2S.CreateBuilder()
// TODO: fill c2s fields per proto
.Build();
var req = Qot_GetOptionEventAlert.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetOptionEventAlert(req);
Console.Write("Send GetOptionEventAlert: {0}\n", seqNo);
}
public void OnReply_GetOptionEventAlert(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionEventAlert.Response rsp)
{
Console.Write("Reply: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
new Program().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
- Output
Send GetOptionEventAlert: 1
Reply: 1 { "value": 100, "includes": true } },
"note": "test"
}
],
"nextPage": "",
"allCount": 1
}
2
3
4
5
6
7
8
int getOptionEventAlert(Qot_GetOptionEventAlert.Request req) onReply_GetOptionEventAlert(FTAPI_Conn client, int nSerialNo, Qot_GetOptionEventAlert.Response rsp)
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
Example
public class Program implements FTSPI_Qot, FTSPI_Conn {
private FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public Program() {
qot.setClientInfo("java", 1);
qot.setConnCallback(this);
qot.setQotCallback(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short) 11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc) {
if (errCode != 0) return;
Qot_GetOptionEventAlert.C2S c2s = Qot_GetOptionEventAlert.C2S.newBuilder()
// TODO: fill c2s fields per proto
.build();
Qot_GetOptionEventAlert.Request req = Qot_GetOptionEventAlert.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getOptionEventAlert(req);
System.out.println("Send getOptionEventAlert: " + seqNo);
}
@Override
public void onReply_GetOptionEventAlert(FTAPI_Conn client, int nSerialNo, Qot_GetOptionEventAlert.Response rsp) {
System.out.println("Reply: " + nSerialNo + " " + rsp.toString());
}
public static void main(String[] args) {
FTAPI.init();
new Program().start();
while (true) {
try { Thread.sleep(1000 * 600); } catch (InterruptedException e) {}
}
}
}
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
- Output
Send getOptionEventAlert: 1
Reply: 1 { "value": 100, "includes": true } },
"note": "test"
}
],
"nextPage": "",
"allCount": 1
}
2
3
4
5
6
7
8
Futu::u32_t GetOptionEventAlert(const Qot_GetOptionEventAlert::Request &stReq);
virtual void OnReply_GetOptionEventAlert(Futu::u32_t nSerialNo, const Qot_GetOptionEventAlert::Response &stRsp) = 0;
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
Example
class Program : public FTSPI_Qot, 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) {
Qot_GetOptionEventAlert::Request req;
Qot_GetOptionEventAlert::C2S *c2s = req.mutable_c2s();
// TODO: populate c2s fields per proto
m_GetOptionEventAlertSerialNo = m_pQotApi->GetOptionEventAlert(req);
}
virtual void OnReply_GetOptionEventAlert(Futu::u32_t nSerialNo, const Qot_GetOptionEventAlert::Response &stRsp) {
if (nSerialNo != m_GetOptionEventAlertSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionEventAlertSerialNo = 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
getOptionEventAlert(qotGetOptionEventAlert)
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionEventAlert(){
const { RetType } = Common
const { OptionMarket } = Qot_OptionCommon
const { OptionType } = 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: {
count: 10,
page: "",
},
};
websocket.GetOptionEventAlert(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionEventAlert: 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("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetOptionEventAlert()
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
- Output
GetOptionEventAlert: errCode 0, retMsg , retType 0
{
"alertList": [
{
"key": "1700000000001",
"enable": true,
"optionMarket": 0,
"optionType": 1,
"orderTypeList": [1],
"sizeRange": { "filterMin": { "value": 100, "includes": true } },
"note": "test"
}
],
"nextPage": "",
"allCount": 1
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Rate Limit
- Maximum 60 requests per 30 seconds for the get option event alert interface (for paginated interfaces, only the first call counts)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_event_alert(count=200, page=None)
Description
Query the list of configured option unusual activity alerts, with pagination support.
Parameters
Parameter Type Description count int Page size Range [1,500], default 200page str Pagination marker Pass None for the first request, pass next_page for subsequent pagesReturns
Parameter Type Description ret RET_CODE Interface call result data dict When ret == RET_OK, returns alert data str When ret != RET_OK, returns error description data dictionary contains:
Field Type Description alert_list pandas.DataFrame Alert settings list next_page str Next page marker (empty string means no more pages) all_count int Total alert count alert_list DataFrame columns:
Field Type Description key int Alert unique identifier enable bool Alert switch option_market str Market category (OptionMarket enum value) watchlist_group_name str Watchlist group name underlying str Specified underlying code option_type str Option type (CALL/PUT) side_type_list list Trade direction list (EventTickerType enum values) order_type_list list Order type list (AlertOrderType enum values) market_cap_range_min float Underlying market cap lower bound market_cap_range_max float Underlying market cap upper bound market_cap_min_inclusive bool Whether market cap lower bound is inclusive market_cap_max_inclusive bool Whether market cap upper bound is inclusive expiry_days_range_min float Days to expiration lower bound expiry_days_range_max float Days to expiration upper bound expiry_days_min_inclusive bool Whether days to expiration lower bound is inclusive expiry_days_max_inclusive bool Whether days to expiration upper bound is inclusive price_range_min float Event fill price lower bound price_range_max float Event fill price upper bound price_min_inclusive bool Whether fill price lower bound is inclusive price_max_inclusive bool Whether fill price upper bound is inclusive size_range_min float Event volume lower bound (contracts) size_range_max float Event volume upper bound (contracts) size_min_inclusive bool Whether volume lower bound is inclusive size_max_inclusive bool Whether volume upper bound is inclusive premium_range_min float Event turnover lower bound premium_range_max float Event turnover upper bound premium_min_inclusive bool Whether turnover lower bound is inclusive premium_max_inclusive bool Whether turnover upper bound is inclusive iv_range_min float Implied volatility lower bound (%) iv_range_max float Implied volatility upper bound (%) iv_min_inclusive bool Whether IV lower bound is inclusive iv_max_inclusive bool Whether IV upper bound is inclusive earnings_date_begin str Earnings date filter start date (yyyy-MM-dd) earnings_date_end str Earnings date filter end date (yyyy-MM-dd) note str Note
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_event_alert()
if ret == RET_OK:
print(data['alert_list'])
print('all_count:', data['all_count'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
- Output
key enable option_market watchlist_group_name underlying option_type side_type_list order_type_list market_cap_range_min market_cap_range_max market_cap_min_inclusive market_cap_max_inclusive expiry_days_range_min expiry_days_range_max expiry_days_min_inclusive expiry_days_max_inclusive price_range_min price_range_max price_min_inclusive price_max_inclusive size_range_min size_range_max size_min_inclusive size_max_inclusive premium_range_min premium_range_max premium_min_inclusive premium_max_inclusive iv_range_min iv_range_max iv_min_inclusive iv_max_inclusive earnings_date_begin earnings_date_end note
0 14743 False US_SECURITY N/A N/A CALL N/A [SWEEP] N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 100.0 N/A True N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A test
all_count: 1
2
3
# Qot_GetOptionEventAlert.proto
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
uint GetOptionEventAlert(Qot_GetOptionEventAlert.Request req); virtual void OnReply_GetOptionEventAlert(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionEventAlert.Response rsp);
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
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)
{
if (errCode != 0) return;
var c2s = Qot_GetOptionEventAlert.C2S.CreateBuilder()
// TODO: fill c2s fields per proto
.Build();
var req = Qot_GetOptionEventAlert.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetOptionEventAlert(req);
Console.Write("Send GetOptionEventAlert: {0}\n", seqNo);
}
public void OnReply_GetOptionEventAlert(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionEventAlert.Response rsp)
{
Console.Write("Reply: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
new Program().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
- Output
Send GetOptionEventAlert: 1
Reply: 1 { "value": 100, "includes": true } },
"note": "test"
}
],
"nextPage": "",
"allCount": 1
}
2
3
4
5
6
7
8
int getOptionEventAlert(Qot_GetOptionEventAlert.Request req) onReply_GetOptionEventAlert(MMAPI_Conn client, int nSerialNo, Qot_GetOptionEventAlert.Response rsp)
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
Example
public class Program implements MMSPI_Qot, MMSPI_Conn {
private MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public Program() {
qot.setClientInfo("java", 1);
qot.setConnCallback(this);
qot.setQotCallback(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short) 11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc) {
if (errCode != 0) return;
Qot_GetOptionEventAlert.C2S c2s = Qot_GetOptionEventAlert.C2S.newBuilder()
// TODO: fill c2s fields per proto
.build();
Qot_GetOptionEventAlert.Request req = Qot_GetOptionEventAlert.Request.newBuilder()
.setC2S(c2s).build();
int seqNo = qot.getOptionEventAlert(req);
System.out.println("Send getOptionEventAlert: " + seqNo);
}
@Override
public void onReply_GetOptionEventAlert(MMAPI_Conn client, int nSerialNo, Qot_GetOptionEventAlert.Response rsp) {
System.out.println("Reply: " + nSerialNo + " " + rsp.toString());
}
public static void main(String[] args) {
MMAPI.init();
new Program().start();
while (true) {
try { Thread.sleep(1000 * 600); } catch (InterruptedException e) {}
}
}
}
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
- Output
Send getOptionEventAlert: 1
Reply: 1 { "value": 100, "includes": true } },
"note": "test"
}
],
"nextPage": "",
"allCount": 1
}
2
3
4
5
6
7
8
Moomoo::u32_t GetOptionEventAlert(const Qot_GetOptionEventAlert::Request &stReq);
virtual void OnReply_GetOptionEventAlert(Moomoo::u32_t nSerialNo, const Qot_GetOptionEventAlert::Response &stRsp) = 0;
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
Example
class Program : public MMSPI_Qot, 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) {
Qot_GetOptionEventAlert::Request req;
Qot_GetOptionEventAlert::C2S *c2s = req.mutable_c2s();
// TODO: populate c2s fields per proto
m_GetOptionEventAlertSerialNo = m_pQotApi->GetOptionEventAlert(req);
}
virtual void OnReply_GetOptionEventAlert(Moomoo::u32_t nSerialNo, const Qot_GetOptionEventAlert::Response &stRsp) {
if (nSerialNo != m_GetOptionEventAlertSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionEventAlertSerialNo = 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
getOptionEventAlert(qotGetOptionEventAlert)
Description
Query the list of configured option unusual activity alerts
Parameters
message C2S {
optional int32 count = 1;
optional string page = 2;
}
message Request {
required C2S c2s = 1;
}
2
3
4
5
6
7
8
- Returns
message EventAlertItem {
optional int64 key = 1;
optional bool enable = 2;
optional int32 optionMarket = 10;
optional string watchlistGroupName = 11;
optional Qot_Common.Security underlying = 12;
optional int32 optionType = 20;
repeated int32 sideTypeList = 21;
repeated int32 orderTypeList = 22;
optional Qot_OptionCommon.Interval marketCapRange = 30;
optional Qot_OptionCommon.Interval expiryDaysRange = 31;
optional Qot_OptionCommon.Interval priceRange = 32;
optional Qot_OptionCommon.Interval sizeRange = 33;
optional Qot_OptionCommon.Interval premiumRange = 34;
optional Qot_OptionCommon.Interval ivRange = 35;
optional string earningsDateBegin = 41;
optional string earningsDateEnd = 42;
optional string note = 50;
}
message S2C {
repeated EventAlertItem alertList = 1;
optional string nextPage = 2;
optional int32 allCount = 3;
}
message Response {
required int32 retType = 1 [default = -400]; //RetType, cyclic result
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
- Interface call result, see RetType
Protocol ID
3308
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionEventAlert(){
const { RetType } = Common
const { OptionMarket } = Qot_OptionCommon
const { OptionType } = 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: {
count: 10,
page: "",
},
};
websocket.GetOptionEventAlert(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionEventAlert: 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("start error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{ websocket.stop(); process.exit(); }, 5000);
}
QotGetOptionEventAlert()
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
- Output
GetOptionEventAlert: errCode 0, retMsg , retType 0
{
"alertList": [
{
"key": "1700000000001",
"enable": true,
"optionMarket": 0,
"optionType": 1,
"orderTypeList": [1],
"sizeRange": { "filterMin": { "value": 100, "includes": true } },
"note": "test"
}
],
"nextPage": "",
"allCount": 1
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Rate Limit
- Maximum 60 requests per 30 seconds for the get option event alert interface (for paginated interfaces, only the first call counts)