# 十大ブローカー売買データの取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_top_ten_buy_sell_brokers(code, days_before=None)
説明
指定した香港株の十大ネット買いおよびネット売りブローカーリストを取得します(リアルタイムまたは履歴)
パラメータ
パラメータ 型 説明 code str 銘柄コード 香港株(普通株およびファンド)のみ対応、例:HK.00700days_before int 履歴日数 未指定または 0=リアルタイムデータ(平均価格/総出来高/総売買代金を含む)、>0=N 営業日前の履歴データ(ネット出来高とブローカー名のみ)戻り値
パラメータ 型 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、ブローカーデータの DataFrame を返す str ret != RET_OK の場合、エラー説明を返す DataFrame フィールド:
フィールド 型 説明 is_real_time bool リアルタイムデータかどうか true=リアルタイム、false=履歴data_time int データ更新タイムスタンプ(秒単位 Unix タイムスタンプ) data_time_str str データ更新時刻文字列 形式 YYYY-MM-DD HH:MM:SS、市場のタイムゾーンnet_vol int ネット売買出来高 ネット買いは正値、ネット売りは負値broker_name str ブローカー表示名 リアルタイムは証券会社プロファイルから取得、履歴はレスポンス名を使用buy_sell_type BuySellType 売買種別 avg_price float 平均取引価格 リアルタイムデータのみ有効total_vol float 総取引出来高 リアルタイムデータのみ有効total_turnover float 総売買代金 リアルタイムデータのみ有効
BuySellType 列挙
列挙名 値 説明 Unknown 0 不明 NetBuy 1 ネット買い NetSell 2 ネット売り Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_top_ten_buy_sell_brokers("HK.00700")
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
- Output
net_vol is_real_time buy_sell_type ... avg_price total_vol total_turnover
0 99200 True 1 ... 466.852156 398800.0 186180640.0
1 46500 True 1 ... 466.508972 61300.0 28597000.0
2 45400 True 1 ... 466.224332 67400.0 31423520.0
3 36000 True 1 ... 467.343428 240400.0 112349360.0
4 31300 True 1 ... 466.900580 155100.0 72416280.0
5 30000 True 1 ... 465.546667 30000.0 13966400.0
6 15000 True 1 ... 466.809333 15000.0 7002140.0
7 13700 True 1 ... 466.816577 55500.0 25908320.0
8 12300 True 1 ... 466.557724 12300.0 5738660.0
9 9200 True 1 ... 466.217391 9200.0 4289200.0
10 -373700 True 2 ... 467.064060 414300.0 193504640.0
11 -235100 True 2 ... 466.822072 502900.0 234764820.0
12 -168100 True 2 ... 466.281052 311900.0 145433060.0
13 -138300 True 2 ... 467.436639 547500.0 255921560.0
14 -89800 True 2 ... 466.722515 265600.0 123961500.0
15 -79400 True 2 ... 466.431910 79600.0 37127980.0
16 -69700 True 2 ... 466.950688 94500.0 44126840.0
17 -43600 True 2 ... 466.546230 61000.0 28459320.0
18 -25300 True 2 ... 466.652174 25300.0 11806300.0
19 -19500 True 2 ... 466.124484 33900.0 15801620.0
[20 rows x 9 columns]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Qot_GetTopTenBuySellBrokers.proto
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message BrokerItem
{
optional int64 netVol = 1; // ネット買い/売り出来高
optional string brokerName = 2; // ブローカー表示名(リアルタイムは証券会社プロファイル、履歴はレスポンス名)
optional Qot_Common.BuySellType buySellType = 3; // 売買種別、Qot_Common.BuySellType 参照
optional double avgPrice = 4; // 平均取引価格(リアルタイムデータのみ有効)
optional double totalVol = 5; // 総取引出来高(リアルタイムデータのみ有効)
optional double totalTurnover = 6; // 総売買代金(リアルタイムデータのみ有効)
}
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS、市場のタイムゾーン
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
プロトコル ID
3247
uint GetTopTenBuySellBrokers(QotGetTopTenBuySellBrokers.Request req);
virtual void OnReply_GetTopTenBuySellBrokers(MMAPI_Conn client, uint nSerialNo, QotGetTopTenBuySellBrokers.Response rsp);
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- 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("00700")
.Build();
QotGetTopTenBuySellBrokers.C2S c2s = QotGetTopTenBuySellBrokers.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetTopTenBuySellBrokers.Request req = QotGetTopTenBuySellBrokers.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetTopTenBuySellBrokers(req);
Console.Write("Send QotGetTopTenBuySellBrokers: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetTopTenBuySellBrokers(FTAPI_Conn client, uint nSerialNo, QotGetTopTenBuySellBrokers.Response rsp)
{
Console.Write("Reply: QotGetTopTenBuySellBrokers: {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 {
isRealTime: true
dataTime: 1778227221
dataTimeStr: "2026-05-08 16:00:21"
brokerList {
netVol: 360300
brokerName: "Goldman Sachs"
buySellType: BuySellType_NetBuy
avgPrice: 471.037340153
totalVol: 586500
totalTurnover: 276263400
}
brokerList {
//...
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int getTopTenBuySellBrokers(QotGetTopTenBuySellBrokers.Request req);
void onReply_GetTopTenBuySellBrokers(MMAPI_Conn client, int nSerialNo, QotGetTopTenBuySellBrokers.Response rsp);
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- 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("00700")
.build();
QotGetTopTenBuySellBrokers.C2S c2s = QotGetTopTenBuySellBrokers.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetTopTenBuySellBrokers.Request req = QotGetTopTenBuySellBrokers.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getTopTenBuySellBrokers(req);
System.out.printf("Send QotGetTopTenBuySellBrokers: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetTopTenBuySellBrokers(FTAPI_Conn client, int nSerialNo, QotGetTopTenBuySellBrokers.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetTopTenBuySellBrokers failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetTopTenBuySellBrokers: %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=7459212704997168681
Send Qot_GetTopTenBuySellBrokers: 2
Receive Qot_GetTopTenBuySellBrokers: retType: 0
retMsg: ""
errCode: 0
s2c {
isRealTime: true
dataTime: 1778227221
dataTimeStr: "2026-05-08 16:00:21"
brokerList {
netVol: 360300
brokerName: "Goldman Sachs"
buySellType: BuySellType_NetBuy
avgPrice: 471.037340153
totalVol: 586500.0
totalTurnover: 2.762634E8
}
brokerList {
//...
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
moomoo::u32_t GetTopTenBuySellBrokers(const Qot_GetTopTenBuySellBrokers::Request &stReq);
virtual void OnReply_GetTopTenBuySellBrokers(moomoo::u32_t nSerialNo, const Qot_GetTopTenBuySellBrokers::Response &stRsp) = 0;
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- 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_GetTopTenBuySellBrokers::Request req;
Qot_GetTopTenBuySellBrokers::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("00700");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetTopTenBuySellBrokers(req);
cout << "GetTopTenBuySellBrokers" << endl;
}
virtual void OnReply_GetTopTenBuySellBrokers(Futu::u32_t nSerialNo, const Qot_GetTopTenBuySellBrokers::Response &stRsp){
cout << "OnReply_GetTopTenBuySellBrokers:" << 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_GetTopTenBuySellBrokers seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
isRealTime: true
dataTime: 1778227221
dataTimeStr: "2026-05-08 16:00:21"
brokerList {
netVol: 360300
brokerName: "Goldman Sachs"
buySellType: BuySellType_NetBuy
avgPrice: 471.037340153
totalVol: 586500
totalTurnover: 276263400
}
brokerList {
//...
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
GetTopTenBuySellBrokers(req);
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetTopTenBuySellBrokers(){
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: "00700",
},
},
};
websocket.GetTopTenBuySellBrokers(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetTopTenBuySellBrokers: 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
GetTopTenBuySellBrokers: errCode 0, retMsg , retType 0
{
"isRealTime": true,
"dataTime": "1778227221",
"dataTimeStr": "2026-05-08 16:00:21",
"brokerList": [{
"netVol": "360300",
"brokerName": "Goldman Sachs",
"buySellType": "BuySellType_NetBuy",
"avgPrice": 471.037340153,
"totalVol": 586500,
"totalTurnover": 276263400
//...
}]
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
制限事項
- 30秒間に最大30回のリクエスト。
- 香港株(普通株およびファンド)のみ対応。
days_before=0または未指定はリアルタイムデータ(平均価格/総出来高/総売買代金を含む)を返す、days_before>0はネット出来高とブローカー名のみ。
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_top_ten_buy_sell_brokers(code, days_before=None)
説明
指定した香港株の十大ネット買いおよびネット売りブローカーリストを取得します(リアルタイムまたは履歴)
パラメータ
パラメータ 型 説明 code str 銘柄コード 香港株(普通株およびファンド)のみ対応、例:HK.00700days_before int 履歴日数 未指定または 0=リアルタイムデータ(平均価格/総出来高/総売買代金を含む)、>0=N 営業日前の履歴データ(ネット出来高とブローカー名のみ)戻り値
パラメータ 型 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、ブローカーデータの DataFrame を返す str ret != RET_OK の場合、エラー説明を返す DataFrame フィールド:
フィールド 型 説明 is_real_time bool リアルタイムデータかどうか true=リアルタイム、false=履歴data_time int データ更新タイムスタンプ(秒単位 Unix タイムスタンプ) data_time_str str データ更新時刻文字列 形式 YYYY-MM-DD HH:MM:SS、市場のタイムゾーンnet_vol int ネット売買出来高 ネット買いは正値、ネット売りは負値broker_name str ブローカー表示名 リアルタイムは証券会社プロファイルから取得、履歴はレスポンス名を使用buy_sell_type BuySellType 売買種別 avg_price float 平均取引価格 リアルタイムデータのみ有効total_vol float 総取引出来高 リアルタイムデータのみ有効total_turnover float 総売買代金 リアルタイムデータのみ有効
BuySellType 列挙
列挙名 値 説明 Unknown 0 不明 NetBuy 1 ネット買い NetSell 2 ネット売り Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_top_ten_buy_sell_brokers("HK.00700")
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
- Output
net_vol is_real_time buy_sell_type ... avg_price total_vol total_turnover
0 99200 True 1 ... 466.852156 398800.0 186180640.0
1 46500 True 1 ... 466.508972 61300.0 28597000.0
2 45400 True 1 ... 466.224332 67400.0 31423520.0
3 36000 True 1 ... 467.343428 240400.0 112349360.0
4 31300 True 1 ... 466.900580 155100.0 72416280.0
5 30000 True 1 ... 465.546667 30000.0 13966400.0
6 15000 True 1 ... 466.809333 15000.0 7002140.0
7 13700 True 1 ... 466.816577 55500.0 25908320.0
8 12300 True 1 ... 466.557724 12300.0 5738660.0
9 9200 True 1 ... 466.217391 9200.0 4289200.0
10 -373700 True 2 ... 467.064060 414300.0 193504640.0
11 -235100 True 2 ... 466.822072 502900.0 234764820.0
12 -168100 True 2 ... 466.281052 311900.0 145433060.0
13 -138300 True 2 ... 467.436639 547500.0 255921560.0
14 -89800 True 2 ... 466.722515 265600.0 123961500.0
15 -79400 True 2 ... 466.431910 79600.0 37127980.0
16 -69700 True 2 ... 466.950688 94500.0 44126840.0
17 -43600 True 2 ... 466.546230 61000.0 28459320.0
18 -25300 True 2 ... 466.652174 25300.0 11806300.0
19 -19500 True 2 ... 466.124484 33900.0 15801620.0
[20 rows x 9 columns]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Qot_GetTopTenBuySellBrokers.proto
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message BrokerItem
{
optional int64 netVol = 1; // ネット買い/売り出来高
optional string brokerName = 2; // ブローカー表示名(リアルタイムは証券会社プロファイル、履歴はレスポンス名)
optional Qot_Common.BuySellType buySellType = 3; // 売買種別、Qot_Common.BuySellType 参照
optional double avgPrice = 4; // 平均取引価格(リアルタイムデータのみ有効)
optional double totalVol = 5; // 総取引出来高(リアルタイムデータのみ有効)
optional double totalTurnover = 6; // 総売買代金(リアルタイムデータのみ有効)
}
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS、市場のタイムゾーン
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
プロトコル ID
3247
uint GetTopTenBuySellBrokers(QotGetTopTenBuySellBrokers.Request req);
virtual void OnReply_GetTopTenBuySellBrokers(MMAPI_Conn client, uint nSerialNo, QotGetTopTenBuySellBrokers.Response rsp);
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- 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("00700")
.Build();
QotGetTopTenBuySellBrokers.C2S c2s = QotGetTopTenBuySellBrokers.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetTopTenBuySellBrokers.Request req = QotGetTopTenBuySellBrokers.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetTopTenBuySellBrokers(req);
Console.Write("Send QotGetTopTenBuySellBrokers: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetTopTenBuySellBrokers(MMAPI_Conn client, uint nSerialNo, QotGetTopTenBuySellBrokers.Response rsp)
{
Console.Write("Reply: QotGetTopTenBuySellBrokers: {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 {
isRealTime: true
dataTime: 1778227221
dataTimeStr: "2026-05-08 16:00:21"
brokerList {
netVol: 360300
brokerName: "Goldman Sachs"
buySellType: BuySellType_NetBuy
avgPrice: 471.037340153
totalVol: 586500
totalTurnover: 276263400
}
brokerList {
//...
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int getTopTenBuySellBrokers(QotGetTopTenBuySellBrokers.Request req);
void onReply_GetTopTenBuySellBrokers(MMAPI_Conn client, int nSerialNo, QotGetTopTenBuySellBrokers.Response rsp);
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- 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("00700")
.build();
QotGetTopTenBuySellBrokers.C2S c2s = QotGetTopTenBuySellBrokers.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetTopTenBuySellBrokers.Request req = QotGetTopTenBuySellBrokers.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getTopTenBuySellBrokers(req);
System.out.printf("Send QotGetTopTenBuySellBrokers: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetTopTenBuySellBrokers(MMAPI_Conn client, int nSerialNo, QotGetTopTenBuySellBrokers.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetTopTenBuySellBrokers failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetTopTenBuySellBrokers: %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=7459212704997168681
Send Qot_GetTopTenBuySellBrokers: 2
Receive Qot_GetTopTenBuySellBrokers: retType: 0
retMsg: ""
errCode: 0
s2c {
isRealTime: true
dataTime: 1778227221
dataTimeStr: "2026-05-08 16:00:21"
brokerList {
netVol: 360300
brokerName: "Goldman Sachs"
buySellType: BuySellType_NetBuy
avgPrice: 471.037340153
totalVol: 586500.0
totalTurnover: 2.762634E8
}
brokerList {
//...
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
moomoo::u32_t GetTopTenBuySellBrokers(const Qot_GetTopTenBuySellBrokers::Request &stReq);
virtual void OnReply_GetTopTenBuySellBrokers(moomoo::u32_t nSerialNo, const Qot_GetTopTenBuySellBrokers::Response &stRsp) = 0;
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- 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_GetTopTenBuySellBrokers::Request req;
Qot_GetTopTenBuySellBrokers::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *sec = c2s->mutable_security();
sec->set_code("00700");
sec->set_market(Qot_Common::QotMarket::QotMarket_HK_Security);
m_pQotApi->GetTopTenBuySellBrokers(req);
cout << "GetTopTenBuySellBrokers" << endl;
}
virtual void OnReply_GetTopTenBuySellBrokers(moomoo::u32_t nSerialNo, const Qot_GetTopTenBuySellBrokers::Response &stRsp){
cout << "OnReply_GetTopTenBuySellBrokers:" << 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_GetTopTenBuySellBrokers seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
isRealTime: true
dataTime: 1778227221
dataTimeStr: "2026-05-08 16:00:21"
brokerList {
netVol: 360300
brokerName: "Goldman Sachs"
buySellType: BuySellType_NetBuy
avgPrice: 471.037340153
totalVol: 586500
totalTurnover: 276263400
}
brokerList {
//...
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
GetTopTenBuySellBrokers(req);
説明
十大ブローカー売買データの取得
パラメータ
message C2S
{
required Qot_Common.Security security = 1; // 銘柄
optional int32 daysBefore = 2; // 未指定または 0=リアルタイム、N=N 営業日前の履歴データ
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
- Security 構造:Security を参照
- 戻り値
message S2C
{
optional bool isRealTime = 1; // true=リアルタイムデータ、false=履歴データ
optional int64 dataTime = 2; // データ更新タイムスタンプ(秒)
optional string dataTimeStr = 3; // データ更新時刻文字列、形式 YYYY-MM-DD HH:MM:SS
repeated BrokerItem brokerList = 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
- API呼び出し結果:RetType を参照
- 売買種別:BuySellType を参照
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetTopTenBuySellBrokers(){
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: "00700",
},
},
};
websocket.GetTopTenBuySellBrokers(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetTopTenBuySellBrokers: 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
GetTopTenBuySellBrokers: errCode 0, retMsg , retType 0
{
"isRealTime": true,
"dataTime": "1778227221",
"dataTimeStr": "2026-05-08 16:00:21",
"brokerList": [{
"netVol": "360300",
"brokerName": "Goldman Sachs",
"buySellType": "BuySellType_NetBuy",
"avgPrice": 471.037340153,
"totalVol": 586500,
"totalTurnover": 276263400
//...
}]
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
制限事項
- 30秒間に最大30回のリクエスト。
- 香港株(普通株およびファンド)のみ対応。
days_before=0または未指定はリアルタイムデータ(平均価格/総出来高/総売買代金を含む)を返す、days_before>0はネット出来高とブローカー名のみ。
← 経営効率の取得 日次空売り出来高の取得 →