st-comp 0.0.80 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.d.ts +1 -0
- package/es/VarietySearch.cjs +2 -2
- package/es/VarietySearch.js +1457 -1265
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +140 -140
- package/lib/{index-12553849.js → index-f5cc06f7.js} +17185 -16993
- package/lib/{python-5c6d35df.js → python-3072e3ed.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietySearch/components/FactorScreen/index.vue +232 -58
- package/packages/VarietySearch/config.js +6 -4
- package/packages/VarietySearch/index.vue +183 -160
- package/src/pages/VarietySearch/index.vue +21 -14
|
@@ -10,15 +10,24 @@ const props = defineProps({
|
|
|
10
10
|
});
|
|
11
11
|
const searchData = defineModel("searchData", {
|
|
12
12
|
default: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
// 品种市场
|
|
14
|
+
varietyMarket: null,
|
|
15
|
+
// 常用选项
|
|
16
|
+
commonOption: [],
|
|
17
|
+
// 自定标签
|
|
18
|
+
customTag: [],
|
|
19
|
+
// 因子筛选
|
|
20
|
+
factorScreen: {
|
|
21
|
+
list: [],
|
|
22
|
+
sqlEnable: 0,
|
|
23
|
+
sqlValue: null,
|
|
24
|
+
},
|
|
25
|
+
// 常用指标
|
|
26
|
+
commonIndicator: [],
|
|
18
27
|
},
|
|
19
28
|
});
|
|
20
29
|
|
|
21
|
-
//
|
|
30
|
+
// 合并配置项
|
|
22
31
|
const config = computed(() => {
|
|
23
32
|
const result = {};
|
|
24
33
|
Object.keys(defaultConfig).forEach((key) => {
|
|
@@ -46,6 +55,18 @@ const commonOptionDict = computed(() => {
|
|
|
46
55
|
return config.value.commonOption.options;
|
|
47
56
|
}
|
|
48
57
|
});
|
|
58
|
+
// 选项数据源: 自定标签
|
|
59
|
+
const customTagDict = computed(() => {
|
|
60
|
+
return config.value.customTag.options;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 不限
|
|
64
|
+
const clearRow = (key) => {
|
|
65
|
+
if (["commonOption", "customTag", "factorScreen", "commonIndicator"].includes(key)) searchData.value[key] = [];
|
|
66
|
+
else searchData.value[key] = null;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// 监视: 常用选项数据源
|
|
49
70
|
watch(
|
|
50
71
|
() => commonOptionDict.value,
|
|
51
72
|
(newValue) => {
|
|
@@ -57,171 +78,173 @@ watch(
|
|
|
57
78
|
}
|
|
58
79
|
}
|
|
59
80
|
);
|
|
60
|
-
// 选项数据源: 自定标签
|
|
61
|
-
const customTagDict = computed(() => {
|
|
62
|
-
return config.value.customTag.options;
|
|
63
|
-
});
|
|
64
81
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// 1.品种市场
|
|
74
|
-
if (data.varietyMarket) {
|
|
75
|
-
params.exchangeId = String(data.varietyMarket);
|
|
76
|
-
}
|
|
77
|
-
// 2.常用选项
|
|
78
|
-
if (data.commonOption && data.commonOption.length) {
|
|
79
|
-
params.optionId = data.commonOption.join(",");
|
|
80
|
-
}
|
|
81
|
-
// 3.自定标签
|
|
82
|
-
if (data.customTag && data.customTag.length) {
|
|
83
|
-
params.tagIds = data.customTag;
|
|
84
|
-
}
|
|
85
|
-
// 4.因子筛选
|
|
86
|
-
if (data.factorScreen && data.factorScreen.length) {
|
|
87
|
-
params.tbFeatureFactorScores = data.factorScreen.map((item) => {
|
|
88
|
-
return {
|
|
89
|
-
freqId: item.cycle,
|
|
90
|
-
factorId: item.factor,
|
|
91
|
-
startScore: item.score[0],
|
|
92
|
-
endScore: item.score[1],
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
// =====================常用指标相关参数处理=====================
|
|
97
|
-
const QIQUANKYES = ["expireDays", "virtualRealDegree", "yearProfitRate", "impliedVolatility", "levelMultiplier", "turnover", "volume", "openInterest", "optionsCpType", "optionGear"];
|
|
98
|
-
// 1.常用指标-基本面( 表中 type: undefined 的指标, [期权]的常用指标不计入基本面)
|
|
99
|
-
const query = data.commonIndicator.reduce((result, item) => {
|
|
100
|
-
const { key, type, range, unit } = item;
|
|
101
|
-
// 股息率
|
|
102
|
-
if (key === "dividendYield") {
|
|
103
|
-
let [start, end] = range;
|
|
104
|
-
if (!["", null].includes(start)) start = start / 100;
|
|
105
|
-
if (!["", null].includes(end)) end = end / 100;
|
|
106
|
-
result.push({
|
|
107
|
-
column: item.key,
|
|
108
|
-
start,
|
|
109
|
-
end,
|
|
110
|
-
});
|
|
82
|
+
defineExpose({
|
|
83
|
+
// 生成接口传参结构的数据
|
|
84
|
+
formatData: (data) => {
|
|
85
|
+
console.log("%c[st-varietySearch]: 正在生成接口传参结构的数据...", "color: tomato");
|
|
86
|
+
const params = {};
|
|
87
|
+
// 1.品种市场
|
|
88
|
+
if (data.varietyMarket) {
|
|
89
|
+
params.exchangeId = String(data.varietyMarket);
|
|
111
90
|
}
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
91
|
+
// 2.常用选项
|
|
92
|
+
if (data.commonOption?.length) {
|
|
93
|
+
params.optionId = data.commonOption.join(",");
|
|
94
|
+
}
|
|
95
|
+
// 3.自定标签
|
|
96
|
+
if (data.customTag?.length) {
|
|
97
|
+
params.tagIds = data.customTag;
|
|
98
|
+
}
|
|
99
|
+
// 4.因子筛选
|
|
100
|
+
if (config.value.factorScreen?.show) {
|
|
101
|
+
const { factorScreen } = data;
|
|
102
|
+
if (factorScreen?.list?.length) {
|
|
103
|
+
params.tbFeatureFactorScores = factorScreen.list.map((item) => {
|
|
104
|
+
return {
|
|
105
|
+
freqId: item.cycle,
|
|
106
|
+
factorId: item.factor,
|
|
107
|
+
startScore: item.score[0],
|
|
108
|
+
endScore: item.score[1],
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
params.enableSql = factorScreen.sqlEnable === 1 ? 2 : 1;
|
|
113
|
+
if (factorScreen.sqlEnable) {
|
|
114
|
+
params.sql = factorScreen.sqlValue;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// 5.常用指标
|
|
118
|
+
{
|
|
119
|
+
const QIQUANKYES = ["expireDays", "virtualRealDegree", "yearProfitRate", "impliedVolatility", "levelMultiplier", "turnover", "volume", "openInterest", "optionsCpType", "optionGear"];
|
|
120
|
+
// 1.常用指标-基本面( 表中 type: undefined 的指标, [期权]的常用指标不计入基本面)
|
|
121
|
+
const query = data.commonIndicator.reduce((result, item) => {
|
|
122
|
+
const { key, type, range, unit } = item;
|
|
123
|
+
// 股息率
|
|
124
|
+
if (key === "dividendYield") {
|
|
125
|
+
let [start, end] = range;
|
|
126
|
+
if (!["", null].includes(start)) start = start / 100;
|
|
127
|
+
if (!["", null].includes(end)) end = end / 100;
|
|
128
|
+
result.push({
|
|
129
|
+
column: item.key,
|
|
130
|
+
start,
|
|
131
|
+
end,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// 其它基本面指标
|
|
135
|
+
else if (type === undefined && !QIQUANKYES.includes(key)) {
|
|
136
|
+
let [start, end] = range;
|
|
137
|
+
if (!["", null].includes(start)) {
|
|
138
|
+
switch (unit[0]) {
|
|
139
|
+
case "亿":
|
|
140
|
+
start = start * 100000000;
|
|
141
|
+
break;
|
|
142
|
+
case "千万":
|
|
143
|
+
start = start * 10000000;
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
start = start;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!["", null].includes(end)) {
|
|
151
|
+
switch (unit[1]) {
|
|
152
|
+
case "亿":
|
|
153
|
+
end = end * 100000000;
|
|
154
|
+
break;
|
|
155
|
+
case "千万":
|
|
156
|
+
end = end * 10000000;
|
|
157
|
+
break;
|
|
158
|
+
default:
|
|
159
|
+
end = end;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
result.push({
|
|
164
|
+
column: item.key,
|
|
165
|
+
start,
|
|
166
|
+
end,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}, []);
|
|
171
|
+
if (query.length) {
|
|
172
|
+
params.query = query;
|
|
173
|
+
}
|
|
174
|
+
// 2.常用指标-是否ST
|
|
175
|
+
const stIndicator = data.commonIndicator.find(({ key }) => key === "st");
|
|
176
|
+
if (stIndicator) {
|
|
177
|
+
params.st = stIndicator.st;
|
|
178
|
+
}
|
|
179
|
+
// 3.常用指标-净利润
|
|
180
|
+
const netProfitQueryDto = data.commonIndicator.find(({ key }) => key === "tFeaturelncomes");
|
|
181
|
+
if (netProfitQueryDto) {
|
|
182
|
+
params.netProfitQueryDto = { ...netProfitQueryDto, netProfit: netProfitQueryDto.netProfit * 100000000.0 };
|
|
183
|
+
}
|
|
184
|
+
// 4.常用指标-期权相关参数
|
|
185
|
+
const searchOptionDto = {};
|
|
186
|
+
data.commonIndicator.forEach((item) => {
|
|
187
|
+
const { key } = item;
|
|
188
|
+
switch (key) {
|
|
189
|
+
// 过期时间
|
|
190
|
+
case "expireDays":
|
|
191
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minExpireDays = item.range[0];
|
|
192
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxExpireDays = item.range[1];
|
|
119
193
|
break;
|
|
120
|
-
|
|
121
|
-
|
|
194
|
+
// 虚实度
|
|
195
|
+
case "virtualRealDegree":
|
|
196
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minVirtualRealDegree = item.range[0] / 100;
|
|
197
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxVirtualRealDegree = item.range[1] / 100;
|
|
122
198
|
break;
|
|
123
|
-
|
|
124
|
-
|
|
199
|
+
// 年化收益率
|
|
200
|
+
case "yearProfitRate":
|
|
201
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minYearProfitRate = item.range[0] / 100;
|
|
202
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxYearProfitRate = item.range[1] / 100;
|
|
125
203
|
break;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
204
|
+
// 隐含波动率
|
|
205
|
+
case "impliedVolatility":
|
|
206
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minImpliedVolatility = item.range[0] / 100;
|
|
207
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxImpliedVolatility = item.range[1] / 100;
|
|
208
|
+
break;
|
|
209
|
+
// 杠杆率
|
|
210
|
+
case "levelMultiplier":
|
|
211
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minLevelMultiplier = item.range[0];
|
|
212
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxLevelMultiplier = item.range[1];
|
|
213
|
+
break;
|
|
214
|
+
// 成交额(期权)
|
|
215
|
+
case "turnover":
|
|
216
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minTurnover = item.range[0] * 10000;
|
|
217
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxTurnover = item.range[1] * 10000;
|
|
218
|
+
break;
|
|
219
|
+
// 成交量
|
|
220
|
+
case "volume":
|
|
221
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minVolume = item.range[0];
|
|
222
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxVolume = item.range[1];
|
|
223
|
+
break;
|
|
224
|
+
// 持仓量
|
|
225
|
+
case "openInterest":
|
|
226
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minOpenInterest = item.range[0];
|
|
227
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxOpenInterest = item.range[1];
|
|
132
228
|
break;
|
|
133
|
-
|
|
134
|
-
|
|
229
|
+
// 认沽认购
|
|
230
|
+
case "optionsCpType":
|
|
231
|
+
searchOptionDto.optionsCpType = item.optionsCpType;
|
|
135
232
|
break;
|
|
136
|
-
|
|
137
|
-
|
|
233
|
+
// 期权档位
|
|
234
|
+
case "optionGear":
|
|
235
|
+
if (!["", null].includes(item.range[0])) searchOptionDto.minOptionGear = item.range[0];
|
|
236
|
+
if (!["", null].includes(item.range[1])) searchOptionDto.maxOptionGear = item.range[1];
|
|
138
237
|
break;
|
|
139
238
|
}
|
|
140
|
-
}
|
|
141
|
-
result.push({
|
|
142
|
-
column: item.key,
|
|
143
|
-
start,
|
|
144
|
-
end,
|
|
145
239
|
});
|
|
240
|
+
if (Object.keys(searchOptionDto).length) {
|
|
241
|
+
params.searchOptionDto = searchOptionDto;
|
|
242
|
+
}
|
|
146
243
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
// 2.常用指标-是否ST
|
|
153
|
-
const stIndicator = data.commonIndicator.find(({ key }) => key === "st");
|
|
154
|
-
if (stIndicator) {
|
|
155
|
-
params.st = stIndicator.st;
|
|
156
|
-
}
|
|
157
|
-
// 3.常用指标-净利润
|
|
158
|
-
const netProfitQueryDto = data.commonIndicator.find(({ key }) => key === "tFeaturelncomes");
|
|
159
|
-
if (netProfitQueryDto) {
|
|
160
|
-
params.netProfitQueryDto = { ...netProfitQueryDto, netProfit: netProfitQueryDto.netProfit * 100000000.0 };
|
|
161
|
-
}
|
|
162
|
-
// 4.常用指标-期权相关参数
|
|
163
|
-
const searchOptionDto = {};
|
|
164
|
-
data.commonIndicator.forEach((item) => {
|
|
165
|
-
const { key } = item;
|
|
166
|
-
switch (key) {
|
|
167
|
-
// 过期时间
|
|
168
|
-
case "expireDays":
|
|
169
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minExpireDays = item.range[0];
|
|
170
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxExpireDays = item.range[1];
|
|
171
|
-
break;
|
|
172
|
-
// 虚实度
|
|
173
|
-
case "virtualRealDegree":
|
|
174
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minVirtualRealDegree = item.range[0] / 100;
|
|
175
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxVirtualRealDegree = item.range[1] / 100;
|
|
176
|
-
break;
|
|
177
|
-
// 年化收益率
|
|
178
|
-
case "yearProfitRate":
|
|
179
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minYearProfitRate = item.range[0] / 100;
|
|
180
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxYearProfitRate = item.range[1] / 100;
|
|
181
|
-
break;
|
|
182
|
-
// 隐含波动率
|
|
183
|
-
case "impliedVolatility":
|
|
184
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minImpliedVolatility = item.range[0] / 100;
|
|
185
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxImpliedVolatility = item.range[1] / 100;
|
|
186
|
-
break;
|
|
187
|
-
// 杠杆率
|
|
188
|
-
case "levelMultiplier":
|
|
189
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minLevelMultiplier = item.range[0];
|
|
190
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxLevelMultiplier = item.range[1];
|
|
191
|
-
break;
|
|
192
|
-
// 成交额(期权)
|
|
193
|
-
case "turnover":
|
|
194
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minTurnover = item.range[0] * 10000;
|
|
195
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxTurnover = item.range[1] * 10000;
|
|
196
|
-
break;
|
|
197
|
-
// 成交量
|
|
198
|
-
case "volume":
|
|
199
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minVolume = item.range[0];
|
|
200
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxVolume = item.range[1];
|
|
201
|
-
break;
|
|
202
|
-
// 持仓量
|
|
203
|
-
case "openInterest":
|
|
204
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minOpenInterest = item.range[0];
|
|
205
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxOpenInterest = item.range[1];
|
|
206
|
-
break;
|
|
207
|
-
// 认沽认购
|
|
208
|
-
case "optionsCpType":
|
|
209
|
-
searchOptionDto.optionsCpType = item.optionsCpType;
|
|
210
|
-
break;
|
|
211
|
-
// 期权档位
|
|
212
|
-
case "optionGear":
|
|
213
|
-
if (!["", null].includes(item.range[0])) searchOptionDto.minOptionGear = item.range[0];
|
|
214
|
-
if (!["", null].includes(item.range[1])) searchOptionDto.maxOptionGear = item.range[1];
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
if (Object.keys(searchOptionDto).length) {
|
|
219
|
-
params.searchOptionDto = searchOptionDto;
|
|
220
|
-
}
|
|
221
|
-
return params;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
defineExpose({ formatData });
|
|
244
|
+
console.log("%c[st-varietySearch]: 接口传参数据生成完毕", "color: green", params);
|
|
245
|
+
return params;
|
|
246
|
+
},
|
|
247
|
+
});
|
|
225
248
|
</script>
|
|
226
249
|
|
|
227
250
|
<template>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div style="width: 100%; height: 100%">
|
|
3
|
-
<st-varietySearch
|
|
3
|
+
<st-varietySearch
|
|
4
|
+
ref="varietySearchRef"
|
|
5
|
+
v-model:searchData="varietySearchData"
|
|
6
|
+
:config="varietySearchConfig"
|
|
7
|
+
/>
|
|
4
8
|
<el-button @click="query">查询</el-button>
|
|
5
|
-
<br/>
|
|
9
|
+
<br />
|
|
6
10
|
<p>格式化后的查询参数:</p>
|
|
7
11
|
<p>{{ formatData }}</p>
|
|
8
12
|
</div>
|
|
@@ -13,11 +17,15 @@ import { ref, watch, reactive } from "vue";
|
|
|
13
17
|
|
|
14
18
|
const varietySearchRef = ref(null);
|
|
15
19
|
const varietySearchData = ref({
|
|
16
|
-
varietyMarket: null,
|
|
17
|
-
commonOption: [],
|
|
18
|
-
customTag: [],
|
|
19
|
-
factorScreen:
|
|
20
|
-
|
|
20
|
+
varietyMarket: null,
|
|
21
|
+
commonOption: [],
|
|
22
|
+
customTag: [],
|
|
23
|
+
factorScreen: {
|
|
24
|
+
list: [],
|
|
25
|
+
sqlEnable: 0,
|
|
26
|
+
sqlValue: null,
|
|
27
|
+
},
|
|
28
|
+
commonIndicator: [],
|
|
21
29
|
});
|
|
22
30
|
const varietySearchConfig = ref({
|
|
23
31
|
// 品种市场
|
|
@@ -39,16 +47,15 @@ const varietySearchConfig = ref({
|
|
|
39
47
|
// 因子筛选
|
|
40
48
|
factorScreen: {
|
|
41
49
|
show: true,
|
|
42
|
-
// cycleDefault: 1,
|
|
43
50
|
cycleOptions: [
|
|
44
51
|
{ label: "周期一", value: 1 },
|
|
45
52
|
{ label: "周期二", value: 2 },
|
|
46
53
|
],
|
|
47
|
-
// cycleShow: true,
|
|
48
54
|
factorOptions: [
|
|
49
55
|
{ label: "因子一", value: 1 },
|
|
50
56
|
{ label: "因子二", value: 2 },
|
|
51
57
|
],
|
|
58
|
+
sqlShow: true,
|
|
52
59
|
},
|
|
53
60
|
// 常用指标
|
|
54
61
|
commonIndicator: {
|
|
@@ -56,10 +63,10 @@ const varietySearchConfig = ref({
|
|
|
56
63
|
},
|
|
57
64
|
});
|
|
58
65
|
|
|
59
|
-
const formatData = ref(null)
|
|
66
|
+
const formatData = ref(null);
|
|
60
67
|
|
|
61
68
|
const query = () => {
|
|
62
|
-
const res = varietySearchRef.value.formatData(varietySearchData.value)
|
|
63
|
-
formatData.value = res
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
69
|
+
const res = varietySearchRef.value.formatData(varietySearchData.value);
|
|
70
|
+
formatData.value = res;
|
|
71
|
+
};
|
|
72
|
+
</script>
|