# ワラントスクリーニング V2
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_warrant_screen(request)
説明
ワラントスクリーニング V2。旧 API get_warrant と比較して、43 列のワラント属性を返却し、香港 / シンガポール / マレーシア市場をサポートします。総数のみ返却(only_count)にも対応。すべての数値フィールドは原始値を直接渡し、OpenD 内部で倍率変換を行います。
パラメータ
パラメータ タイプ 説明 request WarrantScreenRequest ワラントスクリーニングリクエストオブジェクト、構築時に warrant_market 必須 WarrantScreenRequest フィールド:
フィールド タイプ 説明 warrant_market WarrantMarket 市場 HK=1、SG=4、MY=15is_delay bool 遅延相場を使用するか デフォルトは Falseonly_count bool 総数のみ返却するか(明細を返さない) デフォルトは False;True の場合は all_count のみ埋まり、DataFrame は空page_from int ページング開始位置 デフォルトは 0page_count int 1 ページあたりの最大返却件数 デフォルトは 200フィルタ条件 builder メソッド(呼び出すごとにフィルタ条件を 1 件追加):
メソッド 説明 add_interval_filter(field_id, min_val=None, max_val=None, min_included=True, max_included=True) 区間フィルタ field_id は WarrantField から取得;min_val / max_val は原始値を直接渡す(OpenD が自動的に倍率変換、例えば現在値 5 元は 5.0、ストリート比率 50% は 50.0、実効レバレッジ > 3 は 3.0)。min_val / max_val はいずれも任意、両方とも未指定の場合この条件は無効(フィルタ未適用と同じ)add_choice_filter(field_id, choices) 選択肢フィルタ choices の要素は int 列挙または str コード可、例えば STOCK_OWNER フィールドには ["HK.00700"]、WARRANT_TYPE には [WarrantType.CALL, WarrantType.PUT] を渡せるadd_sort(field_id, desc=False) ソート desc=True で降順、デフォルト昇順よく使う WarrantField field_id(完全なリストは WarrantField を参照):
field_id 意味 フィルタ方式 4 ISSUER_ID 発行体 ID choice 5 STOCK_OWNER 原株 choice ["HK.00700"] のような code 文字列を渡せる6 WARRANT_TYPE ワラントタイプ choice 1=コール、2=プット、3=ブル証、4=ベア証、5=インライン証;詳細は WarrantType8 CURRENT_PRICE 現在値 interval 9 STREET_RATIO ストリート比率 interval 10 VOLUME 出来高 interval 16 LEVERAGE_RATIO レバレッジ比率 interval 19 STATUS ステータス choice 0=正常、1=取引終了、2=上場待ち;詳細は WarrantStatus23 EFFECTIVE_LEVERAGE 実効レバレッジ interval
戻り値
パラメータ タイプ 説明 ret RET_CODE API 呼び出し結果 data tuple ret == RET_OK のとき、(last_page, all_count, DataFrame) を返す str ret != RET_OK のとき、エラー記述を返す 戻り値 DataFrame フィールド(計 43 列):
フィールド タイプ 説明 stock_id int ワラント銘柄 ID stock_owner int 所属原株 ID issuer_id int 発行体 ID warrant_type int ワラントタイプ 1=コール、2=プット、3=ブル証、4=ベア証、5=インライン証strike_price float 権利行使価格 maturity_date str 満期日 last_trade_date str 最終取引日 conversion_ratio float 転換比率 last_close_price float 前日終値 recovery_price float コールバック価格(ブル/ベア証のみ) stock_owner_price float 原株価格 current_price float 現在値 volume int 出来高 turnover float 売買代金 sell_vol int 売り数量 buy_vol int 買い数量 sell_price float 売り気配値 buy_price float 買い気配値 street_rate float ストリート比率 high_price float 高値 low_price float 安値 implied_volatility float インプライド・ボラティリティ(コール/プットのみ) delta float ヘッジ値(コール/プットのみ) status int ワラントステータス 0=正常、1=取引終了、2=上場待ちstreet_rate_new float ストリート比率(新) score float 総合スコア premium float プレミアム leverage float レバレッジ effective_leverage float 実効レバレッジ break_even_point float 損益分岐点 ipop float イン・ザ・マネー/アウト・オブ・ザ・マネー amplitude float 振幅 fx_score float ソシエテ・ジェネラルスコア ipo_time str 上場日時 street_vol int ストリート出来高 lot_size int 単元株数 issue_size int 発行量 ipo_price float 発行価格 upper_strike_price float 上限価格(インライン証のみ) lower_strike_price float 下限価格(インライン証のみ) iw_price_status int インライン/アウトオブライン sensitivity float 感応度 price_recovery_ratio float 原株からコールバック価格までの距離(ブル/ベア証のみ)
Example
from futu import (
OpenQuoteContext, RET_OK, WarrantScreenRequest,
WarrantMarket, WarrantField, WarrantType,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# 例 1:香港株の低価格・高レバレッジコール / プット
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.CALL, WarrantType.PUT]) # コール + プット
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE,
min_val=0.1, max_val=5.0) # 現在値 0.1~5
req.add_interval_filter(field_id=WarrantField.EFFECTIVE_LEVERAGE,
min_val=3.0) # 実効レバレッジ > 3
req.add_interval_filter(field_id=WarrantField.STREET_RATIO, max_val=50.0) # ストリート比率 < 50%
req.add_sort(field_id=WarrantField.VOLUME, desc=True) # 出来高降順
req.page_count = 20
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['stock_id', 'warrant_type', 'current_price', 'effective_leverage']].head())
else:
print('error: ', data)
# 例 2:条件を満たす総数のみを取得
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.only_count = True
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE, choices=[WarrantType.CALL])
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE, min_val=1.0)
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
_, all_count, _ = data
print(f"条件を満たすコールの総数:{all_count}")
# 例 3:原株コードでフィルタ(choice に code 文字列を直接渡す)
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.STOCK_OWNER, choices=["HK.00700"])
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.BULL, WarrantType.BEAR]) # ブル証 + ベア証
req.add_sort(field_id=WarrantField.TURNOVER, desc=True)
req.page_count = 50
ret, data = quote_ctx.get_warrant_screen(req)
quote_ctx.close()
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
- Output
stock_id warrant_type current_price effective_leverage
0 87930865475960 1 0.107 4.337
1 87939455410698 1 0.108 4.307
2 88231513189723 1 0.120 4.996
3 87969520182112 1 0.110 3.604
4 88356067241952 1 0.127 6.827
条件を満たすコールの総数:98
2
3
4
5
6
7
# Qot_WarrantScreen.proto
説明
ワラントスクリーニング V2
パラメータ
message Boundary
{
required double value = 1;
optional bool includes = 2; // 閉区間か否か、デフォルト true
}
message Interval
{
optional Boundary filterMin = 1;
optional Boundary filterMax = 2;
}
message Choice
{
required int32 contentType = 1; // 1=数値, 2=テキスト
optional string text = 2;
optional int64 value = 3;
}
// 1 つのフィルタ条件:interval / choices いずれか 1 つ
message ScreenGroup
{
required int32 fieldId = 1; // WarrantField 列挙
optional Interval interval = 2; // 区間フィルタ
repeated Choice choices = 3; // 選択肢フィルタ
}
message Sort
{
required int32 sortFieldId = 1;
required int32 direction = 2; // 0=昇順, 1=降順
}
message C2S
{
required int32 marketType = 1; // 市場、HK=1、SG=4、MY=15
optional bool isDelay = 2;
repeated ScreenGroup filterList = 3;
repeated Sort sortList = 4;
optional bool onlyCount = 5; // 総数のみ返却
optional int32 pageFrom = 6;
optional int32 pageCount = 7;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- 戻り値
message WarrantItem
{
optional int64 stockId = 1;
optional int64 stockOwner = 2;
optional int32 issuerId = 3;
optional int32 warrantType = 4; // 1=コール,2=プット,3=ブル証,4=ベア証,5=インライン証
optional double strikePrice = 5;
optional string maturityDate = 6;
optional string lastTradeDate = 7;
optional double conversionRatio = 8;
optional double lastclosePrice = 9;
optional double recoveryPrice = 10;
optional double stockOwnerPrice = 11;
optional double currentPrice = 12;
optional int64 volume = 13;
optional double turnover = 14;
optional int64 sellVol = 15;
optional int64 buyVol = 16;
optional double sellPrice = 17;
optional double buyPrice = 18;
optional double streetRate = 19;
optional double highPrice = 20;
optional double lowPrice = 21;
optional double impliedVolatility = 22;
optional double delta = 23;
optional int32 status = 24;
optional double streetRateNew = 25;
optional double score = 26;
optional double premium = 27;
optional double leverage = 28;
optional double effectiveLeverage = 29;
optional double breakEvenPoint = 30;
optional double ipop = 31;
optional double amplitude = 32;
optional double fxScore = 33;
optional string ipoTime = 34;
optional int64 streetVol = 35;
optional int32 lotSize = 36;
optional int64 issueSize = 37;
optional double ipoPrice = 38;
optional double upperStrikePrice = 39;
optional double lowerStrikePrice = 40;
optional int32 iwPriceStatus = 41;
optional double sensitivity = 42;
optional double priceRecoveryRatio = 43;
}
message S2C
{
required bool lastPage = 1;
required int32 allCount = 2;
repeated WarrantItem warrants = 3;
}
message Response
{
required int32 retType = 1 [default = -400];
optional string retMsg = 2;
optional int32 errCode = 3;
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- API 呼び出し結果、構造は RetType を参照
プロトコル ID
3254
uint WarrantScreen(QotWarrantScreen.Request req); virtual void OnReply_WarrantScreen(FTAPI_Conn client, uint nSerialNo, QotWarrantScreen.Response rsp);
説明
ワラントスクリーニング V2
パラメータ
Proto タブの Qot_WarrantScreen.proto のリクエスト構造を参照。
戻り値
Proto タブの Qot_WarrantScreen.proto のレスポンス構造を参照。
プロトコル ID
3254
int warrantScreen(QotWarrantScreen.Request req) onReply_WarrantScreen(FTAPI_Conn client, int nSerialNo, QotWarrantScreen.Response rsp)
説明
ワラントスクリーニング V2
パラメータ
Proto タブの Qot_WarrantScreen.proto のリクエスト構造を参照。
戻り値
Proto タブの Qot_WarrantScreen.proto のレスポンス構造を参照。
プロトコル ID
3254
bool WarrantScreen(uint32_t & nSerialNo, const Qot_WarrantScreen::Request & stReq); virtual void OnReply_WarrantScreen(FTAPI_Conn* pConn, uint32_t nSerialNo, const Qot_WarrantScreen::Response & stRsp)
説明
ワラントスクリーニング V2
パラメータ
Proto タブの Qot_WarrantScreen.proto のリクエスト構造を参照。
戻り値
Proto タブの Qot_WarrantScreen.proto のレスポンス構造を参照。
プロトコル ID
3254
warrantScreen(qotWarrantScreen)
説明
ワラントスクリーニング V2
パラメータ
Proto タブの Qot_WarrantScreen.proto のリクエスト構造を参照。
戻り値
Proto タブの Qot_WarrantScreen.proto のレスポンス構造を参照。
プロトコル ID
3254
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_warrant_screen(request)
説明
ワラントスクリーニング V2、パラメータと戻り値フィールドは nn タブと同じ。
Example
from moomoo import (
OpenQuoteContext, RET_OK, WarrantScreenRequest,
WarrantMarket, WarrantField, WarrantType,
)
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
req = WarrantScreenRequest(warrant_market=WarrantMarket.HK)
req.add_choice_filter(field_id=WarrantField.WARRANT_TYPE,
choices=[WarrantType.CALL, WarrantType.PUT])
req.add_interval_filter(field_id=WarrantField.CURRENT_PRICE,
min_val=0.1, max_val=5.0)
req.add_interval_filter(field_id=WarrantField.EFFECTIVE_LEVERAGE, min_val=3.0)
req.add_sort(field_id=WarrantField.VOLUME, desc=True)
req.page_count = 20
ret, data = quote_ctx.get_warrant_screen(req)
if ret == RET_OK:
last_page, all_count, df = data
print(df[['stock_id', 'warrant_type', 'current_price', 'effective_leverage']].head())
else:
print('error: ', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Qot_WarrantScreen.proto
nn タブの Proto 内容を参照、プロトコル ID 3254。
uint WarrantScreen(QotWarrantScreen.Request req); virtual void OnReply_WarrantScreen(FTAPI_Conn client, uint nSerialNo, QotWarrantScreen.Response rsp);
nn タブの Proto 内容を参照、プロトコル ID 3254。
int warrantScreen(QotWarrantScreen.Request req) onReply_WarrantScreen(FTAPI_Conn client, int nSerialNo, QotWarrantScreen.Response rsp)
nn タブの Proto 内容を参照、プロトコル ID 3254。
bool WarrantScreen(uint32_t & nSerialNo, const Qot_WarrantScreen::Request & stReq); virtual void OnReply_WarrantScreen(FTAPI_Conn* pConn, uint32_t nSerialNo, const Qot_WarrantScreen::Response & stRsp)
nn タブの Proto 内容を参照、プロトコル ID 3254。
warrantScreen(qotWarrantScreen)
nn タブの Proto 内容を参照、プロトコル ID 3254。