@stvy/fund-indicators 1.0.0 → 1.0.5

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.
Files changed (52) hide show
  1. package/.github/workflows/publish.yml +73 -0
  2. package/AGENTS.md +322 -0
  3. package/dist/index.cjs +7014 -0
  4. package/dist/index.d.cts +779 -0
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.mjs +6917 -0
  7. package/package.json +15 -32
  8. package/pnpm-workspace.yaml +2 -0
  9. package/src/dca.ts +420 -0
  10. package/src/index.ts +133 -0
  11. package/src/jstat.d.ts +17 -0
  12. package/src/pattern.ts +447 -0
  13. package/src/risk.ts +516 -0
  14. package/src/statistics.ts +428 -0
  15. package/src/technical.ts +738 -0
  16. package/src/types.ts +369 -0
  17. package/test/index.test.ts +355 -0
  18. package/tsconfig.json +20 -0
  19. package/dist/browser/fund-indicators.esm.js +0 -7505
  20. package/dist/browser/fund-indicators.esm.min.js +0 -8
  21. package/dist/browser/fund-indicators.esm.min.js.map +0 -7
  22. package/dist/browser/fund-indicators.js +0 -7517
  23. package/dist/browser/fund-indicators.min.js +0 -8
  24. package/dist/browser/fund-indicators.min.js.map +0 -7
  25. package/dist/dca.d.ts +0 -91
  26. package/dist/dca.d.ts.map +0 -1
  27. package/dist/dca.js +0 -354
  28. package/dist/dca.js.map +0 -1
  29. package/dist/index.d.ts +0 -18
  30. package/dist/index.d.ts.map +0 -1
  31. package/dist/index.js +0 -141
  32. package/dist/index.js.map +0 -1
  33. package/dist/pattern.d.ts +0 -60
  34. package/dist/pattern.d.ts.map +0 -1
  35. package/dist/pattern.js +0 -386
  36. package/dist/pattern.js.map +0 -1
  37. package/dist/risk.d.ts +0 -115
  38. package/dist/risk.d.ts.map +0 -1
  39. package/dist/risk.js +0 -502
  40. package/dist/risk.js.map +0 -1
  41. package/dist/statistics.d.ts +0 -78
  42. package/dist/statistics.d.ts.map +0 -1
  43. package/dist/statistics.js +0 -402
  44. package/dist/statistics.js.map +0 -1
  45. package/dist/technical.d.ts +0 -105
  46. package/dist/technical.d.ts.map +0 -1
  47. package/dist/technical.js +0 -633
  48. package/dist/technical.js.map +0 -1
  49. package/dist/types.d.ts +0 -327
  50. package/dist/types.d.ts.map +0 -1
  51. package/dist/types.js +0 -7
  52. package/dist/types.js.map +0 -1
package/package.json CHANGED
@@ -1,40 +1,25 @@
1
1
  {
2
2
  "name": "@stvy/fund-indicators",
3
- "version": "1.0.0",
3
+ "version": "1.0.5",
4
4
  "description": "基金自动化交易指标计算工具库 - 基于历史净值计算全部技术指标",
5
- "main": "dist/index.js",
6
- "module": "dist/browser/fund-indicators.esm.js",
7
- "browser": "dist/browser/fund-indicators.min.js",
8
- "types": "dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/browser/fund-indicators.esm.js",
13
- "require": "./dist/index.js"
14
- },
15
- "./browser": {
16
- "import": "./dist/browser/fund-indicators.esm.js",
17
- "default": "./dist/browser/fund-indicators.min.js"
18
- }
19
- },
20
- "files": [
21
- "dist/",
22
- "README.md",
23
- "LICENSE"
24
- ],
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.cts",
25
8
  "dependencies": {
26
- "jstat": "^1.9.6",
27
- "simple-statistics": "^7.8.0",
28
- "technicalindicators": "^3.1.0"
9
+ "simple-statistics": "^7.8.0"
29
10
  },
30
11
  "devDependencies": {
31
- "@types/node": "^20.0.0",
32
- "esbuild": "^0.28.0",
33
- "tsx": "^4.7.0",
34
- "typescript": "^5.3.0"
12
+ "technicalindicators": "^3.1.0",
13
+ "jstat": "^1.9.6",
14
+ "typescript": "^6",
15
+ "pkgroll": "^2",
16
+ "tsx": "^4"
17
+ },
18
+ "optionalDependencies": {
19
+ "@types/node": "latest"
35
20
  },
