# 獲取指標列表
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_indicator_list(search_key='', lang_type=IndicatorLangType.NONE, search_mode=IndicatorSearchMode.PARTIAL)
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
參數 類型 說明 search_key str 搜索關鍵詞,留空則返回全部 lang_type IndicatorLangType 指標語言類型,NONE 表示不按語言過濾 search_mode IndicatorSearchMode 匹配模式,默認部分匹配 返回
參數 類型 說明 ret RET_CODE 接口調用結果 data pd.DataFrame 當 ret == RET_OK,返回指標列表 str 當 ret != RET_OK,返回錯誤描述 DataFrame 欄位說明:
欄位 類型 說明 short_name str 指標短名,同語言內唯一 full_name str 指標全名 lang_type IndicatorLangType 指標語言類型 inputs list 輸入參數列表 outputs list 輸出參數列表 script str 指標腳本源碼(僅 search_mode = Exact 且 search_key 非空時返回)
Example
from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_indicator_list('MACD', IndicatorLangType.MYLANG, IndicatorSearchMode.PARTIAL)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close() # 結束後記得關閉當條連接,防止連接條數用盡
2
3
4
5
6
7
8
- Output
short_name full_name lang_type inputs outputs script
0 MACD MACD MyLang [...] [...]
2
# Qot_GetIndicatorList.proto
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1; // 搜索關鍵詞,留空則返回全部
optional int32 langType = 2; // IndicatorLangType;留空或 0 不按語言過濾
optional int32 searchMode = 3; // IndicatorSearchMode,默認部分匹配
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
// 單一語言下的指標信息
message IndicatorInfo
{
optional string shortName = 1; // 指標短名,同語言內唯一
optional string fullName = 2; // 指標全名
repeated Qot_Common.IndicatorInputParam inputs = 3; // 輸入參數列表
repeated Qot_Common.IndicatorOutputParam outputs = 4; // 輸出參數列表
optional string script = 5; // 僅 searchMode = Exact 且 searchKey 非空時返回腳本源碼
}
// 同名指標可能同時有 MyLang / Python 兩個版本,合併為同一條目返回
message IndicatorEntry
{
optional IndicatorInfo myLang = 1; // 麥語言版本(無則不返回)
optional IndicatorInfo python = 2; // Python 版本(無則不返回)
}
message S2C
{
repeated IndicatorEntry indicatorList = 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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 指標輸入參數結構參見 IndicatorInputParam
- 指標輸出參數結構參見 IndicatorOutputParam
- 接口調用結果,結構參見 RetType
協議 ID
3259
uint GetIndicatorList(QotGetIndicatorList.Request req);
virtual void OnReply_GetIndicatorList(FTAPI_Conn client, uint nSerialNo, QotGetIndicatorList.Response rsp);
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1; // 搜索關鍵詞,留空則返回全部
optional int32 langType = 2; // IndicatorLangType;留空或 0 不按語言過濾
optional int32 searchMode = 3; // IndicatorSearchMode,默認部分匹配
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- Example
- Output
int getIndicatorList(QotGetIndicatorList.Request req);
void onReply_GetIndicatorList(FTAPI_Conn client, int nSerialNo, QotGetIndicatorList.Response rsp);
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1; // 搜索關鍵詞,留空則返回全部
optional int32 langType = 2; // IndicatorLangType;留空或 0 不按語言過濾
optional int32 searchMode = 3; // IndicatorSearchMode,默認部分匹配
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- Example
- Output
Futu::u32_t GetIndicatorList(const Qot_GetIndicatorList::Request &stReq);
virtual void OnReply_GetIndicatorList(Futu::u32_t nSerialNo, const Qot_GetIndicatorList::Response &stRsp) = 0;
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1; // 搜索關鍵詞,留空則返回全部
optional int32 langType = 2; // IndicatorLangType;留空或 0 不按語言過濾
optional int32 searchMode = 3; // IndicatorSearchMode,默認部分匹配
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- 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_GetIndicatorList::Request req;
Qot_GetIndicatorList::C2S *c2s = req.mutable_c2s();
c2s->set_searchkey("MACD");
c2s->set_langtype(Qot_Common::IndicatorLangType_MyLang);
c2s->set_searchmode(Qot_Common::IndicatorSearchMode_Partial);
m_GetIndicatorListSerialNo = m_pQotApi->GetIndicatorList(req);
}
virtual void OnReply_GetIndicatorList(Futu::u32_t nSerialNo, const Qot_GetIndicatorList::Response &stRsp) {
if (nSerialNo != m_GetIndicatorListSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
FTAPI_Qot *m_pQotApi;
Futu::u32_t m_GetIndicatorListSerialNo = 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
GetIndicatorList(req);
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1; // 搜索關鍵詞,留空則返回全部
optional int32 langType = 2; // IndicatorLangType;留空或 0 不按語言過濾
optional int32 searchMode = 3; // IndicatorSearchMode,默認部分匹配
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- Example
import ftWebsocket from "futu-api";
import { Common } from "futu-api/proto";
import beautify from "js-beautify";
function QotGetIndicatorList(){
const { RetType } = 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: {
searchKey: "MACD",
langType: 1,
searchMode: 0,
},
};
websocket.GetIndicatorList(req)
.then((res) => {
let { errCode, retMsg, retType, s2c } = res
console.log("GetIndicatorList: 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);
}
QotGetIndicatorList()
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
- Output
GetIndicatorList: errCode 0, retMsg , retType 0
{
"indicatorList": [
{
"myLang": {
"shortName": "MA",
"fullName": "簡單移動平均線",
"inputs": [
{ "index": 0, "name": "price", "type": 1 },
{ "index": 1, "name": "period", "type": 0 }
],
"outputs": [
{ "index": 0, "name": "MA", "type": 1 }
]
},
"python": {
"shortName": "MA",
"fullName": "簡單移動平均線",
"inputs": [
{ "index": 0, "name": "close", "type": 1 },
{ "index": 1, "name": "period", "type": 0 }
],
"outputs": [
{ "index": 0, "name": "MA", "type": 1 }
]
}
},
{
"myLang": {
"shortName": "MACD",
"fullName": "指數平滑移動平均線",
"inputs": [
{ "index": 0, "name": "price", "type": 1 },
{ "index": 1, "name": "SHORT", "type": 0 },
{ "index": 2, "name": "LONG", "type": 0 },
{ "index": 3, "name": "MID", "type": 0 }
],
"outputs": [
{ "index": 0, "name": "DIF", "type": 1 },
{ "index": 1, "name": "DEA", "type": 1 },
{ "index": 2, "name": "MACD", "type": 1 }
]
}
}
]
}
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
- Python
- Proto
- C#
- Java
- C++
- JavaScript
get_indicator_list(search_key='', lang_type=IndicatorLangType.NONE, search_mode=IndicatorSearchMode.PARTIAL)
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
參數 類型 說明 search_key str 搜索關鍵詞,留空則返回全部 lang_type IndicatorLangType 指標語言類型,NONE 表示不按語言過濾 search_mode IndicatorSearchMode 匹配模式,默認部分匹配 返回
參數 類型 說明 ret RET_CODE 接口調用結果 data pd.DataFrame 當 ret == RET_OK,返回指標列表 str 當 ret != RET_OK,返回錯誤描述 DataFrame 欄位說明:
欄位 類型 說明 short_name str 指標短名,同語言內唯一 full_name str 指標全名 lang_type IndicatorLangType 指標語言類型 inputs list 輸入參數列表 outputs list 輸出參數列表 script str 指標腳本源碼(僅 search_mode = Exact 且 search_key 非空時返回)
Example
from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_indicator_list('MACD', IndicatorLangType.MYLANG, IndicatorSearchMode.PARTIAL)
if ret == RET_OK:
print(data)
else:
print('error:', data)
quote_ctx.close() # 結束後記得關閉當條連接,防止連接條數用盡
2
3
4
5
6
7
8
- Output
short_name full_name lang_type inputs outputs script
0 MACD MACD MyLang [...] [...]
2
# Qot_GetIndicatorList.proto
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1; // 搜索關鍵詞,留空則返回全部
optional int32 langType = 2; // IndicatorLangType;留空或 0 不按語言過濾
optional int32 searchMode = 3; // IndicatorSearchMode,默認部分匹配
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
協議 ID
3259
uint GetIndicatorList(QotGetIndicatorList.Request req);
virtual void OnReply_GetIndicatorList(MMAPI_Conn client, uint nSerialNo, QotGetIndicatorList.Response rsp);
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1;
optional int32 langType = 2;
optional int32 searchMode = 3;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- Example
- Output
int getIndicatorList(QotGetIndicatorList.Request req);
void onReply_GetIndicatorList(MMAPI_Conn client, int nSerialNo, QotGetIndicatorList.Response rsp);
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1;
optional int32 langType = 2;
optional int32 searchMode = 3;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- Example
- Output
Moomoo::u32_t GetIndicatorList(const Qot_GetIndicatorList::Request &stReq);
virtual void OnReply_GetIndicatorList(Moomoo::u32_t nSerialNo, const Qot_GetIndicatorList::Response &stRsp) = 0;
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1;
optional int32 langType = 2;
optional int32 searchMode = 3;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- 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_GetIndicatorList::Request req;
Qot_GetIndicatorList::C2S *c2s = req.mutable_c2s();
c2s->set_searchkey("MACD");
c2s->set_langtype(Qot_Common::IndicatorLangType_MyLang);
c2s->set_searchmode(Qot_Common::IndicatorSearchMode_Partial);
m_GetIndicatorListSerialNo = m_pQotApi->GetIndicatorList(req);
}
virtual void OnReply_GetIndicatorList(Moomoo::u32_t nSerialNo, const Qot_GetIndicatorList::Response &stRsp) {
if (nSerialNo != m_GetIndicatorListSerialNo) return;
string resp_str;
ProtoBufToBodyData(stRsp, resp_str);
cout << UTF8ToLocal(resp_str) << endl;
}
protected:
MMAPI_Qot *m_pQotApi;
Moomoo::u32_t m_GetIndicatorListSerialNo = 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
GetIndicatorList(req);
介紹
按關鍵詞、語言類型、匹配模式搜索指標,返回匹配的指標列表。
參數
message C2S
{
optional string searchKey = 1;
optional int32 langType = 2;
optional int32 searchMode = 3;
}
message Request
{
required C2S c2s = 1;
}
2
3
4
5
6
7
8
9
10
11
- 返回
message IndicatorInfo
{
optional string shortName = 1;
optional string fullName = 2;
repeated Qot_Common.IndicatorInputParam inputs = 3;
repeated Qot_Common.IndicatorOutputParam outputs = 4;
optional string script = 5;
}
message IndicatorEntry
{
optional IndicatorInfo myLang = 1;
optional IndicatorInfo python = 2;
}
message S2C
{
repeated IndicatorEntry indicatorList = 1;
}
message Response
{
required int32 retType = 1 [default = -400];
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
- 指標語言類型參見 IndicatorLangType
- 指標搜索模式參見 IndicatorSearchMode
- 接口調用結果,結構參見 RetType
- Example
import mmWebsocket from "moomoo-api";
import { Common } from "moomoo-api/proto";
import beautify from "js-beautify";
function QotGetIndicatorList(){
const { RetType } = 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: {
searchKey: "MACD",
langType: 1,
searchMode: 0,
},
};
websocket.GetIndicatorList(req)
.then((res) => {
let { errCode, retMsg, retType, s2c } = res
console.log("GetIndicatorList: 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);
}
QotGetIndicatorList()
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
- Output
GetIndicatorList: errCode 0, retMsg , retType 0
{
"indicatorList": [
{
"myLang": {
"shortName": "MA",
"fullName": "簡單移動平均線",
"inputs": [
{ "index": 0, "name": "price", "type": 1 },
{ "index": 1, "name": "period", "type": 0 }
],
"outputs": [
{ "index": 0, "name": "MA", "type": 1 }
]
},
"python": {
"shortName": "MA",
"fullName": "簡單移動平均線",
"inputs": [
{ "index": 0, "name": "close", "type": 1 },
{ "index": 1, "name": "period", "type": 0 }
],
"outputs": [
{ "index": 0, "name": "MA", "type": 1 }
]
}
},
{
"myLang": {
"shortName": "MACD",
"fullName": "指數平滑移動平均線",
"inputs": [
{ "index": 0, "name": "price", "type": 1 },
{ "index": 1, "name": "SHORT", "type": 0 },
{ "index": 2, "name": "LONG", "type": 0 },
{ "index": 3, "name": "MID", "type": 0 }
],
"outputs": [
{ "index": 0, "name": "DIF", "type": 1 },
{ "index": 1, "name": "DEA", "type": 1 },
{ "index": 2, "name": "MACD", "type": 1 }
]
}
}
]
}
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