# Zero DTE Option Screener
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_zero_dte_screener(market, sort_type=None, is_asc=None, count=None, page=None, filter_list=None)
Description
Get the zero DTE option underlying screener list, returning underlying stock information for options expiring on the current day (0DTE), including volatility, option volume, open interest, and option chain information.
Parameters
Parameter Type Description market OptionMarket Option market type US_SECURITY=US equity options, US_INDEX=US index options (US market only)sort_type ZeroDteSortType Sort type VOLUME=option volume, IV=implied volatility, CHANGE_RATIO=price change, OPEN_INTEREST=open interest, MARKET_CAP=market capis_asc bool Ascending order Default False (descending)count int Items per page Range [1,500], default 50page str Pagination cursor Leave empty or omit for first call, pass next_page for subsequent pagesfilter_list list[ZeroDteFilter] Filter conditions list Multiple conditions use AND logic. Supports OWNER_LIST, HAS_EARNINGS_THIS_WEEK, VOLUME, OPEN_INTEREST, IV, HV, IV_RANK, IV_PERCENTILE, PRICE, CHANGE_RATIOReturns
Parameter Type Description ret RET_CODE Interface call result data dict When ret == RET_OK, returns a dict containing item_list (DataFrame), next_page (str/None), update_timestamp (float) str When ret != RET_OK, returns error description Return DataFrame fields:
Field Type Description owner str Underlying stock code name str Underlying name price float Underlying current price change_ratio float Price change (percentage) market_cap float Market capitalization iv float Implied volatility (percentage) iv_rank float IV rank (percentage) iv_percentile float IV percentile (percentage) hv float Historical volatility (percentage) volume int Option volume open_interest int Option open interest last_trading_time int Last trading timestamp (Unix seconds) earnings_timestamp int Earnings date timestamp (seconds) earnings_time str Earnings time string earnings_pub_type str Earnings release type (BEFORE/AFTER) chain_info dict Option chain information Used for get_option_zero_dte_contract call
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_zero_dte_screener(
market=OptionMarket.US_SECURITY,
sort_type=ZeroDteSortType.VOLUME,
is_asc=False,
count=5
)
if ret == RET_OK:
print(data['item_list'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
owner name price change_ratio market_cap iv iv_rank iv_percentile hv volume open_interest last_trading_time earnings_timestamp earnings_time earnings_pub_type chain_info
0 US.SPY 标普500ETF-SPDR 741.75 0.540 7.830717e+11 17.675 27.143 61.111 15.031 14228830 19909256 1781554500 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'SPY', 'multiplier': 100.0, ...}
1 US.QQQ 纳指100ETF-Invesco QQQ Trust 721.34 0.588 4.805349e+11 27.652 62.918 91.269 26.196 8239190 12964422 1781554500 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'QQQ', 'multiplier': 100.0, ...}
2 US.TSLA 特斯拉 406.43 1.823 1.526439e+12 55.053 39.265 64.285 49.359 3623504 7088459 1781553600 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'TSLA', 'multiplier': 100.0, ...}
3 US.NVDA 英伟达 205.19 0.156 4.965598e+12 41.975 27.062 42.460 45.921 3157331 16744961 1781553600 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'NVDA', 'multiplier': 100.0, ...}
4 US.IWM 罗素2000ETF-iShares 292.95 0.874 8.143528e+10 24.857 33.930 64.285 24.802 2840729 11791964 1781554500 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'IWM', 'multiplier': 100.0, ...}
2
3
4
5
6
# Qot_GetOptionZeroDteScreener.proto
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
uint GetOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req); virtual void OnReply_GetOptionZeroDteScreener(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp);
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
int getOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req) onReply_GetOptionZeroDteScreener(FTAPI_Conn client, int nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp)
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
Futu::u32_t GetOptionZeroDteScreener(const Qot_GetOptionZeroDteScreener::Request &stReq);
virtual void OnReply_GetOptionZeroDteScreener(Futu::u32_t nSerialNo, const Qot_GetOptionZeroDteScreener::Response &stRsp) = 0;
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
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_GetOptionZeroDteScreener::Request req;
Qot_GetOptionZeroDteScreener::C2S *c2s = req.mutable_c2s();
// TODO: populate c2s fields per proto
m_GetOptionZeroDteScreenerSerialNo = m_pQotApi->GetOptionZeroDteScreener(req);
}
virtual void OnReply_GetOptionZeroDteScreener(Futu::u32_t nSerialNo, const Qot_GetOptionZeroDteScreener::Response &stRsp) {
if (nSerialNo != m_GetOptionZeroDteScreenerSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetOptionZeroDteScreenerSerialNo = 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
getOptionZeroDteScreener(qotGetOptionZeroDteScreener)
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
Example
import ftWebsocket from "futu-api";
import { Common, Qot_OptionCommon } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetOptionZeroDteScreener(){
const { RetType } = Common
const { OptionMarket, ZeroDteSortType } = Qot_OptionCommon
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
optionMarket: OptionMarket.OptionMarket_US_Security,
sortType: ZeroDteSortType.ZeroDteSortType_Volume,
count: 5,
},
};
websocket.GetOptionZeroDteScreener(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionZeroDteScreener: 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);
}
QotGetOptionZeroDteScreener()
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
GetOptionZeroDteScreener: errCode 0, retMsg , retType 0
{
"itemList": [
{
"owner": { "market": 1, "code": "SPY" },
"name": "标普500ETF-SPDR",
"price": 741.75,
"changeRate": 0.54,
"marketCap": 783071700000,
"iv": 17.675,
"ivRank": 27.143,
"ivPercentile": 61.111,
"hv": 15.031,
"volume": 14228830,
"openInterest": 19909256,
"lastTradingTime": 1781554500,
"chainInfo": {
"strikeDateTimestamp": 1781499600,
"productCode": "SPY",
"multiplier": 100,
"contractShareSize": 100
}
},
{
"owner": { "market": 1, "code": "QQQ" },
"name": "纳指100ETF-Invesco QQQ Trust",
"price": 721.34,
"changeRate": 0.588,
"marketCap": 480534900000,
"iv": 27.652,
"ivRank": 62.918,
"ivPercentile": 91.269,
"hv": 26.196,
"volume": 8239190,
"openInterest": 12964422,
"lastTradingTime": 1781554500,
"chainInfo": {
"strikeDateTimestamp": 1781499600,
"productCode": "QQQ",
"multiplier": 100,
"contractShareSize": 100
}
}
],
"updateTimestamp": 1781554500
}
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
Rate Limit
- Maximum 60 requests per 30 seconds (for paginated interfaces, only the first call counts)
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_option_zero_dte_screener(market, sort_type=None, is_asc=None, count=None, page=None, filter_list=None)
Description
Get the zero DTE option underlying screener list, returning underlying stock information for options expiring on the current day (0DTE), including volatility, option volume, open interest, and option chain information.
Parameters
Parameter Type Description market OptionMarket Option market type US_SECURITY=US equity options, US_INDEX=US index options (US market only)sort_type ZeroDteSortType Sort type VOLUME=option volume, IV=implied volatility, CHANGE_RATIO=price change, OPEN_INTEREST=open interest, MARKET_CAP=market capis_asc bool Ascending order Default False (descending)count int Items per page Range [1,500], default 50page str Pagination cursor Leave empty or omit for first call, pass next_page for subsequent pagesfilter_list list[ZeroDteFilter] Filter conditions list Multiple conditions use AND logic. Supports OWNER_LIST, HAS_EARNINGS_THIS_WEEK, VOLUME, OPEN_INTEREST, IV, HV, IV_RANK, IV_PERCENTILE, PRICE, CHANGE_RATIOReturns
Parameter Type Description ret RET_CODE Interface call result data dict When ret == RET_OK, returns a dict containing item_list (DataFrame), next_page (str/None), update_timestamp (float) str When ret != RET_OK, returns error description Return DataFrame fields:
Field Type Description owner str Underlying stock code name str Underlying name price float Underlying current price change_ratio float Price change (percentage) market_cap float Market capitalization iv float Implied volatility (percentage) iv_rank float IV rank (percentage) iv_percentile float IV percentile (percentage) hv float Historical volatility (percentage) volume int Option volume open_interest int Option open interest last_trading_time int Last trading timestamp (Unix seconds) earnings_timestamp int Earnings date timestamp (seconds) earnings_time str Earnings time string earnings_pub_type str Earnings release type (BEFORE/AFTER) chain_info dict Option chain information Used for get_option_zero_dte_contract call
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_zero_dte_screener(
market=OptionMarket.US_SECURITY,
sort_type=ZeroDteSortType.VOLUME,
is_asc=False,
count=5
)
if ret == RET_OK:
print(data['item_list'])
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Output
owner name price change_ratio market_cap iv iv_rank iv_percentile hv volume open_interest last_trading_time earnings_timestamp earnings_time earnings_pub_type chain_info
0 US.SPY 标普500ETF-SPDR 741.75 0.540 7.830717e+11 17.675 27.143 61.111 15.031 14228830 19909256 1781554500 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'SPY', 'multiplier': 100.0, ...}
1 US.QQQ 纳指100ETF-Invesco QQQ Trust 721.34 0.588 4.805349e+11 27.652 62.918 91.269 26.196 8239190 12964422 1781554500 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'QQQ', 'multiplier': 100.0, ...}
2 US.TSLA 特斯拉 406.43 1.823 1.526439e+12 55.053 39.265 64.285 49.359 3623504 7088459 1781553600 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'TSLA', 'multiplier': 100.0, ...}
3 US.NVDA 英伟达 205.19 0.156 4.965598e+12 41.975 27.062 42.460 45.921 3157331 16744961 1781553600 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'NVDA', 'multiplier': 100.0, ...}
4 US.IWM 罗素2000ETF-iShares 292.95 0.874 8.143528e+10 24.857 33.930 64.285 24.802 2840729 11791964 1781554500 N/A N/A N/A {'strike_date_timestamp': 1781499600, 'product_code': 'IWM', 'multiplier': 100.0, ...}
2
3
4
5
6
# Qot_GetOptionZeroDteScreener.proto
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
uint GetOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req); virtual void OnReply_GetOptionZeroDteScreener(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp);
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
int getOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req) onReply_GetOptionZeroDteScreener(MMAPI_Conn client, int nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp)
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
Moomoo::u32_t GetOptionZeroDteScreener(const Qot_GetOptionZeroDteScreener::Request &stReq);
virtual void OnReply_GetOptionZeroDteScreener(Moomoo::u32_t nSerialNo, const Qot_GetOptionZeroDteScreener::Response &stRsp) = 0;
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
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_GetOptionZeroDteScreener::Request req;
Qot_GetOptionZeroDteScreener::C2S *c2s = req.mutable_c2s();
// TODO: populate c2s fields per proto
m_GetOptionZeroDteScreenerSerialNo = m_pQotApi->GetOptionZeroDteScreener(req);
}
virtual void OnReply_GetOptionZeroDteScreener(Moomoo::u32_t nSerialNo, const Qot_GetOptionZeroDteScreener::Response &stRsp) {
if (nSerialNo != m_GetOptionZeroDteScreenerSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetOptionZeroDteScreenerSerialNo = 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
getOptionZeroDteScreener(qotGetOptionZeroDteScreener)
Description
Get zero DTE option underlying screener list
Parameters
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500], default 50
optional string page = 5;
repeated Qot_OptionCommon.ZeroDteIndicator filterList = 6;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
- Returns
message OptionChainInfo {
optional int64 strikeDateTimestamp = 1;
optional string productCode = 2;
optional double multiplier = 3;
optional double contractShareSize = 4;
optional int32 expirationType = 5;
optional Qot_Common.Security underlying = 6;
}
message ZeroDteScreenerItem {
required Qot_Common.Security owner = 1;
optional string name = 2;
optional double price = 3;
optional double changeRate = 4;
optional double marketCap = 5;
optional double iv = 6;
optional double ivRank = 7;
optional double ivPercentile = 8;
optional double hv = 9;
optional int64 volume = 10;
optional int64 openInterest = 11;
optional int64 lastTradingTime = 12;
optional int64 earningsTimestamp = 13;
optional string earningsTime = 14;
optional int32 earningsPubType = 15;
optional OptionChainInfo chainInfo = 16;
}
message S2C {
repeated ZeroDteScreenerItem itemList = 1;
optional string nextPage = 2;
optional double updateTimestamp = 3;
}
message Response
{
required int32 retType = 1 [default = -400]; //RetType, return 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
33
34
35
36
37
38
39
40
41
- Interface call result, structure refer to RetType
Protocol ID
3311
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_OptionCommon } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetOptionZeroDteScreener(){
const { RetType } = Common
const { OptionMarket, ZeroDteSortType } = Qot_OptionCommon
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11112, false, ''];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
optionMarket: OptionMarket.OptionMarket_US_Security,
sortType: ZeroDteSortType.ZeroDteSortType_Volume,
count: 5,
},
};
websocket.GetOptionZeroDteScreener(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetOptionZeroDteScreener: 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);
}
QotGetOptionZeroDteScreener()
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
GetOptionZeroDteScreener: errCode 0, retMsg , retType 0
{
"itemList": [
{
"owner": { "market": 1, "code": "SPY" },
"name": "标普500ETF-SPDR",
"price": 741.75,
"changeRate": 0.54,
"marketCap": 783071700000,
"iv": 17.675,
"ivRank": 27.143,
"ivPercentile": 61.111,
"hv": 15.031,
"volume": 14228830,
"openInterest": 19909256,
"lastTradingTime": 1781554500,
"chainInfo": {
"strikeDateTimestamp": 1781499600,
"productCode": "SPY",
"multiplier": 100,
"contractShareSize": 100
}
},
{
"owner": { "market": 1, "code": "QQQ" },
"name": "纳指100ETF-Invesco QQQ Trust",
"price": 721.34,
"changeRate": 0.588,
"marketCap": 480534900000,
"iv": 27.652,
"ivRank": 62.918,
"ivPercentile": 91.269,
"hv": 26.196,
"volume": 8239190,
"openInterest": 12964422,
"lastTradingTime": 1781554500,
"chainInfo": {
"strikeDateTimestamp": 1781499600,
"productCode": "QQQ",
"multiplier": 100,
"contractShareSize": 100
}
}
],
"updateTimestamp": 1781554500
}
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
Rate Limit
- Maximum 60 requests per 30 seconds (for paginated interfaces, only the first call counts)