# 騰落分布の取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_rise_fall_distribution(security=None, market=None)
説明
騰落分布を取得します。指定セクターまたは市場の値上がり/値下がり銘柄数の分布区間を返します。市場全体の騰落パターンの把握に利用できます。
パラメータ
パラメータ タイプ 説明 security str セクターコード(優先使用、例 'HK.BK1001')market Market 市場タイプ( security未指定時に使用)戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data dict ret == RET_OK の場合、辞書データを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 plate str セクターコード range_list list[dict] 騰落分布区間リスト type str 分布タイプ(文字列、下表を参照) left_border int 左境界値 right_border int 右境界値 stock_count int 区間内銘柄数 "RISE_LIMIT" ストップ高(A株) "POSITIVE_INFINITY" (7%, +∞) "NORMAL_RANGE" 通常区間 "NEGATIVE_INFINITY" (-∞, -7%) "FALL_LIMIT" ストップ安(A株)
- データフォーマット:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_rise_fall_distribution(market=Market.US)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
{'plate': 'US.USAALL', 'range_list': [{'type': 'NEGATIVE_INFINITY', 'left_border': 0, 'right_border': -7, 'stock_count': 817}, {'type': 'NORMAL_RANGE', 'left_border': -7, 'right_border': -5, 'stock_count': 581}, {'type': 'NORMAL_RANGE', 'left_border': 0, 'right_border': 3, 'stock_count': 4168}, {'type': 'NORMAL_RANGE', 'left_border': 0, 'right_border': 0, 'stock_count': 4310}, {'type': 'POSITIVE_INFINITY', 'left_border': 7, 'right_border': 0, 'stock_count': 416}]}
# Qot_GetRiseFallDistribution.proto
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
プロトコルID
3433
uint GetRiseFallDistribution(Qot_GetRiseFallDistribution.Request req);
virtual void OnReply_GetRiseFallDistribution(FTAPI_Conn client, uint nSerialNo, Qot_GetRiseFallDistribution.Response rsp);
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3433
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}
", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotGetRiseFallDistribution.C2S c2s = QotGetRiseFallDistribution.C2S.CreateBuilder()
.SetMarket(11)
.Build();
QotGetRiseFallDistribution.Request req = QotGetRiseFallDistribution.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetRiseFallDistribution(req);
Console.Write("Send QotGetRiseFallDistribution: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetRiseFallDistribution(FTAPI_Conn client, uint nSerialNo, QotGetRiseFallDistribution.Response rsp)
{
Console.Write("Reply: QotGetRiseFallDistribution: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
FTAPI.Init();
Program program = new Program();
program.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
- Output
Send QotGetRiseFallDistribution: 3
Reply: QotGetRiseFallDistribution: 3
GetRiseFallDistribution: errCode 0, retMsg , retType 0
{
"plate": { "market": 11, "code": "USAALL" },
"rangeList": [
{ "rangeType": 3, "rangeMin": 7.0, "count": 712 },
{ "rangeType": 1, "rangeMin": -5.0, "rangeMax": -3.0, "count": 546 },
{ "rangeType": 1, "rangeMin": -3.0, "rangeMax": 0.0, "count": 3132 },
{ "rangeType": 1, "rangeMin": 0.0, "rangeMax": 0.0, "count": 4294 },
{ "rangeType": 1, "rangeMin": 5.0, "rangeMax": 7.0, "count": 436 }
]
}
2
3
4
5
6
7
8
9
10
11
12
13
int getRiseFallDistribution(Qot_GetRiseFallDistribution.Request req);
onReply_GetRiseFallDistribution(FTAPI_Conn client, int nSerialNo, Qot_GetRiseFallDistribution.Response rsp)
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3433
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=%d desc=%s connID=%d
", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotGetRiseFallDistribution.C2S c2s = QotGetRiseFallDistribution.C2S.newBuilder()
.setMarket(11)
.build();
QotGetRiseFallDistribution.Request req = QotGetRiseFallDistribution.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getRiseFallDistribution(req);
System.out.printf("Send QotGetRiseFallDistribution: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetRiseFallDistribution(FTAPI_Conn client, int nSerialNo, QotGetRiseFallDistribution.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetRiseFallDistribution failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetRiseFallDistribution: %s
", 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
Send QotGetRiseFallDistribution: 3
Receive QotGetRiseFallDistribution: {
"plate": { "market": 11, "code": "USAALL" },
"rangeList": [
{ "rangeType": 3, "rangeMin": 7.0, "count": 712 },
{ "rangeType": 1, "rangeMin": -5.0, "rangeMax": -3.0, "count": 546 },
{ "rangeType": 1, "rangeMin": -3.0, "rangeMax": 0.0, "count": 3132 },
{ "rangeType": 1, "rangeMin": 0.0, "rangeMax": 0.0, "count": 4294 },
{ "rangeType": 1, "rangeMin": 5.0, "rangeMax": 7.0, "count": 436 }
]
}
2
3
4
5
6
7
8
9
10
11
Futu::u32_t GetRiseFallDistribution(const Qot_GetRiseFallDistribution::Request &stReq);
virtual void OnReply_GetRiseFallDistribution(Futu::u32_t nSerialNo, const Qot_GetRiseFallDistribution::Response &stRsp) = 0;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API 呼び出し結果,構造は~を参照: RetType
プロトコル ID
3433
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_GetRiseFallDistribution::Request req;
Qot_GetRiseFallDistribution::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
m_GetRiseFallDistributionSerialNo = m_pQotApi->GetRiseFallDistribution(req);
}
virtual void OnReply_GetRiseFallDistribution(Futu::u32_t nSerialNo, const Qot_GetRiseFallDistribution::Response &stRsp) {
if (nSerialNo != m_GetRiseFallDistributionSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetRiseFallDistributionSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"plate": {
"market": 11,
"code": "US.IXIC"
},
"rangeList": [
{
"rangeText": ">3%",
"stockCount": 185
},
{
"rangeText": "1%~3%",
"stockCount": 320
},
{
"rangeText": "-1%~1%",
"stockCount": 450
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
getRiseFallDistribution(qotGetRiseFallDistribution)
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3433
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetRiseFallDistribution(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: { market: 11 },
};
websocket.GetRiseFallDistribution(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetRiseFallDistribution: 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);
}
QotGetRiseFallDistribution()
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
- Output
GetRiseFallDistribution: errCode 0, retMsg , retType 0
{
"plate": { "market": 11, "code": "USAALL" },
"rangeList": [
{ "rangeType": 3, "rangeMin": 7.0, "count": 712 },
{ "rangeType": 1, "rangeMin": -5.0, "rangeMax": -3.0, "count": 546 },
{ "rangeType": 1, "rangeMin": -3.0, "rangeMax": 0.0, "count": 3132 },
{ "rangeType": 1, "rangeMin": 0.0, "rangeMax": 0.0, "count": 4294 },
{ "rangeType": 1, "rangeMin": 5.0, "rangeMax": 7.0, "count": 436 }
]
}
2
3
4
5
6
7
8
9
10
11
API制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_rise_fall_distribution(security=None, market=None)
説明
騰落分布を取得します。指定セクターまたは市場の値上がり/値下がり銘柄数の分布区間を返します。市場全体の騰落パターンの把握に利用できます。
パラメータ
パラメータ タイプ 説明 security str セクターコード(優先使用、例 'HK.BK1001')market Market 市場タイプ( security未指定時に使用)戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data dict ret == RET_OK の場合、辞書データを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 plate str セクターコード range_list list[dict] 騰落分布区間リスト type str 分布タイプ(文字列、下表を参照) left_border int 左境界値 right_border int 右境界値 stock_count int 区間内銘柄数 "RISE_LIMIT" ストップ高(A株) "POSITIVE_INFINITY" (7%, +∞) "NORMAL_RANGE" 通常区間 "NEGATIVE_INFINITY" (-∞, -7%) "FALL_LIMIT" ストップ安(A株)
- データフォーマット:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_rise_fall_distribution(market=Market.US)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
- Output
{'plate': 'US.USAALL', 'range_list': [{'type': 'NEGATIVE_INFINITY', 'left_border': 0, 'right_border': -7, 'stock_count': 817}, {'type': 'NORMAL_RANGE', 'left_border': -7, 'right_border': -5, 'stock_count': 581}, {'type': 'NORMAL_RANGE', 'left_border': 0, 'right_border': 3, 'stock_count': 4168}, {'type': 'NORMAL_RANGE', 'left_border': 0, 'right_border': 0, 'stock_count': 4310}, {'type': 'POSITIVE_INFINITY', 'left_border': 7, 'right_border': 0, 'stock_count': 416}]}
# Qot_GetRiseFallDistribution.proto
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
プロトコルID
3433
uint GetRiseFallDistribution(Qot_GetRiseFallDistribution.Request req);
virtual void OnReply_GetRiseFallDistribution(FTAPI_Conn client, uint nSerialNo, Qot_GetRiseFallDistribution.Response rsp);
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3433
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}
", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotGetRiseFallDistribution.C2S c2s = QotGetRiseFallDistribution.C2S.CreateBuilder()
.SetMarket(11)
.Build();
QotGetRiseFallDistribution.Request req = QotGetRiseFallDistribution.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetRiseFallDistribution(req);
Console.Write("Send QotGetRiseFallDistribution: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetRiseFallDistribution(MMAPI_Conn client, uint nSerialNo, QotGetRiseFallDistribution.Response rsp)
{
Console.Write("Reply: QotGetRiseFallDistribution: {0}
", nSerialNo);
if (rsp.RetType == 0 && rsp.HasS2C)
Console.Write("{0}
", rsp.ToString());
}
public static void Main(String[] args) {
MMAPI.Init();
Program program = new Program();
program.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
- Output
Send QotGetRiseFallDistribution: 3
Reply: QotGetRiseFallDistribution: 3
GetRiseFallDistribution: errCode 0, retMsg , retType 0
{
"plate": { "market": 11, "code": "USAALL" },
"rangeList": [
{ "rangeType": 3, "rangeMin": 7.0, "count": 712 },
{ "rangeType": 1, "rangeMin": -5.0, "rangeMax": -3.0, "count": 546 },
{ "rangeType": 1, "rangeMin": -3.0, "rangeMax": 0.0, "count": 3132 },
{ "rangeType": 1, "rangeMin": 0.0, "rangeMax": 0.0, "count": 4294 },
{ "rangeType": 1, "rangeMin": 5.0, "rangeMax": 7.0, "count": 436 }
]
}
2
3
4
5
6
7
8
9
10
11
12
13
int getRiseFallDistribution(Qot_GetRiseFallDistribution.Request req);
onReply_GetRiseFallDistribution(FTAPI_Conn client, int nSerialNo, Qot_GetRiseFallDistribution.Response rsp)
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3433
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=%d desc=%s connID=%d
", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotGetRiseFallDistribution.C2S c2s = QotGetRiseFallDistribution.C2S.newBuilder()
.setMarket(11)
.build();
QotGetRiseFallDistribution.Request req = QotGetRiseFallDistribution.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getRiseFallDistribution(req);
System.out.printf("Send QotGetRiseFallDistribution: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetRiseFallDistribution(MMAPI_Conn client, int nSerialNo, QotGetRiseFallDistribution.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetRiseFallDistribution failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetRiseFallDistribution: %s
", 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
Send QotGetRiseFallDistribution: 3
Receive QotGetRiseFallDistribution: {
"plate": { "market": 11, "code": "USAALL" },
"rangeList": [
{ "rangeType": 3, "rangeMin": 7.0, "count": 712 },
{ "rangeType": 1, "rangeMin": -5.0, "rangeMax": -3.0, "count": 546 },
{ "rangeType": 1, "rangeMin": -3.0, "rangeMax": 0.0, "count": 3132 },
{ "rangeType": 1, "rangeMin": 0.0, "rangeMax": 0.0, "count": 4294 },
{ "rangeType": 1, "rangeMin": 5.0, "rangeMax": 7.0, "count": 436 }
]
}
2
3
4
5
6
7
8
9
10
11
moomoo::u32_t GetRiseFallDistribution(const Qot_GetRiseFallDistribution::Request &stReq);
virtual void OnReply_GetRiseFallDistribution(moomoo::u32_t nSerialNo, const Qot_GetRiseFallDistribution::Response &stRsp) = 0;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API 呼び出し結果,構造は~を参照: RetType
プロトコル ID
3433
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_GetRiseFallDistribution::Request req;
Qot_GetRiseFallDistribution::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
m_GetRiseFallDistributionSerialNo = m_pQotApi->GetRiseFallDistribution(req);
}
virtual void OnReply_GetRiseFallDistribution(moomoo::u32_t nSerialNo, const Qot_GetRiseFallDistribution::Response &stRsp) {
if (nSerialNo != m_GetRiseFallDistributionSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetRiseFallDistributionSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"plate": {
"market": 11,
"code": "US.IXIC"
},
"rangeList": [
{
"rangeText": ">3%",
"stockCount": 185
},
{
"rangeText": "1%~3%",
"stockCount": 320
},
{
"rangeText": "-1%~1%",
"stockCount": 450
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
getRiseFallDistribution(qotGetRiseFallDistribution)
説明
騰落分布を取得します。指定セクターまたは市場の値上がり・値下がり銘柄数の分布区間を返します。市場全体の騰落状況の把握に使用できます。
パラメータ
//騰落分布タイプ
enum DistributionType
{
DistributionType_Unknown = 0; //不明
DistributionType_RiseLimit = 1; //ストップ高(A株)
DistributionType_PositiveInfinity = 2; //(7%, +∞)
DistributionType_NormalRange = 3; //通常範囲
DistributionType_NegativeInfinity = 4; //(-∞, -7%)
DistributionType_FallLimit = 5; //ストップ安(A株)
}
message C2S
{
optional Qot_Common.Security security = 1; //セクター(優先使用)
optional int32 market = 2; //Qot_Common.QotMarket, マーケット(security未指定時に使用)
}
message RiseFallRange
{
optional int32 type = 1; //DistributionType, 分布タイプ
optional int32 leftBorder = 2; //左境界値
optional int32 rightBorder = 3; //右境界値
optional int32 stockCount = 4; //区間内銘柄数
}
message S2C
{
optional Qot_Common.Security plate = 1; //セクター
repeated RiseFallRange rangeList = 2; //騰落分布区間リスト
}
message Request
{
required C2S c2s = 1;
}
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
42
43
44
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3433
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetRiseFallDistribution(){
const { RetType } = Common
let [addr, port, enable_ssl, key] = ["127.0.0.1", 11111, false, "xxxxxx"];
let websocket = new mmWebsocket();
websocket.onlogin = (ret, msg)=>{
if (ret) {
const req = {
c2s: { market: 11 },
};
websocket.GetRiseFallDistribution(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetRiseFallDistribution: 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);
}
QotGetRiseFallDistribution()
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
- Output
GetRiseFallDistribution: errCode 0, retMsg , retType 0
{
"plate": { "market": 11, "code": "USAALL" },
"rangeList": [
{ "rangeType": 3, "rangeMin": 7.0, "count": 712 },
{ "rangeType": 1, "rangeMin": -5.0, "rangeMax": -3.0, "count": 546 },
{ "rangeType": 1, "rangeMin": -3.0, "rangeMax": 0.0, "count": 3132 },
{ "rangeType": 1, "rangeMin": 0.0, "rangeMax": 0.0, "count": 4294 },
{ "rangeType": 1, "rangeMin": 5.0, "rangeMax": 7.0, "count": 436 }
]
}
2
3
4
5
6
7
8
9
10
11
API制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます
← ヒートマップデータの取得 市場定義 →