36
21
  "engines": {
37
- "node": ">=18.0.0"
22
+ "node": ">=24.0.0"
38
23
  },
39
24
  "keywords": [
40
25
  "fund",
@@ -67,9 +52,7 @@
67
52
  "url": "https://github.com/stevieyu/fund-indicators/issues"
68
53
  },
69
54
  "scripts": {
70
- "build": "pnpm run build:node && pnpm run build:browser",
71
- "build:node": "tsc",
72
- "build:browser": "node scripts/build-browser.mjs",
55
+ "build": "pkgroll",
73
56
  "test": "tsx test/index.test.ts"
74
57
  }
75
58
  }
@@ -0,0 +1,2 @@
1
+ allowBuilds:
2
+ esbuild: true
package/src/dca.ts ADDED
@@ -0,0 +1,420 @@
1
+ /**
2
+ * 定投与盈亏分析模块
3
+ * 包含:定投模拟、平均成本、IRR 计算、止盈止损信号、安全边际等
4
+ */
5
+
6
+ import { NavSeries, DateSeries, DCAConfig, DCAResult, TakeProfitStopLossSignal } from './types';
7
+
8
+ // ============================================================
9
+ // 定投模拟
10
+ // ============================================================
11
+
12
+ /**
13
+ * 定投策略模拟
14
+ * @param nav 净值序列
15
+ * @param config 定投配置
16
+ * @param dates 可选日期序列
17
+ */
18
+ export function simulateDCA(nav: NavSeries, config: DCAConfig, dates?: DateSeries): DCAResult {
19
+ const { amount, interval = 1, startIndex = 0 } = config;
20
+
21
+ let totalInvested = 0;
22
+ let totalShares = 0;
23
+ const investmentDates: number[] = [];
24
+ const valueHistory: number[] = [];
25
+
26
+ for (let i = startIndex; i < nav.length; i += interval) {
27
+ const navPrice = nav[i];
28
+ if (navPrice <= 0) continue;
29
+
30
+ const shares = amount / navPrice;
31
+ totalShares += shares;
32
+ totalInvested += amount;
33
+ investmentDates.push(i);
34
+
35
+ // 当前持仓市值
36
+ const currentValue = totalShares * navPrice;
37
+ valueHistory.push(currentValue);
38
+ }
39
+
40
+ if (totalInvested === 0 || totalShares === 0) {
41
+ return {
42
+ totalInvestments: 0,
43
+ totalInvested: 0,
44
+ currentValue: 0,
45
+ totalShares: 0,
46
+ averageCost: 0,
47
+ currentNav: 0,
48
+ returnRate: 0,
49
+ profitLoss: 0,
50
+ irr: null,
51
+ investmentDates,
52
+ valueHistory,
53
+ };
54
+ }
55
+
56
+ const currentNav = nav[nav.length - 1];
57
+ const currentValue = totalShares * currentNav;
58
+ const averageCost = totalInvested / totalShares;
59
+ const returnRate = (currentValue - totalInvested) / totalInvested;
60
+ const profitLoss = currentValue - totalInvested;
61
+
62
+ // 计算 IRR
63
+ const irr = calculateIRR(nav, investmentDates, amount, totalShares, currentNav);
64
+
65
+ return {
66
+ totalInvestments: investmentDates.length,
67
+ totalInvested,
68
+ currentValue,
69
+ totalShares,
70
+ averageCost,
71
+ currentNav,
72
+ returnRate,
73
+ profitLoss,
74
+ irr,
75
+ investmentDates,
76
+ valueHistory,
77
+ };
78
+ }
79
+
80
+ // ============================================================
81
+ // IRR 计算(内部收益率)
82
+ // ============================================================
83
+
84
+ /**
85
+ * 计算定投的内部收益率 (IRR)
86
+ * 使用牛顿迭代法求解
87
+ */
88
+ function calculateIRR(
89
+ nav: NavSeries,
90
+ investmentDates: number[],
91
+ amount: number,
92
+ totalShares: number,
93
+ currentNav: number
94
+ ): number | null {
95
+ if (investmentDates.length < 2) return null;
96
+
97
+ // 构建现金流:每次定投为负现金流,最后赎回为正现金流
98
+ // 以第一个定投日为基准日 (day 0)
99
+ const baseDay = investmentDates[0];
100
+ const cashFlows: { day: number; amount: number }[] = [];
101
+
102
+ for (const d of investmentDates) {
103
+ cashFlows.push({ day: d - baseDay, amount: -amount });
104
+ }
105
+ // 最终赎回(假设全部赎回)
106
+ const lastDay = nav.length - 1 - baseDay;
107
+ cashFlows.push({ day: lastDay, amount: totalShares * currentNav });
108
+
109
+ // NPV 函数:NPV(r) = Σ CFi / (1+r)^(ti/T)
110
+ // T = 一年的交易日数
111
+ const T = 242;
112
+
113
+ function npv(r: number): number {
114
+ let sum = 0;
115
+ for (const cf of cashFlows) {
116
+ const t = cf.day / T;
117
+ if (t === 0) sum += cf.amount;
118
+ else sum += cf.amount / Math.pow(1 + r, t);
119
+ }
120
+ return sum;
121
+ }
122
+
123
+ // NPV 的导数
124
+ function npvDerivative(r: number): number {
125
+ let sum = 0;
126
+ for (const cf of cashFlows) {
127
+ const t = cf.day / T;
128
+ if (t <= 0) continue;
129
+ sum -= (t * cf.amount) / Math.pow(1 + r, t + 1);
130
+ }
131
+ return sum;
132
+ }
133
+
134
+ // 牛顿迭代法求 IRR
135
+ let r = 0.1; // 初始猜测 10%
136
+ const maxIterations = 100;
137
+ const tolerance = 1e-8;
138
+
139
+ for (let i = 0; i < maxIterations; i++) {
140
+ const f = npv(r);
141
+ const fPrime = npvDerivative(r);
142
+
143
+ if (Math.abs(fPrime) < 1e-12) break;
144
+
145
+ const newR = r - f / fPrime;
146
+
147
+ if (Math.abs(newR - r) < tolerance) {
148
+ return newR;
149
+ }
150
+
151
+ r = newR;
152
+
153
+ // 防止发散
154
+ if (r < -0.99) r = -0.99;
155
+ if (r > 10) r = 10;
156
+ }
157
+
158
+ // 如果牛顿法不收敛,尝试二分法
159
+ return bisectionIRR(npv);
160
+ }
161
+
162
+ /** 二分法求 IRR(备用) */
163
+ function bisectionIRR(npv: (r: number) => number): number | null {
164
+ let low = -0.99;
165
+ let high = 10;
166
+ const tolerance = 1e-6;
167
+ const maxIterations = 200;
168
+
169
+ let fLow = npv(low);
170
+ let fHigh = npv(high);
171
+
172
+ // 检查是否有根
173
+ if (fLow * fHigh > 0) return null;
174
+
175
+ for (let i = 0; i < maxIterations; i++) {
176
+ const mid = (low + high) / 2;
177
+ const fMid = npv(mid);
178
+
179
+ if (Math.abs(fMid) < tolerance || (high - low) / 2 < tolerance) {
180
+ return mid;
181
+ }
182
+
183
+ if (fLow * fMid < 0) {
184
+ high = mid;
185
+ fHigh = fMid;
186
+ } else {
187
+ low = mid;
188
+ fLow = fMid;
189
+ }
190
+ }
191
+
192
+ return (low + high) / 2;
193
+ }
194
+
195
+ // ============================================================
196
+ // 止盈止损信号
197
+ // ============================================================
198
+
199
+ /**
200
+ * 止盈止损信号检测
201
+ * @param nav 净值序列
202
+ * @param costPrice 持仓成本价
203
+ * @param takeProfitThreshold 止盈阈值(如 0.30 = 盈利 30% 止盈)
204
+ * @param stopLossThreshold 止损阈值(如 -0.15 = 亏损 15% 止损)
205
+ */
206
+ export function takeProfitStopLoss(
207
+ nav: NavSeries,
208
+ costPrice: number,
209
+ takeProfitThreshold: number = 0.3,
210
+ stopLossThreshold: number = -0.15
211
+ ): TakeProfitStopLossSignal {
212
+ const currentNav = nav[nav.length - 1];
213
+ const currentPnL = (currentNav - costPrice) / costPrice;
214
+
215
+ return {
216
+ takeProfitTriggered: currentPnL >= takeProfitThreshold,
217
+ stopLossTriggered: currentPnL <= stopLossThreshold,
218
+ currentPnL,
219
+ distanceToTakeProfit: takeProfitThreshold - currentPnL,
220
+ distanceToStopLoss: currentPnL - stopLossThreshold,
221
+ };
222
+ }
223
+
224
+ /**
225
+ * 动态止盈止损(跟踪止盈)
226
+ * 当净值创新高后回撤一定比例时触发止盈
227
+ * @param nav 净值序列
228
+ * @param trailPercent 跟踪止盈比例(如 0.10 = 从最高点回撤 10% 触发)
229
+ * @param costPrice 持仓成本价
230
+ */
231
+ export function trailingStop(
232
+ nav: NavSeries,
233
+ trailPercent: number = 0.1,
234
+ costPrice?: number
235
+ ): {
236
+ triggered: boolean;
237
+ peakNav: number;
238
+ currentNav: number;
239
+ drawdownFromPeak: number;
240
+ profitFromCost: number;
241
+ } {
242
+ let peakNav = nav[0];
243
+ for (const v of nav) {
244
+ if (v > peakNav) peakNav = v;
245
+ }
246
+
247
+ const currentNav = nav[nav.length - 1];
248
+ const drawdownFromPeak = (peakNav - currentNav) / peakNav;
249
+ const profitFromCost = costPrice ? (currentNav - costPrice) / costPrice : 0;
250
+
251
+ return {
252
+ triggered: drawdownFromPeak >= trailPercent && currentNav > (costPrice ?? 0),
253
+ peakNav,
254
+ currentNav,
255
+ drawdownFromPeak,
256
+ profitFromCost,
257
+ };
258
+ }
259
+
260
+ // ============================================================
261
+ // 安全边际与估值分析
262
+ // ============================================================
263
+
264
+ /**
265
+ * 安全边际 - 当前净值相对历史最高点的回撤幅度
266
+ * @param nav 净值序列
267
+ * @returns 回撤比例(0-1,如 0.25 = 回撤 25%)
268
+ */
269
+ export function safetyMargin(nav: NavSeries): number {
270
+ const peak = Math.max(...nav);
271
+ const current = nav[nav.length - 1];
272
+ return (peak - current) / peak;
273
+ }
274
+
275
+ /**
276
+ * 当前净值相对历史最高点和最低点的位置
277
+ * @param nav 净值序列
278
+ * @returns 0-1 之间的位置值(0 = 历史最低,1 = 历史最高)
279
+ */
280
+ export function pricePosition(nav: NavSeries): number {
281
+ const peak = Math.max(...nav);
282
+ const trough = Math.min(...nav);
283
+ const current = nav[nav.length - 1];
284
+ if (peak === trough) return 0.5;
285
+ return (current - trough) / (peak - trough);
286
+ }
287
+
288
+ /**
289
+ * 智能定投调整系数
290
+ * 根据当前净值相对均线的位置,调整定投金额
291
+ * @param nav 净值序列
292
+ * @param maPeriod 参考均线周期(默认 250 日)
293
+ * @param maxMultiplier 最大倍数(默认 2.0)
294
+ * @param minMultiplier 最小倍数(默认 0.5)
295
+ * @returns 定投调整倍数(1.0 = 标准金额)
296
+ */
297
+ export function smartDCAMultiplier(
298
+ nav: NavSeries,
299
+ maPeriod: number = 250,
300
+ maxMultiplier: number = 2.0,
301
+ minMultiplier: number = 0.5
302
+ ): number {
303
+ if (nav.length < maPeriod) return 1.0;
304
+
305
+ const recent = nav.slice(-maPeriod);
306
+ const ma = recent.reduce((a, b) => a + b, 0) / maPeriod;
307
+ const current = nav[nav.length - 1];
308
+ const deviation = (current - ma) / ma; // 正数=高于均线,负数=低于均线
309
+
310
+ // 低于均线时增加定投,高于均线时减少
311
+ // deviation = -0.2 → multiplier = 1.4
312
+ // deviation = +0.2 → multiplier = 0.6
313
+ const multiplier = 1.0 - deviation * 4;
314
+
315
+ return Math.max(minMultiplier, Math.min(maxMultiplier, multiplier));
316
+ }
317
+
318
+ // ============================================================
319
+ // 分批建仓/减仓策略
320
+ // ============================================================
321
+
322
+ /**
323
+ * 分批建仓信号
324
+ * 当净值跌到历史分位以下时分批买入
325
+ * @param nav 净值序列
326
+ * @param levels 分批买入的分位阈值列表(如 [0.3, 0.2, 0.1] = 30%、20%、10%分位各买一次)
327
+ * @returns 当前触发的买入层级(0 = 不触发,1 = 第一层,2 = 第二层...)
328
+ */
329
+ export function tieredBuySignal(nav: NavSeries, levels: number[] = [0.3, 0.2, 0.1]): number {
330
+ const sorted = [...nav].sort((a, b) => a - b);
331
+ const current = nav[nav.length - 1];
332
+
333
+ // 计算当前净值的分位
334
+ let rank = 0;
335
+ for (const v of sorted) {
336
+ if (v < current) rank++;
337
+ else if (v === current) rank += 0.5;
338
+ }
339
+ const percentile = rank / sorted.length;
340
+
341
+ // 从最激进到最保守检查
342
+ for (let i = 0; i < levels.length; i++) {
343
+ if (percentile <= levels[i]) return levels.length - i;
344
+ }
345
+ return 0;
346
+ }
347
+
348
+ /**
349
+ * 分批止盈信号
350
+ * 当净值涨到历史分位以上时分批卖出
351
+ * @param nav 净值序列
352
+ * @param levels 分批卖出的分位阈值列表(如 [0.7, 0.8, 0.9] = 70%、80%、90%分位各卖一次)
353
+ * @returns 当前触发的卖出层级
354
+ */
355
+ export function tieredSellSignal(nav: NavSeries, levels: number[] = [0.7, 0.8, 0.9]): number {
356
+ const sorted = [...nav].sort((a, b) => a - b);
357
+ const current = nav[nav.length - 1];
358
+
359
+ let rank = 0;
360
+ for (const v of sorted) {
361
+ if (v < current) rank++;
362
+ else if (v === current) rank += 0.5;
363
+ }
364
+ const percentile = rank / sorted.length;
365
+
366
+ for (let i = levels.length - 1; i >= 0; i--) {
367
+ if (percentile >= levels[i]) return i + 1;
368
+ }
369
+ return 0;
370
+ }
371
+
372
+ // ============================================================
373
+ // 回测辅助
374
+ // ============================================================
375
+
376
+ /**
377
+ * 计算一段持仓的收益明细
378
+ * @param nav 净值序列
379
+ * @param buyIndex 买入日索引
380
+ * @param sellIndex 卖出日索引(默认到最后一天)
381
+ * @param amount 投入金额
382
+ */
383
+ export function positionPnL(
384
+ nav: NavSeries,
385
+ buyIndex: number,
386
+ sellIndex?: number,
387
+ amount: number = 10000
388
+ ): {
389
+ buyNav: number;
390
+ sellNav: number;
391
+ shares: number;
392
+ cost: number;
393
+ value: number;
394
+ pnl: number;
395
+ returnRate: number;
396
+ holdDays: number;
397
+ annualizedReturn: number;
398
+ } {
399
+ const sell = sellIndex ?? nav.length - 1;
400
+ const buyNav = nav[buyIndex];
401
+ const sellNav = nav[sell];
402
+ const shares = amount / buyNav;
403
+ const value = shares * sellNav;
404
+ const pnl = value - amount;
405
+ const returnRate = pnl / amount;
406
+ const holdDays = sell - buyIndex;
407
+ const annualizedReturn = holdDays > 0 ? Math.pow(1 + returnRate, 242 / holdDays) - 1 : 0;
408
+
409
+ return {
410
+ buyNav,
411
+ sellNav,
412
+ shares,
413
+ cost: amount,
414
+ value,
415
+ pnl,
416
+ returnRate,
417
+ holdDays,
418
+ annualizedReturn,
419
+ };
420
+ }
package/src/index.ts ADDED
@@ -0,0 +1,133 @@
1
+ /**
2
+ * 基金自动化交易指标计算工具库
3
+ * Fund Automated Trading Indicators Library
4
+ *
5
+ * 基于历史净值数据计算全部技术指标,包括:
6
+ * - 技术指标(均线、MACD、RSI、KDJ、布林带、通道等)
7
+ * - 风险与绩效指标(波动率、回撤、VaR、夏普比率、索提诺等)
8
+ * - 统计特征(偏度、峰度、赫斯特指数、GARCH 等)
9
+ * - 定投分析(模拟定投、IRR、智能定投、止盈止损等)
10
+ * - 形态识别(支撑阻力、双底双顶、头肩形态、缺口等)
11
+ */
12
+
13
+ // 类型定义
14
+ export * from './types';
15
+
16
+ // ============================================================
17
+ // 技术指标(趋势、动量、震荡、通道)
18
+ // ============================================================
19
+ export {
20
+ // 均线
21
+ sma,
22
+ ema,
23
+ wma,
24
+ dema,
25
+ tema,
26
+ kama,
27
+ // MACD
28
+ macd,
29
+ // 动量/震荡
30
+ rsi,
31
+ kdj,
32
+ roc,
33
+ momentum,
34
+ williamsR,
35
+ stochasticRSI,
36
+ cci,
37
+ trix,
38
+ dpo,
39
+ massIndex,
40
+ // 通道/波动
41
+ bollingerBands,
42
+ donchianChannel,
43
+ keltnerChannel,
44
+ adx,
45
+ atr,
46
+ sar,
47
+ // 衍生指标
48
+ bias,
49
+ navPercentile,
50
+ detectCrossSignal,
51
+ detectMAAlignment,
52
+ } from './technical';
53
+
54
+ // ============================================================
55
+ // 风险与绩效指标
56
+ // ============================================================
57
+ export {
58
+ // 基础转换
59
+ navToReturns,
60
+ annualizeReturn,
61
+ totalReturn,
62
+ // 波动率
63
+ annualizedVolatility,
64
+ downsideVolatility,
65
+ rollingVolatility,
66
+ volatilityCone,
67
+ // 回撤
68
+ maxDrawdown,
69
+ maxDrawdownDuration,
70
+ // VaR / CVaR
71
+ calculateVaR,
72
+ calculateCVaR,
73
+ // 风险汇总
74
+ riskMetrics,
75
+ // 绩效指标
76
+ sharpeRatio,
77
+ sortinoRatio,
78
+ calmarRatio,
79
+ treynorRatio,
80
+ omegaRatio,
81
+ winRate,
82
+ profitLossRatio,
83
+ profitFactor,
84
+ consecutiveWinLoss,
85
+ performanceMetrics,
86
+ // 基准对比
87
+ calculateBeta,
88
+ calculateAlpha,
89
+ trackingError,
90
+ informationRatio,
91
+ benchmarkMetrics,
92
+ } from './risk';
93
+
94
+ // ============================================================
95
+ // 统计特征
96
+ // ============================================================
97
+ export {
98
+ statisticalFeatures,
99
+ navStatisticalFeatures,
100
+ hurstExponent,
101
+ autocorrelation,
102
+ ljungBoxTest,
103
+ returnQuantiles,
104
+ rollingSkewness,
105
+ rollingKurtosis,
106
+ garch11,
107
+ } from './statistics';
108
+
109
+ // ============================================================
110
+ // 定投与盈亏分析
111
+ // ============================================================
112
+ export {
113
+ simulateDCA,
114
+ takeProfitStopLoss,
115
+ trailingStop,
116
+ safetyMargin,
117
+ pricePosition,
118
+ smartDCAMultiplier,
119
+ tieredBuySignal,
120
+ tieredSellSignal,
121
+ positionPnL,
122
+ } from './dca';
123
+
124
+ // ============================================================
125
+ // 形态识别
126
+ // ============================================================
127
+ export {
128
+ supportResistance,
129
+ doubleBottomTop,
130
+ detectGaps,
131
+ trendStrength,
132
+ headAndShoulders,
133
+ } from './pattern';
package/src/jstat.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ declare module 'jstat' {
2
+ export const jStat: {
3
+ normal: {
4
+ pdf(x: number, mean: number, std: number): number;
5
+ cdf(x: number, mean: number, std: number): number;
6
+ inv(p: number, mean: number, std: number): number;
7
+ };
8
+ chisquare: {
9
+ cdf(x: number, df: number): number;
10
+ inv(p: number, df: number): number;
11
+ };
12
+ studentt: {
13
+ cdf(x: number, df: number): number;
14
+ inv(p: number, df: number): number;
15
+ };
16
+ };
17
+ }