# Get Daily Short Volume
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_daily_short_volume(code, next_key=None, num=None)
Description
Get daily short volume data for US or HK stocks, with pagination support
Parameters
Parameter Type Description code str Stock code Supports HK and US stocks and funds, e.g. US.AAPL, HK.00700next_key str Pagination key Leave empty for the first request; pass the next_key from the previous response to continue; "-1" indicates no more datanum int Page size Default 10, range 1~50Return
Parameter Type Description ret RET_CODE API call result us_df pd.DataFrame US daily short volume data; error description string when ret != RET_OK hk_df pd.DataFrame HK daily short volume data; None when ret != RET_OK US DataFrame (us_df) field description:
Field Type Description timestamp int Trading day timestamp Unix timestamp in seconds, midnight of the daytimestamp_str str Trading day string Format YYYY-MM-DD, in market timezonetotal_shares_short int Total short shares nasdaq_shares_short int NASDAQ short shares nyse_shares_short int NYSE short shares short_percent float Short ratio Value before the percent sign, e.g. 12.34 means 12.34%volume int Volume (shares) close_price float Close price last_close_price float Previous close price daily_trade_avg_ratio float Daily avg trade ratio Value before the percent sign, e.g. 12.34 means 12.34%; 20-trading-day average ending at the given trading dayUS us_df.attrs additional attributes:
Attribute Type Description next_key str Pagination key "-1" indicates no more dataHK DataFrame (hk_df) field description:
Field Type Description timestamp int Trading day timestamp Unix timestamp in seconds, midnight of the daytimestamp_str str Trading day string Format YYYY-MM-DD, in market timezoneshares_traded int Volume (shares) turnover float Turnover short_sell_shares_traded int Short sell volume (shares) short_sell_turnover float Short sell turnover open_price float Open price close_price float Close price last_close_price float Previous close price daily_trade_avg_ratio float Daily avg trade ratio Value before the percent sign, e.g. 12.34 means 12.34%; 20-trading-day average ending at the given trading dayHK hk_df.attrs additional attributes:
Attribute Type Description next_key str Pagination key "-1" indicates no more dataaggregated_short int Aggregated short position (shares) HK onlyaggregated_short_ratio float Ratio of outstanding shares Value before the percent sign, e.g. 12.34 means 12.34%; HK onlynew_time_str str Latest data time Format YYYY-MM-DD, in market timezone; HK only
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, us_df, hk_df = quote_ctx.get_daily_short_volume("HK.00700")
if ret == RET_OK:
print(hk_df)
else:
print('error:', hk_df)
quote_ctx.close()
2
3
4
5
6
7
8
9
- Output
timestamp timestamp_str ... last_close_price daily_trade_avg_ratio
0 1778169600 2026-05-08 ... 477.4 11.36
1 1778083200 2026-05-07 ... 463.0 11.80
2 1777996800 2026-05-06 ... 472.2 12.22
3 1777910400 2026-05-05 ... 473.0 12.76
4 1777824000 2026-05-04 ... 467.8 13.02
5 1777478400 2026-04-30 ... 479.2 13.09
6 1777392000 2026-04-29 ... 473.8 14.02
7 1777305600 2026-04-28 ... 478.6 14.13
8 1777219200 2026-04-27 ... 493.4 14.14
9 1776960000 2026-04-24 ... 495.2 14.18
[10 rows x 10 columns]
2
3
4
5
6
7
8
9
10
11
12
13
# Qot_GetDailyShortVolume.proto
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
// US daily short volume item
message UsDailyShortVolumeItem
{
optional int64 timestamp = 1; // Trading day timestamp (seconds, midnight)
optional string timestampStr = 2; // Trading day string, format YYYY-MM-DD, in market timezone
optional uint64 totalSharesShort = 3; // Total short shares
optional uint64 nasdaqSharesShort = 4; // NASDAQ short shares
optional uint64 nyseSharesShort = 5; // NYSE short shares
optional double shortPercent = 6; // Short ratio, value before percent sign, e.g. 12.34 means 12.34%
optional uint64 volume = 7; // Volume (shares)
optional double closePrice = 8; // Close price
optional double lastClosePrice = 9; // Previous close price
optional double dailyTradeAvgRatio = 10; // Daily avg trade ratio, value before percent sign; 20-trading-day average ending at the given trading day
}
// HK daily short volume item
message HkDailyShortVolumeItem
{
optional int64 timestamp = 1; // Trading day timestamp (seconds, midnight)
optional string timestampStr = 2; // Trading day string, format YYYY-MM-DD, in market timezone
optional uint64 sharesTraded = 3; // Volume (shares)
optional double turnover = 4; // Turnover
optional uint64 shortSellSharesTraded = 5; // Short sell volume (shares)
optional double shortSellTurnover = 6; // Short sell turnover
optional double openPrice = 7; // Open price
optional double closePrice = 8; // Close price
optional double lastClosePrice = 9; // Previous close price
optional double dailyTradeAvgRatio = 10; // Daily avg trade ratio, value before percent sign; 20-trading-day average ending at the given trading day
}
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
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
- API call result: see RetType
Protocol ID
3248
uint GetDailyShortVolume(QotGetDailyShortVolume.Request req);
virtual void OnReply_GetDailyShortVolume(MMAPI_Conn client, uint nSerialNo, QotGetDailyShortVolume.Response rsp);
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
public class Program : FTSPI_Qot, FTSPI_Conn
{
FTAPI_Qot qot = new FTAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(FTAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("00700")
.Build();
QotGetDailyShortVolume.C2S c2s = QotGetDailyShortVolume.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetDailyShortVolume.Request req = QotGetDailyShortVolume.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetDailyShortVolume(req);
Console.Write("Send QotGetDailyShortVolume: {0}\n", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetDailyShortVolume(FTAPI_Conn client, uint nSerialNo, QotGetDailyShortVolume.Response rsp)
{
Console.Write("Reply: QotGetDailyShortVolume: {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 {
hkItemList {
timestamp: 1778169600
timestampStr: "2026-05-08"
sharesTraded: 25207039
turnover: 11871680730.68
shortSellSharesTraded: 2464300
shortSellTurnover: 1161032040
openPrice: 475
closePrice: 471.4
lastClosePrice: 477.4
dailyTradeAvgRatio: 11.36
}
hkItemList {
//...
}
nextKey: "1776960000"
aggregatedShort: 51480638
aggregatedShortRatio: 0.56
newTimeStr: "30/04/2026"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
int getDailyShortVolume(QotGetDailyShortVolume.Request req);
void onReply_GetDailyShortVolume(MMAPI_Conn client, int nSerialNo, QotGetDailyShortVolume.Response rsp);
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
public class QotDemo implements FTSPI_Qot, FTSPI_Conn {
FTAPI_Conn_Qot qot = new FTAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(FTAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("00700")
.build();
QotGetDailyShortVolume.C2S c2s = QotGetDailyShortVolume.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetDailyShortVolume.Request req = QotGetDailyShortVolume.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getDailyShortVolume(req);
System.out.printf("Send QotGetDailyShortVolume: %d\n", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetDailyShortVolume(FTAPI_Conn client, int nSerialNo, QotGetDailyShortVolume.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetDailyShortVolume failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetDailyShortVolume: %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=7459212711696991004
Send Qot_GetDailyShortVolume: 2
Receive Qot_GetDailyShortVolume: retType: 0
retMsg: ""
errCode: 0
s2c {
hkItemList {
timestamp: 1778169600
timestampStr: "2026-05-08"
sharesTraded: 25207039
turnover: 1.187168073068E10
shortSellSharesTraded: 2464300
shortSellTurnover: 1.16103204E9
openPrice: 475.0
closePrice: 471.4
lastClosePrice: 477.4
dailyTradeAvgRatio: 11.36
}
hkItemList {
//...
}
nextKey: "1776960000"
aggregatedShort: 51480638
aggregatedShortRatio: 0.56
newTimeStr: "30/04/2026"
}
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
moomoo::u32_t GetDailyShortVolume(const Qot_GetDailyShortVolume::Request &stReq);
virtual void OnReply_GetDailyShortVolume(moomoo::u32_t nSerialNo, const Qot_GetDailyShortVolume::Response &stRsp) = 0;
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
class Program : public FTSPI_Qot, public FTSPI_Trd, public FTSPI_Conn
{
public:
Program() {
m_pQotApi = FTAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
FTAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(FTAPI_Conn* pConn, Futu::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetDailyShortVolume::Request req;
Qot_GetDailyShortVolume::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->GetDailyShortVolume(req);
cout << "GetDailyShortVolume" << endl;
}
virtual void OnReply_GetDailyShortVolume(Futu::u32_t nSerialNo, const Qot_GetDailyShortVolume::Response &stRsp){
cout << "OnReply_GetDailyShortVolume:" << 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_GetDailyShortVolume seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
hkItemList {
timestamp: 1778169600
timestampStr: "2026-05-08"
sharesTraded: 25207039
turnover: 11871680730.68
shortSellSharesTraded: 2464300
shortSellTurnover: 1161032040
openPrice: 475
closePrice: 471.4
lastClosePrice: 477.4
dailyTradeAvgRatio: 11.36
}
hkItemList {
//...
}
nextKey: "1776960000"
aggregatedShort: 51480638
aggregatedShortRatio: 0.56
newTimeStr: "30/04/2026"
}
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
GetDailyShortVolume(req);
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetDailyShortVolume(){
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.GetDailyShortVolume(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetDailyShortVolume: 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
GetDailyShortVolume: errCode 0, retMsg , retType 0
{
"hkItemList": [{
"timestamp": "1778169600",
"timestampStr": "2026-05-08",
"sharesTraded": "25207039",
"turnover": 11871680730.68,
"shortSellSharesTraded": "2464300",
"shortSellTurnover": 1161032040,
"openPrice": 475,
"closePrice": 471.4,
"lastClosePrice": 477.4,
"dailyTradeAvgRatio": 11.36
//...
}],
"nextKey": "1776960000",
"aggregatedShort": "51480638",
"aggregatedShortRatio": 0.56,
"newTimeStr": "30/04/2026"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Restrictions
- Maximum 30 requests per 30 seconds.
- Supports HK and US stocks and funds.
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_daily_short_volume(stock_code, next_key=None, num=None)
Description
Get daily short volume data for US or HK stocks, with pagination support
Parameters
Parameter Type Description stock_code str Stock code Supports HK and US stocks and funds, e.g. US.AAPL, HK.00700next_key str Pagination key Leave empty for the first request; pass the next_key from the previous response to continue; "-1" indicates no more datanum int Page size Default 10, range 1~50Return
Parameter Type Description ret RET_CODE API call result us_df pd.DataFrame US daily short volume data; error description string when ret != RET_OK hk_df pd.DataFrame HK daily short volume data; None when ret != RET_OK US DataFrame (us_df) field description:
Field Type Description timestamp int Trading day timestamp Unix timestamp in seconds, midnight of the daytimestamp_str str Trading day string Format YYYY-MM-DD, in market timezonetotal_shares_short int Total short shares nasdaq_shares_short int NASDAQ short shares nyse_shares_short int NYSE short shares short_percent float Short ratio Value before the percent sign, e.g. 12.34 means 12.34%volume int Volume (shares) close_price float Close price last_close_price float Previous close price daily_trade_avg_ratio float Daily avg trade ratio Value before the percent sign, e.g. 12.34 means 12.34%; 20-trading-day average ending at the given trading dayUS us_df.attrs additional attributes:
Attribute Type Description next_key str Pagination key "-1" indicates no more dataHK DataFrame (hk_df) field description:
Field Type Description timestamp int Trading day timestamp Unix timestamp in seconds, midnight of the daytimestamp_str str Trading day string Format YYYY-MM-DD, in market timezoneshares_traded int Volume (shares) turnover float Turnover short_sell_shares_traded int Short sell volume (shares) short_sell_turnover float Short sell turnover open_price float Open price close_price float Close price last_close_price float Previous close price daily_trade_avg_ratio float Daily avg trade ratio Value before the percent sign, e.g. 12.34 means 12.34%; 20-trading-day average ending at the given trading dayHK hk_df.attrs additional attributes:
Attribute Type Description next_key str Pagination key "-1" indicates no more dataaggregated_short int Aggregated short position (shares) HK onlyaggregated_short_ratio float Ratio of outstanding shares Value before the percent sign, e.g. 12.34 means 12.34%; HK onlynew_time_str str Latest data time Format YYYY-MM-DD, in market timezone; HK only
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, us_df, hk_df = quote_ctx.get_daily_short_volume("HK.00700")
if ret == RET_OK:
print(hk_df)
else:
print('error:', hk_df)
quote_ctx.close()
2
3
4
5
6
7
8
9
- Output
timestamp timestamp_str ... last_close_price daily_trade_avg_ratio
0 1778169600 2026-05-08 ... 477.4 11.36
1 1778083200 2026-05-07 ... 463.0 11.80
2 1777996800 2026-05-06 ... 472.2 12.22
3 1777910400 2026-05-05 ... 473.0 12.76
4 1777824000 2026-05-04 ... 467.8 13.02
5 1777478400 2026-04-30 ... 479.2 13.09
6 1777392000 2026-04-29 ... 473.8 14.02
7 1777305600 2026-04-28 ... 478.6 14.13
8 1777219200 2026-04-27 ... 493.4 14.14
9 1776960000 2026-04-24 ... 495.2 14.18
[10 rows x 10 columns]
2
3
4
5
6
7
8
9
10
11
12
13
# Qot_GetDailyShortVolume.proto
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
// US daily short volume item
message UsDailyShortVolumeItem
{
optional int64 timestamp = 1; // Trading day timestamp (seconds, midnight)
optional string timestampStr = 2; // Trading day string, format YYYY-MM-DD, in market timezone
optional uint64 totalSharesShort = 3; // Total short shares
optional uint64 nasdaqSharesShort = 4; // NASDAQ short shares
optional uint64 nyseSharesShort = 5; // NYSE short shares
optional double shortPercent = 6; // Short ratio, value before percent sign, e.g. 12.34 means 12.34%
optional uint64 volume = 7; // Volume (shares)
optional double closePrice = 8; // Close price
optional double lastClosePrice = 9; // Previous close price
optional double dailyTradeAvgRatio = 10; // Daily avg trade ratio, value before percent sign; 20-trading-day average ending at the given trading day
}
// HK daily short volume item
message HkDailyShortVolumeItem
{
optional int64 timestamp = 1; // Trading day timestamp (seconds, midnight)
optional string timestampStr = 2; // Trading day string, format YYYY-MM-DD, in market timezone
optional uint64 sharesTraded = 3; // Volume (shares)
optional double turnover = 4; // Turnover
optional uint64 shortSellSharesTraded = 5; // Short sell volume (shares)
optional double shortSellTurnover = 6; // Short sell turnover
optional double openPrice = 7; // Open price
optional double closePrice = 8; // Close price
optional double lastClosePrice = 9; // Previous close price
optional double dailyTradeAvgRatio = 10; // Daily avg trade ratio, value before percent sign; 20-trading-day average ending at the given trading day
}
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
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
- API call result: see RetType
Protocol ID
3248
uint GetDailyShortVolume(QotGetDailyShortVolume.Request req);
virtual void OnReply_GetDailyShortVolume(MMAPI_Conn client, uint nSerialNo, QotGetDailyShortVolume.Response rsp);
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
public class Program : MMSPI_Qot, MMSPI_Conn
{
MMAPI_Qot qot = new MMAPI_Qot();
public Program()
{
qot.SetClientInfo("csharp", 1);
qot.SetConnCallback(this);
qot.SetQotCallback(this);
}
public void Start()
{
qot.InitConnect("127.0.0.1", (ushort)11111, false);
}
public void OnInitConnect(MMAPI_Conn client, long errCode, String desc)
{
Console.Write("Qot onInitConnect: ret={0} desc={1} connID={2}\n", errCode, desc, client.GetConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_HK_Security)
.SetCode("00700")
.Build();
QotGetDailyShortVolume.C2S c2s = QotGetDailyShortVolume.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetDailyShortVolume.Request req = QotGetDailyShortVolume.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetDailyShortVolume(req);
Console.Write("Send QotGetDailyShortVolume: {0}\n", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode)
{
Console.Write("Qot onDisConnect: {0}\n", errCode);
}
public void OnReply_GetDailyShortVolume(MMAPI_Conn client, uint nSerialNo, QotGetDailyShortVolume.Response rsp)
{
Console.Write("Reply: QotGetDailyShortVolume: {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 {
hkItemList {
timestamp: 1778169600
timestampStr: "2026-05-08"
sharesTraded: 25207039
turnover: 11871680730.68
shortSellSharesTraded: 2464300
shortSellTurnover: 1161032040
openPrice: 475
closePrice: 471.4
lastClosePrice: 477.4
dailyTradeAvgRatio: 11.36
}
hkItemList {
//...
}
nextKey: "1776960000"
aggregatedShort: 51480638
aggregatedShortRatio: 0.56
newTimeStr: "30/04/2026"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
int getDailyShortVolume(QotGetDailyShortVolume.Request req);
void onReply_GetDailyShortVolume(MMAPI_Conn client, int nSerialNo, QotGetDailyShortVolume.Response rsp);
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
public class QotDemo implements MMSPI_Qot, MMSPI_Conn {
MMAPI_Conn_Qot qot = new MMAPI_Conn_Qot();
public QotDemo() {
qot.setClientInfo("javaclient", 1);
qot.setConnSpi(this);
qot.setQotSpi(this);
}
public void start() {
qot.initConnect("127.0.0.1", (short)11111, false);
}
@Override
public void onInitConnect(MMAPI_Conn client, long errCode, String desc)
{
System.out.printf("Qot onInitConnect: ret=%b desc=%s connID=%d\n", errCode, desc, client.getConnectID());
if (errCode != 0)
return;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_HK_Security_VALUE)
.setCode("00700")
.build();
QotGetDailyShortVolume.C2S c2s = QotGetDailyShortVolume.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetDailyShortVolume.Request req = QotGetDailyShortVolume.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getDailyShortVolume(req);
System.out.printf("Send QotGetDailyShortVolume: %d\n", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d\n", errCode);
}
@Override
public void onReply_GetDailyShortVolume(MMAPI_Conn client, int nSerialNo, QotGetDailyShortVolume.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetDailyShortVolume failed: %s\n", rsp.getRetMsg());
}
else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetDailyShortVolume: %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=7459212711696991004
Send Qot_GetDailyShortVolume: 2
Receive Qot_GetDailyShortVolume: retType: 0
retMsg: ""
errCode: 0
s2c {
hkItemList {
timestamp: 1778169600
timestampStr: "2026-05-08"
sharesTraded: 25207039
turnover: 1.187168073068E10
shortSellSharesTraded: 2464300
shortSellTurnover: 1.16103204E9
openPrice: 475.0
closePrice: 471.4
lastClosePrice: 477.4
dailyTradeAvgRatio: 11.36
}
hkItemList {
//...
}
nextKey: "1776960000"
aggregatedShort: 51480638
aggregatedShortRatio: 0.56
newTimeStr: "30/04/2026"
}
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
moomoo::u32_t GetDailyShortVolume(const Qot_GetDailyShortVolume::Request &stReq);
virtual void OnReply_GetDailyShortVolume(moomoo::u32_t nSerialNo, const Qot_GetDailyShortVolume::Response &stRsp) = 0;
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
class Program : public MMSPI_Qot, public MMSPI_Trd, public MMSPI_Conn
{
public:
Program() {
m_pQotApi = MMAPI::CreateQotApi();
m_pQotApi->RegisterQotSpi(this);
m_pQotApi->RegisterConnSpi(this);
}
~Program() {
if (m_pQotApi != nullptr)
{
m_pQotApi->UnregisterQotSpi();
m_pQotApi->UnregisterConnSpi();
MMAPI::ReleaseQotApi(m_pQotApi);
m_pQotApi = nullptr;
}
}
void Start() {
m_pQotApi->InitConnect("127.0.0.1", 11111, false);
}
virtual void OnInitConnect(MMAPI_Conn* pConn, moomoo::i64_t nErrCode, const char* strDesc) {
cout << "connect" << endl;
// construct request message
Qot_GetDailyShortVolume::Request req;
Qot_GetDailyShortVolume::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->GetDailyShortVolume(req);
cout << "GetDailyShortVolume" << endl;
}
virtual void OnReply_GetDailyShortVolume(moomoo::u32_t nSerialNo, const Qot_GetDailyShortVolume::Response &stRsp){
cout << "OnReply_GetDailyShortVolume:" << 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_GetDailyShortVolume seqNo=3
retType: 0
retMsg: ""
errCode: 0
s2c {
hkItemList {
timestamp: 1778169600
timestampStr: "2026-05-08"
sharesTraded: 25207039
turnover: 11871680730.68
shortSellSharesTraded: 2464300
shortSellTurnover: 1161032040
openPrice: 475
closePrice: 471.4
lastClosePrice: 477.4
dailyTradeAvgRatio: 11.36
}
hkItemList {
//...
}
nextKey: "1776960000"
aggregatedShort: 51480638
aggregatedShortRatio: 0.56
newTimeStr: "30/04/2026"
}
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
GetDailyShortVolume(req);
Description
Get daily short volume data
Parameters
message C2S
{
required Qot_Common.Security security = 1; // Stock
optional string nextKey = 2; // Pagination key; leave empty for first request, pass previous nextKey to continue; "-1" means no more data
optional int32 num = 3; // Page size, default 10, range 1~50
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- Security structure: see Security
- Return
message S2C
{
repeated UsDailyShortVolumeItem usItemList = 1; // US daily short volume list
repeated HkDailyShortVolumeItem hkItemList = 2; // HK daily short volume list
optional string nextKey = 3; // Pagination key, "-1" means no more data
optional int64 aggregatedShort = 4; // Aggregated short position (shares), HK only
optional double aggregatedShortRatio = 5; // Ratio of outstanding shares, value before percent sign, HK only
optional string newTimeStr = 6; // Latest data time string, format YYYY-MM-DD, in market timezone, HK only
}
message Response
{
required int32 retType = 1 [default = -400]; // Return result, see Common.RetType
optional string retMsg = 2; // Return message
optional int32 errCode = 3; // Error code
optional S2C s2c = 4;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- API call result: see RetType
- Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetDailyShortVolume(){
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.GetDailyShortVolume(req)
.then((res) => {
let { errCode, retMsg, retType,s2c } = res
console.log("GetDailyShortVolume: 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
GetDailyShortVolume: errCode 0, retMsg , retType 0
{
"hkItemList": [{
"timestamp": "1778169600",
"timestampStr": "2026-05-08",
"sharesTraded": "25207039",
"turnover": 11871680730.68,
"shortSellSharesTraded": "2464300",
"shortSellTurnover": 1161032040,
"openPrice": 475,
"closePrice": 471.4,
"lastClosePrice": 477.4,
"dailyTradeAvgRatio": 11.36
//...
}],
"nextKey": "1776960000",
"aggregatedShort": "51480638",
"aggregatedShortRatio": 0.56,
"newTimeStr": "30/04/2026"
}
stop
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Restrictions
- Maximum 30 requests per 30 seconds.
- Supports HK and US stocks and funds.