# ゼロDTEオプションスクリーナー
- 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)
説明
ゼロDTEオプション原資産スクリーニングリストを取得します。当日満期(0DTE)オプションに対応する原資産銘柄情報を返し、ボラティリティ、オプション出来高、建玉およびオプションチェーン情報等のデータを含みます。
パラメータ
パラメータ 型 説明 market OptionMarket オプション市場タイプ US_SECURITY=米国株式オプション、US_INDEX=米国指数オプション(米国市場のみ対応)sort_type ZeroDteSortType ソートタイプ VOLUME=オプション出来高、IV=インプライドボラティリティ、CHANGE_RATIO=騰落率、OPEN_INTEREST=建玉、MARKET_CAP=時価総額is_asc bool 昇順かどうか デフォルト False(降順)count int ページあたりの数量 範囲 [1,500]、デフォルト 50page str ページングカーソル 初回は空または未指定、ページングは next_page を渡すfilter_list list[ZeroDteFilter] フィルタ条件リスト 複数条件は AND 関係。OWNER_LIST、HAS_EARNINGS_THIS_WEEK、VOLUME、OPEN_INTEREST、IV、HV、IV_RANK、IV_PERCENTILE、PRICE、CHANGE_RATIO に対応戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data dict ret == RET_OK の場合、辞書を返す。item_list(DataFrame)、next_page(str/None)、update_timestamp(float)を含む str ret != RET_OK の場合、エラー説明を返す 戻り DataFrame フィールド:
フィールド 型 説明 owner str 原資産銘柄コード name str 原資産名称 price float 原資産現在価格 change_ratio float 騰落率(パーセント) market_cap float 時価総額 iv float インプライドボラティリティ(パーセント) iv_rank float IV ランク(パーセント) iv_percentile float IV パーセンタイル(パーセント) hv float ヒストリカルボラティリティ(パーセント) volume int オプション出来高 open_interest int オプション建玉 last_trading_time int 最終取引タイムスタンプ(Unix 秒) earnings_timestamp int 決算日タイムスタンプ(秒) earnings_time str 決算日時間文字列 earnings_pub_type str 決算発表タイプ(BEFORE/AFTER) chain_info dict オプションチェーン情報 get_option_zero_dte_contract 呼び出し用
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
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3311
uint GetOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req); virtual void OnReply_GetOptionZeroDteScreener(FTAPI_Conn client, uint nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp);
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3311
int getOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req) onReply_GetOptionZeroDteScreener(FTAPI_Conn client, int nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp)
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル 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;
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル 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: 按 proto 填充 c2s 字段
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)
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル 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
インターフェース制限
- 30秒以内に最大60回のゼロDTEオプションスクリーナーインターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)
- 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)
説明
ゼロDTEオプション原資産スクリーニングリストを取得します。当日満期(0DTE)オプションに対応する原資産銘柄情報を返し、ボラティリティ、オプション出来高、建玉およびオプションチェーン情報等のデータを含みます。
パラメータ
パラメータ 型 説明 market OptionMarket オプション市場タイプ US_SECURITY=米国株式オプション、US_INDEX=米国指数オプション(米国市場のみ対応)sort_type ZeroDteSortType ソートタイプ VOLUME=オプション出来高、IV=インプライドボラティリティ、CHANGE_RATIO=騰落率、OPEN_INTEREST=建玉、MARKET_CAP=時価総額is_asc bool 昇順かどうか デフォルト False(降順)count int ページあたりの数量 範囲 [1,500]、デフォルト 50page str ページングカーソル 初回は空または未指定、ページングは next_page を渡すfilter_list list[ZeroDteFilter] フィルタ条件リスト 複数条件は AND 関係。OWNER_LIST、HAS_EARNINGS_THIS_WEEK、VOLUME、OPEN_INTEREST、IV、HV、IV_RANK、IV_PERCENTILE、PRICE、CHANGE_RATIO に対応戻り値
パラメータ 型 説明 ret RET_CODE インターフェース呼び出し結果 data dict ret == RET_OK の場合、辞書を返す。item_list(DataFrame)、next_page(str/None)、update_timestamp(float)を含む str ret != RET_OK の場合、エラー説明を返す 戻り DataFrame フィールド:
フィールド 型 説明 owner str 原資産銘柄コード name str 原資産名称 price float 原資産現在価格 change_ratio float 騰落率(パーセント) market_cap float 時価総額 iv float インプライドボラティリティ(パーセント) iv_rank float IV ランク(パーセント) iv_percentile float IV パーセンタイル(パーセント) hv float ヒストリカルボラティリティ(パーセント) volume int オプション出来高 open_interest int オプション建玉 last_trading_time int 最終取引タイムスタンプ(Unix 秒) earnings_timestamp int 決算日タイムスタンプ(秒) earnings_time str 決算日時間文字列 earnings_pub_type str 決算発表タイプ(BEFORE/AFTER) chain_info dict オプションチェーン情報 get_option_zero_dte_contract 呼び出し用
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
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3311
uint GetOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req); virtual void OnReply_GetOptionZeroDteScreener(MMAPI_Conn client, uint nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp);
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル ID
3311
int getOptionZeroDteScreener(Qot_GetOptionZeroDteScreener.Request req) onReply_GetOptionZeroDteScreener(MMAPI_Conn client, int nSerialNo, Qot_GetOptionZeroDteScreener.Response rsp)
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル 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;
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル 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: 按 proto 填充 c2s 字段
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)
説明
ゼロDTEオプション原資産スクリーニングリストを取得
パラメータ
message C2S {
required int32 optionMarket = 1;
optional int32 sortType = 2; //ZeroDteSortType
optional bool isAsc = 3;
optional int32 count = 4; //[1,500]、デフォルト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
- 戻り値
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、戻り結果
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
- インターフェース呼び出し結果、構造は RetType を参照
プロトコル 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
インターフェース制限
- 30秒以内に最大60回のゼロDTEオプションスクリーナーインターフェースリクエスト(ページング対応のインターフェースは初回呼び出しのみカウント)