# 空売り異常変動ランキングの取得
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_short_selling_rank(market=None, sort_field=None, sort_dir=None, count=10, offset=None, plate_list=None)
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数等のデータを含みます。
パラメータ
パラメータ タイプ 説明 market Market 市場タイプ(HK/US)、デフォルト US sort_field ShortSellingSortField ソートフィールド、デフォルト空売り変化量 sort_dir RankSortDir ソート方向、デフォルト降順 count int 取得数量 [1, 35]、デフォルト 10 offset int 開始位置、デフォルト 0 plate_list list[str] 業種セクターコードリスト(例: ['US.BK2024'])、空=全部戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、(all_count, DataFrame) タプルを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 security str 銘柄コード(例: 'US.GME')name str 銘柄名 close_price float 終値 change_ratio float 騰落率(%) change_ratio_5d float 5日騰落率(%) change_ratio_10d float 10日騰落率(%) volume int 出来高 short_number int 空売り数量 short_number_change int 空売り変化量 short_ratio float 空売り比率(%) short_ratio_change float 空売り変化比率(%) short_position_volume int ショートポジション数量 short_position_ratio float ショートポジション比率(%) days_to_cover float カバー日数 week_avg_short_number int 直近1週間日均空売り week_avg_short_ratio float 直近1週間日均空売り比率(%) month_avg_short_number int 直近1ヶ月日均空売り month_avg_short_ratio float 直近1ヶ月日均空売り比率(%)
- データフォーマット:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_short_selling_rank(count=2)
if ret == RET_OK:
all_count, df = data
print(f'データ総数: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
データ総数: 0
security name close_price change_ratio change_ratio_5d change_ratio_10d volume short_number short_number_change short_ratio short_ratio_change short_position_volume short_position_ratio days_to_cover week_avg_short_number week_avg_short_ratio month_avg_short_number month_avg_short_ratio
0 US.SKYQ Sky Quarry 1.9000 62.39 45.03 4.39 221413731 20302431 20226903 9.16 26780.66 327119 6.82 1.0 4111613 9.19 1136188 8.26
1 US.TNON Tenon Medical 0.6215 77.57 0.72 2.89 271138156 15289764 15273389 5.63 93272.60 149174 1.28 2.9 3063337 5.01 772705 5.04
2
3
4
# Qot_GetShortSellingRank.proto
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
プロトコルID
3415
uint GetShortSellingRank(Qot_GetShortSellingRank.Request req);
virtual void OnReply_GetShortSellingRank(FTAPI_Conn client, uint nSerialNo, Qot_GetShortSellingRank.Response rsp);
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3415
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;
QotGetShortSellingRank.C2S c2s = QotGetShortSellingRank.C2S.CreateBuilder()
.SetMarket(11)
.SetCount(3)
.Build();
QotGetShortSellingRank.Request req = QotGetShortSellingRank.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetShortSellingRank(req);
Console.Write("Send QotGetShortSellingRank: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetShortSellingRank(FTAPI_Conn client, uint nSerialNo, QotGetShortSellingRank.Response rsp)
{
Console.Write("Reply: QotGetShortSellingRank: {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
53
- Output
Send QotGetShortSellingRank: 3
Reply: QotGetShortSellingRank: 3
GetShortSellingRank: errCode 0, retMsg , retType 0
{
"allCount": 3,
"dataList": [
{ "security": { "market": 11, "code": "ADTX" }, "name": "Aditxt", "shortRatio": 5.42, "shortRatioChange": 62.78 },
{ "security": { "market": 11, "code": "CDE" }, "name": "科尔黛伦矿业", "shortRatio": 39.44, "shortRatioChange": 779.14 },
{ "security": { "market": 11, "code": "PFE" }, "name": "辉瑞", "shortRatio": 31.48, "shortRatioChange": 466.48 }
]
}
2
3
4
5
6
7
8
9
10
11
int getShortSellingRank(Qot_GetShortSellingRank.Request req);
onReply_GetShortSellingRank(FTAPI_Conn client, int nSerialNo, Qot_GetShortSellingRank.Response rsp)
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3415
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;
QotGetShortSellingRank.C2S c2s = QotGetShortSellingRank.C2S.newBuilder()
.setMarket(11)
.setCount(3)
.build();
QotGetShortSellingRank.Request req = QotGetShortSellingRank.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getShortSellingRank(req);
System.out.printf("Send QotGetShortSellingRank: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetShortSellingRank(FTAPI_Conn client, int nSerialNo, QotGetShortSellingRank.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetShortSellingRank failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetShortSellingRank: %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
67
- Output
Send QotGetShortSellingRank: 3
Receive QotGetShortSellingRank: {
"allCount": 3,
"dataList": [
{ "security": { "market": 11, "code": "ADTX" }, "name": "Aditxt", "shortRatio": 5.42, "shortRatioChange": 62.78 },
{ "security": { "market": 11, "code": "CDE" }, "name": "科尔黛伦矿业", "shortRatio": 39.44, "shortRatioChange": 779.14 },
{ "security": { "market": 11, "code": "PFE" }, "name": "辉瑞", "shortRatio": 31.48, "shortRatioChange": 466.48 }
]
}
2
3
4
5
6
7
8
9
Futu::u32_t GetShortSellingRank(const Qot_GetShortSellingRank::Request &stReq);
virtual void OnReply_GetShortSellingRank(Futu::u32_t nSerialNo, const Qot_GetShortSellingRank::Response &stRsp) = 0;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API 呼び出し結果,構造は~を参照: RetType
プロトコル ID
3415
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_GetShortSellingRank::Request req;
Qot_GetShortSellingRank::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_count(50);
m_GetShortSellingRankSerialNo = m_pQotApi->GetShortSellingRank(req);
}
virtual void OnReply_GetShortSellingRank(Futu::u32_t nSerialNo, const Qot_GetShortSellingRank::Response &stRsp) {
if (nSerialNo != m_GetShortSellingRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetShortSellingRankSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dataList": [
{
"security": {
"market": 11,
"code": "GME"
},
"name": "GameStop",
"closePrice": 25.5,
"changeRatio": 5.2,
"volume": 85000000,
"shortNumber": 45000000
}
],
"allCount": 50
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
getShortSellingRank(qotGetShortSellingRank)
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3415
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetShortSellingRank(){
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, count: 3 },
};
websocket.GetShortSellingRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetShortSellingRank: 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);
}
QotGetShortSellingRank()
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
GetShortSellingRank: errCode 0, retMsg , retType 0
{
"allCount": 3,
"dataList": [
{ "security": { "market": 11, "code": "ADTX" }, "name": "Aditxt", "shortRatio": 5.42, "shortRatioChange": 62.78 },
{ "security": { "market": 11, "code": "CDE" }, "name": "科尔黛伦矿业", "shortRatio": 39.44, "shortRatioChange": 779.14 },
{ "security": { "market": 11, "code": "PFE" }, "name": "辉瑞", "shortRatio": 31.48, "shortRatioChange": 466.48 }
]
}
2
3
4
5
6
7
8
9
API制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_short_selling_rank(market=None, sort_field=None, sort_dir=None, count=10, offset=None, plate_list=None)
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数等のデータを含みます。
パラメータ
パラメータ タイプ 説明 market Market 市場タイプ(HK/US)、デフォルト US sort_field ShortSellingSortField ソートフィールド、デフォルト空売り変化量 sort_dir RankSortDir ソート方向、デフォルト降順 count int 取得数量 [1, 35]、デフォルト 10 offset int 開始位置、デフォルト 0 plate_list list[str] 業種セクターコードリスト(例: ['US.BK2024'])、空=全部戻り値
パラメータ タイプ 説明 ret RET_CODE API呼び出し結果 data pd.DataFrame ret == RET_OK の場合、(all_count, DataFrame) タプルを返す str ret != RET_OK の場合、エラー説明を返す - データフォーマット:
フィールド タイプ 説明 security str 銘柄コード(例: 'US.GME')name str 銘柄名 close_price float 終値 change_ratio float 騰落率(%) change_ratio_5d float 5日騰落率(%) change_ratio_10d float 10日騰落率(%) volume int 出来高 short_number int 空売り数量 short_number_change int 空売り変化量 short_ratio float 空売り比率(%) short_ratio_change float 空売り変化比率(%) short_position_volume int ショートポジション数量 short_position_ratio float ショートポジション比率(%) days_to_cover float カバー日数 week_avg_short_number int 直近1週間日均空売り week_avg_short_ratio float 直近1週間日均空売り比率(%) month_avg_short_number int 直近1ヶ月日均空売り month_avg_short_ratio float 直近1ヶ月日均空売り比率(%)
- データフォーマット:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_short_selling_rank(count=2)
if ret == RET_OK:
all_count, df = data
print(f'データ総数: {all_count}')
print(df)
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
13
- Output
データ総数: 0
security name close_price change_ratio change_ratio_5d change_ratio_10d volume short_number short_number_change short_ratio short_ratio_change short_position_volume short_position_ratio days_to_cover week_avg_short_number week_avg_short_ratio month_avg_short_number month_avg_short_ratio
0 US.SKYQ Sky Quarry 1.9000 62.39 45.03 4.39 221413731 20302431 20226903 9.16 26780.66 327119 6.82 1.0 4111613 9.19 1136188 8.26
1 US.TNON Tenon Medical 0.6215 77.57 0.72 2.89 271138156 15289764 15273389 5.63 93272.60 149174 1.28 2.9 3063337 5.01 772705 5.04
2
3
4
# Qot_GetShortSellingRank.proto
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
プロトコルID
3415
uint GetShortSellingRank(Qot_GetShortSellingRank.Request req);
virtual void OnReply_GetShortSellingRank(FTAPI_Conn client, uint nSerialNo, Qot_GetShortSellingRank.Response rsp);
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3415
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;
QotGetShortSellingRank.C2S c2s = QotGetShortSellingRank.C2S.CreateBuilder()
.SetMarket(11)
.SetCount(3)
.Build();
QotGetShortSellingRank.Request req = QotGetShortSellingRank.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetShortSellingRank(req);
Console.Write("Send QotGetShortSellingRank: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetShortSellingRank(MMAPI_Conn client, uint nSerialNo, QotGetShortSellingRank.Response rsp)
{
Console.Write("Reply: QotGetShortSellingRank: {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
53
- Output
Send QotGetShortSellingRank: 3
Reply: QotGetShortSellingRank: 3
GetShortSellingRank: errCode 0, retMsg , retType 0
{
"allCount": 3,
"dataList": [
{ "security": { "market": 11, "code": "ADTX" }, "name": "Aditxt", "shortRatio": 5.42, "shortRatioChange": 62.78 },
{ "security": { "market": 11, "code": "CDE" }, "name": "科尔黛伦矿业", "shortRatio": 39.44, "shortRatioChange": 779.14 },
{ "security": { "market": 11, "code": "PFE" }, "name": "辉瑞", "shortRatio": 31.48, "shortRatioChange": 466.48 }
]
}
2
3
4
5
6
7
8
9
10
11
int getShortSellingRank(Qot_GetShortSellingRank.Request req);
onReply_GetShortSellingRank(FTAPI_Conn client, int nSerialNo, Qot_GetShortSellingRank.Response rsp)
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3415
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;
QotGetShortSellingRank.C2S c2s = QotGetShortSellingRank.C2S.newBuilder()
.setMarket(11)
.setCount(3)
.build();
QotGetShortSellingRank.Request req = QotGetShortSellingRank.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getShortSellingRank(req);
System.out.printf("Send QotGetShortSellingRank: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetShortSellingRank(MMAPI_Conn client, int nSerialNo, QotGetShortSellingRank.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetShortSellingRank failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetShortSellingRank: %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
67
- Output
Send QotGetShortSellingRank: 3
Receive QotGetShortSellingRank: {
"allCount": 3,
"dataList": [
{ "security": { "market": 11, "code": "ADTX" }, "name": "Aditxt", "shortRatio": 5.42, "shortRatioChange": 62.78 },
{ "security": { "market": 11, "code": "CDE" }, "name": "科尔黛伦矿业", "shortRatio": 39.44, "shortRatioChange": 779.14 },
{ "security": { "market": 11, "code": "PFE" }, "name": "辉瑞", "shortRatio": 31.48, "shortRatioChange": 466.48 }
]
}
2
3
4
5
6
7
8
9
moomoo::u32_t GetShortSellingRank(const Qot_GetShortSellingRank::Request &stReq);
virtual void OnReply_GetShortSellingRank(moomoo::u32_t nSerialNo, const Qot_GetShortSellingRank::Response &stRsp) = 0;
概要
プロトコルリクエストとレスポンスの定義
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API 呼び出し結果,構造は~を参照: RetType
プロトコル ID
3415
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_GetShortSellingRank::Request req;
Qot_GetShortSellingRank::C2S *c2s = req.mutable_c2s();
c2s->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
c2s->set_count(50);
m_GetShortSellingRankSerialNo = m_pQotApi->GetShortSellingRank(req);
}
virtual void OnReply_GetShortSellingRank(moomoo::u32_t nSerialNo, const Qot_GetShortSellingRank::Response &stRsp) {
if (nSerialNo != m_GetShortSellingRankSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetShortSellingRankSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dataList": [
{
"security": {
"market": 11,
"code": "GME"
},
"name": "GameStop",
"closePrice": 25.5,
"changeRatio": 5.2,
"volume": 85000000,
"shortNumber": 45000000
}
],
"allCount": 50
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
getShortSellingRank(qotGetShortSellingRank)
説明
空売り異常変動ランキングを取得します。米国株/香港株の空売りデータランキングを返します。14種類のソート次元と業種セクターフィルタに対応し、空売り数量、比率、ショートポジション、カバー日数などのデータを含みます。
パラメータ
// ソート方向
enum SortDir {
SortDir_Descending = 0; // 降順(デフォルト)
SortDir_Ascending = 1; // 昇順
}
// ソートフィールド
enum ShortSellingSortField {
ShortSellingSortField_Unknown = 0; // デフォルト(空売り変動量)
ShortSellingSortField_ShortNumberChange = 1; // 空売り変動量
ShortSellingSortField_ShortRatioChange = 2; // 空売り変動比率
ShortSellingSortField_ShortNumber = 3; // 空売り数量
ShortSellingSortField_ShortRatio = 4; // 空売り比率
ShortSellingSortField_Volume = 5; // 出来高
ShortSellingSortField_PositionVolume = 6; // ショートポジション数量
ShortSellingSortField_PositionRatio = 7; // ショートポジション比率
ShortSellingSortField_DaysToCover = 8; // カバー日数
ShortSellingSortField_WeekAvgVolume = 9; // 直近1週間日平均出来高
ShortSellingSortField_WeekAvgShortNumber = 10; // 直近1週間日平均空売り数量
ShortSellingSortField_WeekAvgShortRatio = 11; // 直近1週間日平均空売り比率
ShortSellingSortField_MonthAvgVolume = 12; // 直近1ヶ月日平均出来高
ShortSellingSortField_MonthAvgShortNumber = 13; // 直近1ヶ月日平均空売り数量
ShortSellingSortField_MonthAvgShortRatio = 14; // 直近1ヶ月日平均空売り比率
}
message C2S {
optional int32 market = 1; // Qot_Common.QotMarket, マーケット(HK=1, US=11), デフォルトUS
optional int32 sortField = 2; // ShortSellingSortField, ソートフィールド, デフォルト空売り変動量
optional int32 sortDir = 3; // SortDir、ソート方向、デフォルト降順
optional int32 offset = 4; // 開始位置、デフォルト0
optional int32 count = 5; // 取得数量 [1,35]、デフォルト10
repeated Qot_Common.Security plateList = 6; // 業種セクターリスト, 空=全て
}
// 空売り異動データ項目
message ShortSellingRankItem {
required Qot_Common.Security security = 1; // 銘柄
optional string name = 2; // 名称
optional double closePrice = 10; // 終値
optional double changeRatio = 11; // 騰落率(%)
optional double changeRatio5D = 12; // 5日騰落率(%)
optional double changeRatio10D = 13; // 10日騰落率(%)
optional int64 volume = 14; // 出来高
optional int64 shortNumber = 20; // 空売り数量
optional int64 shortNumberChange = 21; // 空売り変動量
optional double shortRatio = 22; // 空売り比率(%)
optional double shortRatioChange = 23; // 空売り変動比率(%)
optional int64 shortPositionVolume = 24; // ショートポジション数量
optional double shortPositionRatio = 25; // ショートポジション比率(%)
optional double daysToCover = 26; // カバー日数
optional int64 weekAvgShortNumber = 27; // 直近1週間日平均空売り
optional double weekAvgShortRatio = 28; // 直近1週間日平均空売り比率(%)
optional int64 monthAvgShortNumber = 29; // 直近1ヶ月日平均空売り
optional double monthAvgShortRatio = 30; // 直近1ヶ月日平均空売り比率(%)
}
message S2C {
repeated ShortSellingRankItem dataList = 1; // データリスト
optional int32 allCount = 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
- API呼び出し結果、構造体については以下を参照 RetType
プロトコルID
3415
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetShortSellingRank(){
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, count: 3 },
};
websocket.GetShortSellingRank(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetShortSellingRank: 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);
}
QotGetShortSellingRank()
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
GetShortSellingRank: errCode 0, retMsg , retType 0
{
"allCount": 3,
"dataList": [
{ "security": { "market": 11, "code": "ADTX" }, "name": "Aditxt", "shortRatio": 5.42, "shortRatioChange": 62.78 },
{ "security": { "market": 11, "code": "CDE" }, "name": "科尔黛伦矿业", "shortRatio": 39.44, "shortRatioChange": 779.14 },
{ "security": { "market": 11, "code": "PFE" }, "name": "辉瑞", "shortRatio": 31.48, "shortRatioChange": 466.48 }
]
}
2
3
4
5
6
7
8
9
API制限
- 30秒以内に最大60回のリクエストが可能です
- ページネーションリクエストは最初のページのみレート制限にカウントされます
← 人気ランキングの取得 期間騰落率の取得 →