# セクター/指数構成銘柄バリュエーションリストの取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_valuation_plate_stock_list(code, valuation_type=None, next_key=None, num=None, sort_type=None, sort_id=None, filter_security=None)
説明
セクターまたは指数の構成銘柄バリュエーションリストを取得します。バリュエーション、予測バリュエーション、過去分位数、時価総額を含みます。指数の初回全量リクエスト時には所属セクターリストも返されます
パラメータ
パラメータ 型 説明 code str セクターまたは指数コード 例:HK.LIST23363(セクター)または HK.800000(指数);個別銘柄は非対応valuation_type ValuationType バリュエーション種別 0=Unknown、1=PE(株価収益率)、2=PB(株価純資産倍率)、3=PS(株価売上高倍率);デフォルト None(1=PE)next_key str ページネーションキー 初回リクエスト時は不要;続拉時は前回返された next_key を指定;"-1" はデータなしを意味するnum int ページサイズ デフォルト 10、範囲 1~50sort_type SortType ソート方向 1=Desc(降順)、2=Asc(昇順);デフォルト None(昇順)sort_id SortField ソート列 51=時価総額(デフォルト)、52=バリュエーション、53=予測バリュエーション、54=過去分位数filter_security str セクターフィルター 指数のみ有効;セクターで構成銘柄を絞り込み、例:HK.LIST23363;省略時はフィルターなし戻り値
パラメータ 型 説明 ret RET_CODE API 呼び出し結果 data dict ret == RET_OK の場合、構成銘柄バリュエーションデータの辞書を返す str ret != RET_OK の場合、エラーの説明を返す 返される辞書には以下のフィールドが含まれます:
フィールド 型 説明 count int 構成銘柄総数 stock_list list 構成銘柄バリュエーションリスト;各項目は stock_list フィールド表参照 next_key str ページネーションキー "-1" はデータなしを意味するplate_list list 所属セクターリスト 指数の初回全量リクエスト時のみ返される;各項目は plate_list フィールド表参照stock_list フィールド(構成銘柄バリュエーション項目):
フィールド 型 説明 symbol str 銘柄コード valuation_val float バリュエーション forward_value float 予測バリュエーション 現在 PE と PS のみ対応valuation_percentile float 過去分位数 百分号前の値、例:12.34 は 12.34% を意味するmarket_cap float 時価総額 name str 銘柄名 plate_list フィールド(指数所属セクター項目):
フィールド 型 説明 symbol str セクターコード name str セクター名
Example
from futu import *
import pandas as pd
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_valuation_plate_stock_list("HK.LIST23363")
if ret == RET_OK:
df = pd.DataFrame(data.get('stock_list', []))
print(df.to_string(index=False))
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
symbol name valuation_val valuation_percentile market_cap
HK.08076 SING LEE -2.300 65.337673 3.029652e+07
HK.08092 ITE HOLDINGS 19.500 98.209927 3.609481e+07
HK.08036 EBROKER GROUP -12.000 35.313263 4.428000e+07
HK.01561 PAN ASIA DATA H -23.500 1.057770 5.007634e+07
HK.08071 CH NETCOMTECH -13.000 31.489015 6.091863e+07
HK.00248 HKC INT'L HOLD -2.056 19.446705 6.771489e+07
HK.01613 SYNERTONE -2.796 72.660700 8.841764e+07
HK.08062 EFT SOLUTIONS -93.333 0.244101 1.344000e+08
HK.01949 PLATT NERA -5.147 36.523929 1.344000e+08
HK.01206 TECHNOVATOR -0.314 41.171684 1.720823e+08
2
3
4
5
6
7
8
9
10
11
# Qot_GetValuationPlateStockList.proto
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- バリュエーション種別については ValuationType を参照
- ソート方向については SortType を参照
- ソート列については SortField を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
プロトコル ID
3233
uint GetValuationPlateStockList(QotGetValuationPlateStockList.Request req);
virtual void OnReply_GetValuationPlateStockList(FTAPI_Conn client, uint nSerialNo, QotGetValuationPlateStockList.Response rsp);
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
public class Program : FTSPI_Qot, FTSPI_Conn
{
FTAPI_Qot qot = new FTAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(FTAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("LIST23363")
.Build();
QotGetValuationPlateStockList.C2S c2s = QotGetValuationPlateStockList.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetValuationPlateStockList.Request req = QotGetValuationPlateStockList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetValuationPlateStockList(req);
Console.Write("Send QotGetValuationPlateStockList: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetValuationPlateStockList(FTAPI_Conn client, uint nSerialNo, QotGetValuationPlateStockList.Response rsp)
{
Console.Write("Reply: QotGetValuationPlateStockList: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
FTAPI.Init();
Program qot = new Program();
qot.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
count: 69
stockList {
security {
market: 1
code: "08076"
}
valuationVal: -2.3
valuationPercentile: 65.3658536
marketCap: 30296520
name: "SING LEE"
}
stockList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int getValuationPlateStockList(QotGetValuationPlateStockList.Request req);
void onReply_GetValuationPlateStockList(FTAPI_Conn client, int nSerialNo, QotGetValuationPlateStockList.Response rsp);
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
public class QotDemo implements FTSPI_Qot, FTSPI_Conn {
FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("LIST23363")
.build();
QotGetValuationPlateStockList.C2S c2s = QotGetValuationPlateStockList.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetValuationPlateStockList.Request req = QotGetValuationPlateStockList.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getValuationPlateStockList(req);
System.out.printf("Send QotGetValuationPlateStockList: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetValuationPlateStockList(FTAPI_Conn client, int nSerialNo, QotGetValuationPlateStockList.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetValuationPlateStockList failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetValuationPlateStockList: %s\n", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
FTAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
- Output
Qot onInitConnect: ret=0 desc= connID=7459212604361842573
Send Qot_GetValuationPlateStockList: 2
Receive Qot_GetValuationPlateStockList: retType: 0
retMsg: ""
errCode: 0
s2c {
count: 69
stockList {
security {
market: 1
code: "08076"
}
valuationVal: -2.3
valuationPercentile: 65.3658536
marketCap: 3.029652E7
name: "SING LEE"
}
stockList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Futu::u32_t GetValuationPlateStockList(const Qot_GetValuationPlateStockList::Request &stReq);
virtual void OnReply_GetValuationPlateStockList(Futu::u32_t nSerialNo, const Qot_GetValuationPlateStockList::Response &stRsp) = 0;
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
class Program : public FTSPI_Qot, public FTSPI_Trd, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetValuationPlateStockList::Request req;
Qot_GetValuationPlateStockList::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("LIST23363");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetValuationPlateStockList(req);
cout << "GetValuationPlateStockList" << endl;
}
virtual void OnReply_GetValuationPlateStockList(Futu::u32_t nSerialNo, const Qot_GetValuationPlateStockList::Response &stRsp){
cout << "OnReply_GetValuationPlateStockList:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
FTAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
FTAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetValuationPlateStockList seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
count: 69
stockList {
security {
market: 1
code: "08076"
}
valuationVal: -2.3
valuationPercentile: 65.3658536
marketCap: 30296520
name: "SING LEE"
}
stockList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
GetValuationPlateStockList(req);
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetValuationPlateStockList(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_HK_Security,
code: "LIST23363",
},
},
};
websocket.GetValuationPlateStockList(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetValuationPlateStockList: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(data);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- Output
GetValuationPlateStockList: errCode 0, retMsg , retType 0
{
"count": 69,
"stockList": [{
"security": {
"market": 1,
"code": "08076"
},
"valuationVal": -2.3,
"valuationPercentile": 65.3376729,
"marketCap": 30296520,
"name": "SING LEE"
//...
}],
"nextKey": "10"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
API 制限
- 30 秒以内に最大 30 回リクエスト可能。
- セクターと指数をサポート;個別銘柄は非対応。
- 指数の初回全量リクエスト時には所属セクターリスト(plate_list)も返されます。
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_valuation_plate_stock_list(code, valuation_type=None, next_key=None, num=None, sort_type=None, sort_id=None, filter_security=None)
説明
セクターまたは指数の構成銘柄バリュエーションリストを取得します。バリュエーション、予測バリュエーション、過去分位数、時価総額を含みます。指数の初回全量リクエスト時には所属セクターリストも返されます
パラメータ
パラメータ 型 説明 code str セクターまたは指数コード 例:HK.LIST23363(セクター)または HK.800000(指数);個別銘柄は非対応valuation_type ValuationType バリュエーション種別 0=Unknown、1=PE(株価収益率)、2=PB(株価純資産倍率)、3=PS(株価売上高倍率);デフォルト None(1=PE)next_key str ページネーションキー 初回リクエスト時は不要;続拉時は前回返された next_key を指定;"-1" はデータなしを意味するnum int ページサイズ デフォルト 10、範囲 1~50sort_type SortType ソート方向 1=Desc(降順)、2=Asc(昇順);デフォルト None(昇順)sort_id SortField ソート列 51=時価総額(デフォルト)、52=バリュエーション、53=予測バリュエーション、54=過去分位数filter_security str セクターフィルター 指数のみ有効;セクターで構成銘柄を絞り込み、例:HK.LIST23363;省略時はフィルターなし戻り値
パラメータ 型 説明 ret RET_CODE API 呼び出し結果 data dict ret == RET_OK の場合、構成銘柄バリュエーションデータの辞書を返す str ret != RET_OK の場合、エラーの説明を返す 返される辞書には以下のフィールドが含まれます:
フィールド 型 説明 count int 構成銘柄総数 stock_list list 構成銘柄バリュエーションリスト;各項目は stock_list フィールド表参照 next_key str ページネーションキー "-1" はデータなしを意味するplate_list list 所属セクターリスト 指数の初回全量リクエスト時のみ返される;各項目は plate_list フィールド表参照stock_list フィールド(構成銘柄バリュエーション項目):
フィールド 型 説明 symbol str 銘柄コード valuation_val float バリュエーション forward_value float 予測バリュエーション 現在 PE と PS のみ対応valuation_percentile float 過去分位数 百分号前の値、例:12.34 は 12.34% を意味するmarket_cap float 時価総額 name str 銘柄名 plate_list フィールド(指数所属セクター項目):
フィールド 型 説明 symbol str セクターコード name str セクター名
Example
from moomoo import *
import pandas as pd
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_valuation_plate_stock_list("HK.LIST23363")
if ret == RET_OK:
df = pd.DataFrame(data.get('stock_list', []))
print(df.to_string(index=False))
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
- Output
symbol name valuation_val valuation_percentile market_cap
HK.08076 SING LEE -2.300 65.337673 3.029652e+07
HK.08092 ITE HOLDINGS 19.500 98.209927 3.609481e+07
HK.08036 EBROKER GROUP -12.000 35.313263 4.428000e+07
HK.01561 PAN ASIA DATA H -23.500 1.057770 5.007634e+07
HK.08071 CH NETCOMTECH -13.000 31.489015 6.091863e+07
HK.00248 HKC INT'L HOLD -2.056 19.446705 6.771489e+07
HK.01613 SYNERTONE -2.796 72.660700 8.841764e+07
HK.08062 EFT SOLUTIONS -93.333 0.244101 1.344000e+08
HK.01949 PLATT NERA -5.147 36.523929 1.344000e+08
HK.01206 TECHNOVATOR -0.314 41.171684 1.720823e+08
2
3
4
5
6
7
8
9
10
11
# Qot_GetValuationPlateStockList.proto
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- バリュエーション種別については ValuationType を参照
- ソート方向については SortType を参照
- ソート列については SortField を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
プロトコル ID
3233
uint GetValuationPlateStockList(QotGetValuationPlateStockList.Request req);
virtual void OnReply_GetValuationPlateStockList(MMAPI_Conn client, uint nSerialNo, QotGetValuationPlateStockList.Response rsp);
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
public class Program : MMSPI_Qot, MMSPI_Conn
{
MMAPI_Qot qot = new MMAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(MMAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("LIST23363")
.Build();
QotGetValuationPlateStockList.C2S c2s = QotGetValuationPlateStockList.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetValuationPlateStockList.Request req = QotGetValuationPlateStockList.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetValuationPlateStockList(req);
Console.Write("Send QotGetValuationPlateStockList: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetValuationPlateStockList(MMAPI_Conn client, uint nSerialNo, QotGetValuationPlateStockList.Response rsp)
{
Console.Write("Reply: QotGetValuationPlateStockList: {0} {1}\n", nSerialNo, rsp.ToString());
}
public static void Main(String[] args)
{
MMAPI.Init();
Program qot = new Program();
qot.Start();
while (true)
Thread.Sleep(1000 * 600);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- Output
sent seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
count: 69
stockList {
security {
market: 1
code: "08076"
}
valuationVal: -2.3
valuationPercentile: 65.3658536
marketCap: 30296520
name: "SING LEE"
}
stockList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int getValuationPlateStockList(QotGetValuationPlateStockList.Request req);
void onReply_GetValuationPlateStockList(MMAPI_Conn client, int nSerialNo, QotGetValuationPlateStockList.Response rsp);
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
public class QotDemo implements MMSPI_Qot, MMSPI_Conn {
MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("LIST23363")
.build();
QotGetValuationPlateStockList.C2S c2s = QotGetValuationPlateStockList.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetValuationPlateStockList.Request req = QotGetValuationPlateStockList.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getValuationPlateStockList(req);
System.out.printf("Send QotGetValuationPlateStockList: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetValuationPlateStockList(MMAPI_Conn client, int nSerialNo, QotGetValuationPlateStockList.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetValuationPlateStockList failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetValuationPlateStockList: %s\n", json);
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
MMAPI.init();
QotDemo qot = new QotDemo();
qot.start();
while (true) {
try {
Thread.sleep(1000 * 600);
} catch (InterruptedException exc) {
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
- Output
Qot onInitConnect: ret=0 desc= connID=7459212604361842573
Send Qot_GetValuationPlateStockList: 2
Receive Qot_GetValuationPlateStockList: retType: 0
retMsg: ""
errCode: 0
s2c {
count: 69
stockList {
security {
market: 1
code: "08076"
}
valuationVal: -2.3
valuationPercentile: 65.3658536
marketCap: 3.029652E7
name: "SING LEE"
}
stockList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
moomoo::u32_t GetValuationPlateStockList(const Qot_GetValuationPlateStockList::Request &stReq);
virtual void OnReply_GetValuationPlateStockList(moomoo::u32_t nSerialNo, const Qot_GetValuationPlateStockList::Response &stRsp) = 0;
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
class Program : public MMSPI_Qot, public MMSPI_Trd, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, moomoo::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetValuationPlateStockList::Request req;
Qot_GetValuationPlateStockList::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("LIST23363");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetValuationPlateStockList(req);
cout << "GetValuationPlateStockList" << endl;
}
virtual void OnReply_GetValuationPlateStockList(moomoo::u32_t nSerialNo, const Qot_GetValuationPlateStockList::Response &stRsp){
cout << "OnReply_GetValuationPlateStockList:" << endl;
// print response
// ProtoBufToBodyData and UTF8ToLocal refer to tool.h in Samples
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
};
int32_t main(int32_t argc, char** argv)
{
MMAPI::Init();
{
Program program;
program.Start();
getchar();
}
protobuf::ShutdownProtobufLibrary();
MMAPI::UnInit();
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- Output
onInitConnect: ret=0 desc=Succeed!
Send Qot_GetValuationPlateStockList seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
count: 69
stockList {
security {
market: 1
code: "08076"
}
valuationVal: -2.3
valuationPercentile: 65.3658536
marketCap: 30296520
name: "SING LEE"
}
stockList {
//...
}
nextKey: "10"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
GetValuationPlateStockList(req);
説明
セクター/指数構成銘柄のバリュエーションリストを取得します
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄(セクターまたは指数)
optional Qot_Common.ValuationType valuationType = 2; // バリュエーション種別、Qot_Common.ValuationType 参照、1-3 をサポート、デフォルト 1(PE)
optional string nextKey = 3; // ページネーションキー;初回は省略、続拉時は前回返された nextKey を指定;"-1" はデータなし
optional int32 num = 4; // ページサイズ、デフォルト 10、範囲 1~50
optional Qot_Common.SortType sortType = 5; // ソート方向、Qot_Common.SortType 参照、デフォルト昇順(SortType_Asc=2)
optional Qot_Common.SortField sortId = 6; // ソート列、Qot_Common.SortField 参照:51=時価総額(デフォルト)52=バリュエーション 53=予測バリュエーション 54=過去分位数
optional Qot_Common.Security filterSecurity = 7; // セクターフィルター;指数のみ有効、セクターで構成銘柄を絞り込み;省略時はフィルターなし
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Security 構造については Security を参照
- 戻り値
// 指数所属セクター項目
message PlateItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // セクター名
}
// 構成銘柄バリュエーション項目
message StockItem
{
optional Qot_Common.Security security = 1; // 銘柄
optional string name = 6; // 銘柄名
optional double valuationVal = 2; // バリュエーション
optional double forwardValue = 3; // 予測バリュエーション、PE と PS のみ
optional double valuationPercentile = 4; // バリュエーション過去分位数、百分号前の値、例:12.34 は 12.34% を意味する
optional double marketCap = 5; // 時価総額
}
message S2C
{
optional int32 count = 1; // 構成銘柄総数
repeated StockItem stockList = 2; // 構成銘柄バリュエーションリスト
optional string nextKey = 3; // ページネーションキー、"-1" はデータなし
repeated PlateItem plateList = 4; // 指数所属業種/セクターリスト;指数の全板初回リクエスト時のみ返される
}
message Response
{
required int32 retType = 1 [default = -400]; // 戻り結果、Common.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
- API 呼び出し結果については RetType を参照
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetValuationPlateStockList(){
const { RetType } = Common
const { QotMarket } = Qot_Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 33333, false, '7522027ccf5a06b1'];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: {
security: {
market: QotMarket.QotMarket_HK_Security,
code: "LIST23363",
},
},
};
websocket.GetValuationPlateStockList(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetValuationPlateStockList: errCode %d, retMsg %s, retType %d", errCode, retMsg, retType);
if(retType == RetType.RetType_Succeed){
let data = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(data);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
setTimeout(()=>{
websocket.stop();
console.log("stop");
}, 5000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- Output
GetValuationPlateStockList: errCode 0, retMsg , retType 0
{
"count": 69,
"stockList": [{
"security": {
"market": 1,
"code": "08076"
},
"valuationVal": -2.3,
"valuationPercentile": 65.3376729,
"marketCap": 30296520,
"name": "SING LEE"
//...
}],
"nextKey": "10"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
API 制限
- 30 秒以内に最大 30 回リクエスト可能。
- セクターと指数をサポート;個別銘柄は非対応。
- 指数の初回全量リクエスト時には所属セクターリスト(plate_list)も返されます。
← バリュエーション詳細の取得 配当情報の取得 →