st-comp 0.0.39 → 0.0.41

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.39",
4
+ "version": "0.0.41",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -310,6 +310,7 @@ const draw = async (type?: string) => {
310
310
  [
311
311
  "future",
312
312
  async () => {
313
+ const chartOption = echartsInstance.getOption();
313
314
  const newOption = await getOption(
314
315
  props.klineData as KlineDataType,
315
316
  props.markData,
@@ -318,7 +319,7 @@ const draw = async (type?: string) => {
318
319
  props.netPositionData
319
320
  );
320
321
  newOption.dataZoom[0].start =
321
- ((props.klineData.length - config.value.defaultShowBarCount) / props.klineData.length) * 100;
322
+ ((props.klineData.length - chartOption.dataZoom[0].endValue + chartOption.dataZoom[0].startValue) / props.klineData.length) * 100;
322
323
  echartsInstance.setOption(newOption, true);
323
324
  },
324
325
  ],
@@ -538,9 +538,18 @@ const handleSellBuyConfig = (data: any[], originData: KlineDataType) => {
538
538
  * 因为传入参数数据时,已经对数据进行了合并处理,不会出现例如: 两个平空数据于一条K线上,这种情况,所以
539
539
  * 简单判断该条K线上是否有多个数据即可判断出是否是买卖同时存在,如果同时存在图标变成T
540
540
  */
541
+ const timeTradeList = data.filter((item: any) => item.time === next.time)
541
542
  let symbol = "image://" + new URL(`./images/${tradeType === "买" ? "buy" : "sell"}.svg`, import.meta.url).href;
542
- if (data.filter((item: any) => item.time === next.time).length > 1) {
543
- symbol = "image://" + new URL("./images/t.svg", import.meta.url).href;
543
+ if (timeTradeList.length > 1) {
544
+ // 存在多条数据, 处理出他们的交易类型, 进行去重
545
+ const timeTradeTypes = [...new Set(...timeTradeList.map(i => handleTradeType(i, "sellBuy")))]
546
+ if (timeTradeTypes.length > 1) {
547
+ symbol = "image://" + new URL("./images/t.svg", import.meta.url).href;
548
+ } else {
549
+ symbol = "image://" + new URL(`./images/${tradeType === "买" ? "buy" : "sell"}.svg`, import.meta.url).href;
550
+ }
551
+ } else {
552
+ symbol = "image://" + new URL(`./images/${tradeType === "买" ? "buy" : "sell"}.svg`, import.meta.url).href;
544
553
  }
545
554
  // 3.获取对应Y轴值
546
555
  const originDataItem = originData.find((item: any) => item[0] === next.time) ?? [];
@@ -63,7 +63,7 @@ export const getNetPositionData = async (data: any) => {
63
63
  return axios({
64
64
  method: 'post',
65
65
  headers: {
66
- token: 'e077632625ea4b11506db312e186dd06',
66
+ token: 'b1ef55eb206f7ae49b85b528231c5d87',
67
67
  },
68
68
  url: 'http://192.168.12.49:88/invest/analysis/queryVarietyNetPositionValue',
69
69
  data
@@ -116,16 +116,17 @@ const config = ref({
116
116
  const { totalBarCount, preBarCount } = config.value;
117
117
  // 1.如果当前K线数据量就小于API希望得到的数量,说明已经没有数据了,将API得到的数据作全部展示
118
118
  // 并且打上标记,此K线数据已无更多
119
- if (klineData.value.length < totalBarCount + preBarCount) {
120
- config.value.totalBarCount = klineData.value.length;
121
- console.log("K线数据已无更多-1");
122
- futureIsAllLoad.value = true;
123
- return;
124
- }
119
+ // if (klineData.value.length < totalBarCount + preBarCount) {
120
+ // config.value.totalBarCount = klineData.value.length;
121
+ // console.log("K线数据已无更多-1");
122
+ // futureIsAllLoad.value = true;
123
+ // return;
124
+ // }
125
125
  // 2.已当前存储的K线数据最后一条时间作为开始时间,往后再次请求
126
126
  const params = {
127
- right: 1, // 复权方式
128
- variety: "au8888", // 品种
127
+ contractType: 0,
128
+ right: 0, // 复权方式
129
+ variety: "FU", // 品种
129
130
  cycle: cycle.value, // 周期
130
131
  startTime: klineData.value[klineData.value.length - 1][0], // 开始
131
132
  limit: 20, // 总条数
@@ -190,12 +191,12 @@ const getKlineData = async () => {
190
191
  const params = {
191
192
  contractType: 0,
192
193
  cycle: cycle.value,
193
- endTime: "2022-12-23 00:00:00",
194
+ endTime: "2015-04-09 15:00:00",
194
195
  preLimit: 800,
195
196
  queryType: 0,
196
197
  right: 0,
197
- startTime: "2020-12-23 00:00:00",
198
- variety: "FU",
198
+ startTime: "2015-02-08 15:00:00",
199
+ variety: "IF",
199
200
  };
200
201
  const res = await getSingleCycleSingleVariety(params);
201
202
  klineData.value = res.data.body;
@@ -206,10 +207,10 @@ const getKlineData = async () => {
206
207
  const getKlinePointData = async () => {
207
208
  // ------
208
209
  const params = {
209
- analyseId: 2229,
210
+ analyseId: 2248,
210
211
  cycle: cycle.value,
211
212
  ifStock: 0,
212
- varietyName: "燃料油",
213
+ varietyName: "沪深300",
213
214
  };
214
215
  const res = await queryPairedRecordByVariety(params);
215
216
  const body = res.data.body;