@ch20026103/anysis 0.0.9-alpha → 0.0.10-alpha
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/demo/main.js +5 -2
- package/dist/cjs/stockSkills/ma.d.ts +21 -0
- package/dist/cjs/stockSkills/ma.js +11 -3
- package/dist/esm/stockSkills/ma.d.ts +21 -0
- package/dist/esm/stockSkills/ma.js +11 -3
- package/dist/umd/index.js +11 -3
- package/package.json +1 -1
package/demo/main.js
CHANGED
|
@@ -102,8 +102,11 @@ function DemoWeek() {
|
|
|
102
102
|
console.log({
|
|
103
103
|
t: weekMaData5.dataset[weekMaData5.dataset.length - 1].t,
|
|
104
104
|
ma5: weekMaData5.ma,
|
|
105
|
+
ma5ExclusionValue: weekMaData5.exclusionValue,
|
|
105
106
|
ma10: weekMaData10.ma,
|
|
107
|
+
ma10ExclusionValue: weekMaData10.exclusionValue,
|
|
106
108
|
ma20: weekMaData20.ma,
|
|
109
|
+
ma20ExclusionValue: weekMaData20.exclusionValue,
|
|
107
110
|
});
|
|
108
111
|
})
|
|
109
112
|
.catch((error) => {
|
|
@@ -114,9 +117,9 @@ function DemoWeek() {
|
|
|
114
117
|
});
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
DemoDay();
|
|
120
|
+
// DemoDay();
|
|
118
121
|
|
|
119
|
-
const showWeek =
|
|
122
|
+
const showWeek = true;
|
|
120
123
|
if (showWeek) {
|
|
121
124
|
DemoWeek();
|
|
122
125
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type DataType = {
|
|
2
2
|
c: number;
|
|
3
|
+
[key: string]: unknown;
|
|
3
4
|
};
|
|
4
5
|
type ListType = DataType[];
|
|
5
6
|
type ResMa5 = {
|
|
@@ -35,15 +36,27 @@ interface MaType {
|
|
|
35
36
|
dataset: ListType;
|
|
36
37
|
ma: number;
|
|
37
38
|
type: number;
|
|
39
|
+
exclusionValue: {
|
|
40
|
+
d: number;
|
|
41
|
+
"d-1": number;
|
|
42
|
+
};
|
|
38
43
|
};
|
|
39
44
|
next: (data: DataType, preList: {
|
|
40
45
|
dataset: ListType;
|
|
41
46
|
ma: number;
|
|
42
47
|
type: number;
|
|
48
|
+
exclusionValue: {
|
|
49
|
+
d: number;
|
|
50
|
+
"d-1": number;
|
|
51
|
+
};
|
|
43
52
|
}, type: number) => {
|
|
44
53
|
dataset: ListType;
|
|
45
54
|
ma: number;
|
|
46
55
|
type: number;
|
|
56
|
+
exclusionValue: {
|
|
57
|
+
d: number;
|
|
58
|
+
"d-1": number;
|
|
59
|
+
};
|
|
47
60
|
};
|
|
48
61
|
getAllMa: (list: ListType) => ResAllMa;
|
|
49
62
|
getMa5: (list: ListType) => ResMa5;
|
|
@@ -57,6 +70,10 @@ export default class Ma implements MaType {
|
|
|
57
70
|
dataset: DataType[];
|
|
58
71
|
ma: number;
|
|
59
72
|
type: number;
|
|
73
|
+
exclusionValue: {
|
|
74
|
+
d: number;
|
|
75
|
+
"d-1": number;
|
|
76
|
+
};
|
|
60
77
|
};
|
|
61
78
|
next(data: DataType, preList: {
|
|
62
79
|
dataset: ListType;
|
|
@@ -66,6 +83,10 @@ export default class Ma implements MaType {
|
|
|
66
83
|
dataset: ListType;
|
|
67
84
|
ma: number;
|
|
68
85
|
type: number;
|
|
86
|
+
exclusionValue: {
|
|
87
|
+
d: number;
|
|
88
|
+
"d-1": number;
|
|
89
|
+
};
|
|
69
90
|
};
|
|
70
91
|
getAllMa(list: ListType): ResAllMa;
|
|
71
92
|
getMa5(list: ListType): ResMa5;
|
|
@@ -19,7 +19,7 @@ var Ma = /** @class */ (function () {
|
|
|
19
19
|
configurable: true,
|
|
20
20
|
writable: true,
|
|
21
21
|
value: function (data, type) {
|
|
22
|
-
return { dataset: [data], ma: 0, type: type };
|
|
22
|
+
return { dataset: [data], ma: 0, type: type, exclusionValue: { d: 0, "d-1": 0 } };
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(Ma.prototype, "next", {
|
|
@@ -29,15 +29,23 @@ var Ma = /** @class */ (function () {
|
|
|
29
29
|
value: function (data, preList, type) {
|
|
30
30
|
preList.dataset.push(data);
|
|
31
31
|
if (preList.dataset.length < type) {
|
|
32
|
-
return {
|
|
32
|
+
return {
|
|
33
|
+
dataset: preList.dataset,
|
|
34
|
+
ma: 0,
|
|
35
|
+
type: type,
|
|
36
|
+
exclusionValue: { d: 0, "d-1": 0 },
|
|
37
|
+
};
|
|
33
38
|
}
|
|
34
39
|
else {
|
|
40
|
+
var exclusionValue = { d: preList.dataset[0].c, "d-1": 0 };
|
|
35
41
|
if (preList.dataset.length > type) {
|
|
42
|
+
exclusionValue["d-1"] = exclusionValue.d;
|
|
36
43
|
preList.dataset.shift();
|
|
44
|
+
exclusionValue.d = preList.dataset[0].c;
|
|
37
45
|
}
|
|
38
46
|
var sum = preList.dataset.reduce(function (pre, current) { return pre + current.c; }, 0);
|
|
39
47
|
var ma = Math.round((sum / type) * 100) / 100;
|
|
40
|
-
return { dataset: preList.dataset, ma: ma, type: type };
|
|
48
|
+
return { dataset: preList.dataset, ma: ma, type: type, exclusionValue: exclusionValue };
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type DataType = {
|
|
2
2
|
c: number;
|
|
3
|
+
[key: string]: unknown;
|
|
3
4
|
};
|
|
4
5
|
type ListType = DataType[];
|
|
5
6
|
type ResMa5 = {
|
|
@@ -35,15 +36,27 @@ interface MaType {
|
|
|
35
36
|
dataset: ListType;
|
|
36
37
|
ma: number;
|
|
37
38
|
type: number;
|
|
39
|
+
exclusionValue: {
|
|
40
|
+
d: number;
|
|
41
|
+
"d-1": number;
|
|
42
|
+
};
|
|
38
43
|
};
|
|
39
44
|
next: (data: DataType, preList: {
|
|
40
45
|
dataset: ListType;
|
|
41
46
|
ma: number;
|
|
42
47
|
type: number;
|
|
48
|
+
exclusionValue: {
|
|
49
|
+
d: number;
|
|
50
|
+
"d-1": number;
|
|
51
|
+
};
|
|
43
52
|
}, type: number) => {
|
|
44
53
|
dataset: ListType;
|
|
45
54
|
ma: number;
|
|
46
55
|
type: number;
|
|
56
|
+
exclusionValue: {
|
|
57
|
+
d: number;
|
|
58
|
+
"d-1": number;
|
|
59
|
+
};
|
|
47
60
|
};
|
|
48
61
|
getAllMa: (list: ListType) => ResAllMa;
|
|
49
62
|
getMa5: (list: ListType) => ResMa5;
|
|
@@ -57,6 +70,10 @@ export default class Ma implements MaType {
|
|
|
57
70
|
dataset: DataType[];
|
|
58
71
|
ma: number;
|
|
59
72
|
type: number;
|
|
73
|
+
exclusionValue: {
|
|
74
|
+
d: number;
|
|
75
|
+
"d-1": number;
|
|
76
|
+
};
|
|
60
77
|
};
|
|
61
78
|
next(data: DataType, preList: {
|
|
62
79
|
dataset: ListType;
|
|
@@ -66,6 +83,10 @@ export default class Ma implements MaType {
|
|
|
66
83
|
dataset: ListType;
|
|
67
84
|
ma: number;
|
|
68
85
|
type: number;
|
|
86
|
+
exclusionValue: {
|
|
87
|
+
d: number;
|
|
88
|
+
"d-1": number;
|
|
89
|
+
};
|
|
69
90
|
};
|
|
70
91
|
getAllMa(list: ListType): ResAllMa;
|
|
71
92
|
getMa5(list: ListType): ResMa5;
|
|
@@ -17,7 +17,7 @@ var Ma = /** @class */ (function () {
|
|
|
17
17
|
configurable: true,
|
|
18
18
|
writable: true,
|
|
19
19
|
value: function (data, type) {
|
|
20
|
-
return { dataset: [data], ma: 0, type: type };
|
|
20
|
+
return { dataset: [data], ma: 0, type: type, exclusionValue: { d: 0, "d-1": 0 } };
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(Ma.prototype, "next", {
|
|
@@ -27,15 +27,23 @@ var Ma = /** @class */ (function () {
|
|
|
27
27
|
value: function (data, preList, type) {
|
|
28
28
|
preList.dataset.push(data);
|
|
29
29
|
if (preList.dataset.length < type) {
|
|
30
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
dataset: preList.dataset,
|
|
32
|
+
ma: 0,
|
|
33
|
+
type: type,
|
|
34
|
+
exclusionValue: { d: 0, "d-1": 0 },
|
|
35
|
+
};
|
|
31
36
|
}
|
|
32
37
|
else {
|
|
38
|
+
var exclusionValue = { d: preList.dataset[0].c, "d-1": 0 };
|
|
33
39
|
if (preList.dataset.length > type) {
|
|
40
|
+
exclusionValue["d-1"] = exclusionValue.d;
|
|
34
41
|
preList.dataset.shift();
|
|
42
|
+
exclusionValue.d = preList.dataset[0].c;
|
|
35
43
|
}
|
|
36
44
|
var sum = preList.dataset.reduce(function (pre, current) { return pre + current.c; }, 0);
|
|
37
45
|
var ma = Math.round((sum / type) * 100) / 100;
|
|
38
|
-
return { dataset: preList.dataset, ma: ma, type: type };
|
|
46
|
+
return { dataset: preList.dataset, ma: ma, type: type, exclusionValue: exclusionValue };
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
});
|
package/dist/umd/index.js
CHANGED
|
@@ -741,7 +741,7 @@
|
|
|
741
741
|
configurable: true,
|
|
742
742
|
writable: true,
|
|
743
743
|
value: function (data, type) {
|
|
744
|
-
return { dataset: [data], ma: 0, type: type };
|
|
744
|
+
return { dataset: [data], ma: 0, type: type, exclusionValue: { d: 0, "d-1": 0 } };
|
|
745
745
|
}
|
|
746
746
|
});
|
|
747
747
|
Object.defineProperty(Ma.prototype, "next", {
|
|
@@ -751,15 +751,23 @@
|
|
|
751
751
|
value: function (data, preList, type) {
|
|
752
752
|
preList.dataset.push(data);
|
|
753
753
|
if (preList.dataset.length < type) {
|
|
754
|
-
return {
|
|
754
|
+
return {
|
|
755
|
+
dataset: preList.dataset,
|
|
756
|
+
ma: 0,
|
|
757
|
+
type: type,
|
|
758
|
+
exclusionValue: { d: 0, "d-1": 0 },
|
|
759
|
+
};
|
|
755
760
|
}
|
|
756
761
|
else {
|
|
762
|
+
var exclusionValue = { d: preList.dataset[0].c, "d-1": 0 };
|
|
757
763
|
if (preList.dataset.length > type) {
|
|
764
|
+
exclusionValue["d-1"] = exclusionValue.d;
|
|
758
765
|
preList.dataset.shift();
|
|
766
|
+
exclusionValue.d = preList.dataset[0].c;
|
|
759
767
|
}
|
|
760
768
|
var sum = preList.dataset.reduce(function (pre, current) { return pre + current.c; }, 0);
|
|
761
769
|
var ma = Math.round((sum / type) * 100) / 100;
|
|
762
|
-
return { dataset: preList.dataset, ma: ma, type: type };
|
|
770
|
+
return { dataset: preList.dataset, ma: ma, type: type, exclusionValue: exclusionValue };
|
|
763
771
|
}
|
|
764
772
|
}
|
|
765
773
|
});
|