# 获取ARK个股交易动态
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_ark_stock_dynamic(security)
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
参数 类型 说明 security str 股票代码(如 'US.TSLA')(必填)返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回字典数据 str 当 ret != RET_OK,返回错误描述 - 数据格式如下:
字段 类型 说明 dynamic_type str 动态类型(见下方枚举) transaction_count int 交易次数 net_shares int 净交易股数 last_transaction_time str 最近交易时间(yyyy-MM-dd) "CONSECUTIVE_SAME_DIRECTION" 连续同向交易 "RECENT_TRANSACTION" 近期交易 "LAST_TRANSACTION" 最近一笔 "NO_DYNAMIC" 无动态
- 数据格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_ark_stock_dynamic(security='US.TSLA')
if ret == RET_OK:
for k, v in data.items():
print(f"{k}: {v}")
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
- Output
dynamic_type: CONSECUTIVE_SAME_DIRECTION
transaction_count: 2
net_shares: 76041
last_transaction_time: 2026-06-22
2
3
4
# Qot_GetArkStockDynamic.proto
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
协议 ID
3424
uint GetArkStockDynamic(Qot_GetArkStockDynamic.Request req);
virtual void OnReply_GetArkStockDynamic(FTAPI_Conn client, uint nSerialNo, Qot_GetArkStockDynamic.Response rsp);
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
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;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_US_Security)
.SetCode("TSLA")
.Build();
QotGetArkStockDynamic.C2S c2s = QotGetArkStockDynamic.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetArkStockDynamic.Request req = QotGetArkStockDynamic.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetArkStockDynamic(req);
Console.Write("Send QotGetArkStockDynamic: {0}
", seqNo);
}
public void OnDisconnect(FTAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetArkStockDynamic(FTAPI_Conn client, uint nSerialNo, QotGetArkStockDynamic.Response rsp)
{
Console.Write("Reply: QotGetArkStockDynamic: {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
54
55
56
- Output
Send QotGetArkStockDynamic: 3
Reply: QotGetArkStockDynamic: 3
GetArkStockDynamic: errCode 0, retMsg , retType 0
{
"dynamicType": 1,
"transactionCount": 3,
"netShares": -29523,
"lastTransactionTime": "2026-06-17"
}
2
3
4
5
6
7
8
9
int getArkStockDynamic(Qot_GetArkStockDynamic.Request req);
onReply_GetArkStockDynamic(FTAPI_Conn client, int nSerialNo, Qot_GetArkStockDynamic.Response rsp)
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
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;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_US_Security_VALUE)
.setCode("TSLA")
.build();
QotGetArkStockDynamic.C2S c2s = QotGetArkStockDynamic.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetArkStockDynamic.Request req = QotGetArkStockDynamic.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getArkStockDynamic(req);
System.out.printf("Send QotGetArkStockDynamic: %d
", seqNo);
}
@Override
public void onDisconnect(FTAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetArkStockDynamic(FTAPI_Conn client, int nSerialNo, QotGetArkStockDynamic.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetArkStockDynamic failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetArkStockDynamic: %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
68
69
70
- Output
Send QotGetArkStockDynamic: 3
Receive QotGetArkStockDynamic: {
"dynamicType": 1,
"transactionCount": 3,
"netShares": -29523,
"lastTransactionTime": "2026-06-17"
}
2
3
4
5
6
7
Futu::u32_t GetArkStockDynamic(const Qot_GetArkStockDynamic::Request &stReq); virtual void OnReply_GetArkStockDynamic(Futu::u32_t nSerialNo, const Qot_GetArkStockDynamic::Response &stRsp) = 0;
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
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_GetArkStockDynamic::Request req;
Qot_GetArkStockDynamic::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *security = c2s->mutable_security();
security->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
security->set_code("AAPL");
m_GetArkStockDynamicSerialNo = m_pQotApi->GetArkStockDynamic(req);
}
virtual void OnReply_GetArkStockDynamic(Futu::u32_t nSerialNo, const Qot_GetArkStockDynamic::Response &stRsp) {
if (nSerialNo != m_GetArkStockDynamicSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetArkStockDynamicSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dynamicType": 0,
"transactionCount": 5,
"netShares": 250000,
"lastTransactionTime": "2024-06-03"
}
}
2
3
4
5
6
7
8
9
10
11
getArkStockDynamic(qotGetArkStockDynamic)
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
Example
import ftWebsocket from "futu-api";
import { Common, Qot_Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetArkStockDynamic(){
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: { security: { market: Qot_Common.QotMarket.QotMarket_US_Security, code: "TSLA" } },
};
websocket.GetArkStockDynamic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetArkStockDynamic: 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);
}
QotGetArkStockDynamic()
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
GetArkStockDynamic: errCode 0, retMsg , retType 0
{
"dynamicType": 1,
"transactionCount": 3,
"netShares": -29523,
"lastTransactionTime": "2026-06-17"
}
2
3
4
5
6
7
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_ark_stock_dynamic(security)
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
参数 类型 说明 security str 股票代码(如 'US.TSLA')(必填)返回
参数 类型 说明 ret RET_CODE 接口调用结果 data dict 当 ret == RET_OK,返回字典数据 str 当 ret != RET_OK,返回错误描述 - 数据格式如下:
字段 类型 说明 dynamic_type str 动态类型(见下方枚举) transaction_count int 交易次数 net_shares int 净交易股数 last_transaction_time str 最近交易时间(yyyy-MM-dd) "CONSECUTIVE_SAME_DIRECTION" 连续同向交易 "RECENT_TRANSACTION" 近期交易 "LAST_TRANSACTION" 最近一笔 "NO_DYNAMIC" 无动态
- 数据格式如下:
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_ark_stock_dynamic(security='US.TSLA')
if ret == RET_OK:
for k, v in data.items():
print(f"{k}: {v}")
else:
print('error:', data)
quote_ctx.close()
2
3
4
5
6
7
8
9
10
11
12
- Output
dynamic_type: CONSECUTIVE_SAME_DIRECTION
transaction_count: 2
net_shares: 76041
last_transaction_time: 2026-06-22
2
3
4
# Qot_GetArkStockDynamic.proto
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
协议 ID
3424
uint GetArkStockDynamic(Qot_GetArkStockDynamic.Request req);
virtual void OnReply_GetArkStockDynamic(FTAPI_Conn client, uint nSerialNo, Qot_GetArkStockDynamic.Response rsp);
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
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;
QotCommon.Security sec = QotCommon.Security.CreateBuilder()
.SetMarket((int)QotCommon.QotMarket.QotMarket_US_Security)
.SetCode("TSLA")
.Build();
QotGetArkStockDynamic.C2S c2s = QotGetArkStockDynamic.C2S.CreateBuilder()
.SetSecurity(sec)
.Build();
QotGetArkStockDynamic.Request req = QotGetArkStockDynamic.Request.CreateBuilder().SetC2S(c2s).Build();
uint seqNo = qot.GetArkStockDynamic(req);
Console.Write("Send QotGetArkStockDynamic: {0}
", seqNo);
}
public void OnDisconnect(MMAPI_Conn client, long errCode) {
Console.Write("Qot onDisConnect: {0}
", errCode);
}
public void OnReply_GetArkStockDynamic(MMAPI_Conn client, uint nSerialNo, QotGetArkStockDynamic.Response rsp)
{
Console.Write("Reply: QotGetArkStockDynamic: {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
54
55
56
- Output
Send QotGetArkStockDynamic: 3
Reply: QotGetArkStockDynamic: 3
GetArkStockDynamic: errCode 0, retMsg , retType 0
{
"dynamicType": 1,
"transactionCount": 3,
"netShares": -29523,
"lastTransactionTime": "2026-06-17"
}
2
3
4
5
6
7
8
9
int getArkStockDynamic(Qot_GetArkStockDynamic.Request req);
onReply_GetArkStockDynamic(FTAPI_Conn client, int nSerialNo, Qot_GetArkStockDynamic.Response rsp)
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
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;
QotCommon.Security sec = QotCommon.Security.newBuilder()
.setMarket(QotCommon.QotMarket.QotMarket_US_Security_VALUE)
.setCode("TSLA")
.build();
QotGetArkStockDynamic.C2S c2s = QotGetArkStockDynamic.C2S.newBuilder()
.setSecurity(sec)
.build();
QotGetArkStockDynamic.Request req = QotGetArkStockDynamic.Request.newBuilder().setC2S(c2s).build();
int seqNo = qot.getArkStockDynamic(req);
System.out.printf("Send QotGetArkStockDynamic: %d
", seqNo);
}
@Override
public void onDisconnect(MMAPI_Conn client, long errCode) {
System.out.printf("Qot onDisConnect: %d
", errCode);
}
@Override
public void onReply_GetArkStockDynamic(MMAPI_Conn client, int nSerialNo, QotGetArkStockDynamic.Response rsp) {
if (rsp.getRetType() != 0) {
System.out.printf("QotGetArkStockDynamic failed: %s
", rsp.getRetMsg());
} else {
try {
String json = JsonFormat.printer().print(rsp);
System.out.printf("Receive QotGetArkStockDynamic: %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
68
69
70
- Output
Send QotGetArkStockDynamic: 3
Receive QotGetArkStockDynamic: {
"dynamicType": 1,
"transactionCount": 3,
"netShares": -29523,
"lastTransactionTime": "2026-06-17"
}
2
3
4
5
6
7
moomoo::u32_t GetArkStockDynamic(const Qot_GetArkStockDynamic::Request &stReq); virtual void OnReply_GetArkStockDynamic(moomoo::u32_t nSerialNo, const Qot_GetArkStockDynamic::Response &stRsp) = 0;
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
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_GetArkStockDynamic::Request req;
Qot_GetArkStockDynamic::C2S *c2s = req.mutable_c2s();
Qot_Common::Security *security = c2s->mutable_security();
security->set_market(Qot_Common::QotMarket::QotMarket_US_Security);
security->set_code("AAPL");
m_GetArkStockDynamicSerialNo = m_pQotApi->GetArkStockDynamic(req);
}
virtual void OnReply_GetArkStockDynamic(moomoo::u32_t nSerialNo, const Qot_GetArkStockDynamic::Response &stRsp) {
if (nSerialNo != m_GetArkStockDynamicSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
moomoo::u32_t m_GetArkStockDynamicSerialNo = 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
- Output
{
"retType": 0,
"retMsg": "",
"errCode": 0,
"s2c": {
"dynamicType": 0,
"transactionCount": 5,
"netShares": 250000,
"lastTransactionTime": "2024-06-03"
}
}
2
3
4
5
6
7
8
9
10
11
getArkStockDynamic(qotGetArkStockDynamic)
介绍
获取 ARK 个股交易动态,返回指定股票在 ARK 基金中的最新交易动态信息(连续同向交易、近期交易、最近一笔等)。
参数
// 交易动态类型
enum DynamicType {
DynamicType_Unknown = 0;
DynamicType_ConsecutiveSameDirection = 1; // 连续同向交易
DynamicType_RecentTransaction = 2; // 近期交易
DynamicType_LastTransaction = 3; // 最近一笔
DynamicType_NoDynamic = 4; // 无动态
}
message C2S {
required Qot_Common.Security security = 1; // 股票
}
message S2C {
optional int32 dynamicType = 1; // DynamicType
optional int32 transactionCount = 2; // 交易次数
optional int64 netShares = 3; // 净交易股数
optional string lastTransactionTime = 4; // 最近交易时间(yyyy-MM-dd)
}
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
- 接口调用结果,结构参见 RetType
协议 ID
3424
Example
import mmWebsocket from "moomoo-api";
import { Common, Qot_Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetArkStockDynamic(){
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: { security: { market: Qot_Common.QotMarket.QotMarket_US_Security, code: "TSLA" } },
};
websocket.GetArkStockDynamic(req)
.then((res)=>{
let { errCode, retMsg, retType, s2c } = res
console.log("GetArkStockDynamic: 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);
}
QotGetArkStockDynamic()
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
GetArkStockDynamic: errCode 0, retMsg , retType 0
{
"dynamicType": 1,
"transactionCount": 3,
"netShares": -29523,
"lastTransactionTime": "2026-06-17"
}
2
3
4
5
6
7
接口限制
- 30 秒内最多 60 次请求
- 分页请求仅首页计入限频统计
← 获取ARK基金持仓 获取ARK主动交易聚合 →