@reefclaw/connect 0.1.18 → 0.1.20

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 (35) hide show
  1. package/assets/bridge/gateway/event-parser.d.ts +42 -0
  2. package/assets/bridge/gateway/event-parser.js +88 -0
  3. package/assets/bridge/gateway/heartbeat-cron.d.ts +1 -0
  4. package/assets/bridge/gateway/heartbeat-cron.js +22 -1
  5. package/assets/bridge/providers/gateway.d.ts +49 -0
  6. package/assets/bridge/providers/gateway.js +167 -13
  7. package/assets/bridge/types.d.ts +34 -0
  8. package/assets/bridge/utils/identity-name.d.ts +24 -0
  9. package/assets/bridge/utils/identity-name.js +54 -0
  10. package/assets/plugin/ccxt/binance-public.d.ts +4 -2
  11. package/assets/plugin/ccxt/binance-public.js +39 -3
  12. package/assets/plugin/live/proposal-decision-listener.d.ts +20 -0
  13. package/assets/plugin/live/proposal-decision-listener.js +211 -48
  14. package/assets/plugin/openclaw.plugin.json +1 -1
  15. package/assets/plugin/tools/create-order.d.ts +11 -0
  16. package/assets/plugin/tools/create-order.js +23 -2
  17. package/assets/plugin/tools/get-risk-summary.d.ts +4 -0
  18. package/assets/plugin/tools/get-risk-summary.js +62 -23
  19. package/assets/plugin/venues/hyperliquid/hl-bracket-coordinator.d.ts +4 -0
  20. package/assets/plugin/venues/hyperliquid/hl-bracket-coordinator.js +2 -2
  21. package/assets/plugin/venues/hyperliquid/hl-live-adapter.d.ts +12 -0
  22. package/assets/plugin/venues/hyperliquid/hl-live-adapter.js +69 -6
  23. package/assets/plugin/venues/hyperliquid/hl-order.d.ts +35 -0
  24. package/assets/plugin/venues/hyperliquid/hl-order.js +123 -0
  25. package/assets/plugin/venues/hyperliquid/hl-position.d.ts +36 -0
  26. package/assets/plugin/venues/hyperliquid/hl-position.js +127 -0
  27. package/assets/plugin/venues/hyperliquid/hl-private.d.ts +20 -3
  28. package/assets/plugin/venues/hyperliquid/hl-private.js +37 -6
  29. package/dist/cli.js +31 -10
  30. package/dist/gateway-tuning.js +112 -0
  31. package/package.json +1 -1
  32. package/assets/shared/signals/indicators-extended.d.ts +0 -52
  33. package/assets/shared/signals/indicators-extended.js +0 -284
  34. package/assets/shared/signals/indicators.d.ts +0 -15
  35. package/assets/shared/signals/indicators.js +0 -107
@@ -1,15 +0,0 @@
1
- export declare function computeEMA(data: number[], period: number): number;
2
- export declare function computeATR(highs: number[], lows: number[], closes: number[], period: number): number;
3
- export declare function computeATRSeries(highs: number[], lows: number[], closes: number[], period: number): number[];
4
- export declare function computeRSI(closes: number[], period: number): number;
5
- export declare function linearSlope(y: number[], x?: number[]): number;
6
- export declare function computeStd(data: number[]): number;
7
- export declare function mean(data: number[]): number;
8
- /** Find swing highs and lows from OHLCV bars (simple pivot-point method). */
9
- export declare function findSwingPoints(bars: {
10
- high: number;
11
- low: number;
12
- }[], lookback?: number): {
13
- highs: number[];
14
- lows: number[];
15
- };
@@ -1,107 +0,0 @@
1
- // Shared indicator computation helpers.
2
- // Used by both regime feature engineering and signal condition evaluation.
3
- export function computeEMA(data, period) {
4
- if (data.length < period)
5
- return data[data.length - 1] ?? 0;
6
- const k = 2 / (period + 1);
7
- let ema = mean(data.slice(0, period));
8
- for (let i = period; i < data.length; i++) {
9
- ema = data[i] * k + ema * (1 - k);
10
- }
11
- return ema;
12
- }
13
- export function computeATR(highs, lows, closes, period) {
14
- const series = computeATRSeries(highs, lows, closes, period);
15
- return series[series.length - 1] ?? 0;
16
- }
17
- export function computeATRSeries(highs, lows, closes, period) {
18
- if (highs.length < 2)
19
- return [];
20
- const tr = [];
21
- for (let i = 1; i < highs.length; i++) {
22
- tr.push(Math.max(highs[i] - lows[i], Math.abs(highs[i] - closes[i - 1]), Math.abs(lows[i] - closes[i - 1])));
23
- }
24
- const atr = [];
25
- atr[0] = mean(tr.slice(0, period));
26
- for (let i = 1; i < tr.length; i++) {
27
- atr[i] = (atr[i - 1] * (period - 1) + tr[i]) / period;
28
- }
29
- return atr;
30
- }
31
- export function computeRSI(closes, period) {
32
- if (closes.length < period + 1)
33
- return 50;
34
- const changes = [];
35
- for (let i = 1; i < closes.length; i++) {
36
- changes.push(closes[i] - closes[i - 1]);
37
- }
38
- let avgGain = 0;
39
- let avgLoss = 0;
40
- for (let i = 0; i < period; i++) {
41
- if (changes[i] > 0)
42
- avgGain += changes[i];
43
- else
44
- avgLoss -= changes[i];
45
- }
46
- avgGain /= period;
47
- avgLoss /= period;
48
- for (let i = period; i < changes.length; i++) {
49
- const gain = changes[i] > 0 ? changes[i] : 0;
50
- const loss = changes[i] < 0 ? -changes[i] : 0;
51
- avgGain = (avgGain * (period - 1) + gain) / period;
52
- avgLoss = (avgLoss * (period - 1) + loss) / period;
53
- }
54
- if (avgLoss === 0)
55
- return 100;
56
- const rs = avgGain / avgLoss;
57
- return 100 - 100 / (1 + rs);
58
- }
59
- export function linearSlope(y, x) {
60
- const n = y.length;
61
- if (n < 2)
62
- return 0;
63
- const xs = x ?? Array.from({ length: n }, (_, i) => i);
64
- const mx = mean(xs);
65
- const my = mean(y);
66
- let num = 0;
67
- let den = 0;
68
- for (let i = 0; i < n; i++) {
69
- num += (xs[i] - mx) * (y[i] - my);
70
- den += (xs[i] - mx) ** 2;
71
- }
72
- return den > 0 ? num / den : 0;
73
- }
74
- export function computeStd(data) {
75
- if (data.length < 2)
76
- return 0;
77
- const avg = mean(data);
78
- const variance = data.reduce((s, v) => s + (v - avg) ** 2, 0) / (data.length - 1);
79
- return Math.sqrt(variance);
80
- }
81
- export function mean(data) {
82
- if (data.length === 0)
83
- return 0;
84
- return data.reduce((s, v) => s + v, 0) / data.length;
85
- }
86
- /** Find swing highs and lows from OHLCV bars (simple pivot-point method). */
87
- export function findSwingPoints(bars, lookback = 5) {
88
- const highs = [];
89
- const lows = [];
90
- for (let i = lookback; i < bars.length - lookback; i++) {
91
- let isHigh = true;
92
- let isLow = true;
93
- for (let j = i - lookback; j <= i + lookback; j++) {
94
- if (j === i)
95
- continue;
96
- if (bars[j].high >= bars[i].high)
97
- isHigh = false;
98
- if (bars[j].low <= bars[i].low)
99
- isLow = false;
100
- }
101
- if (isHigh)
102
- highs.push(bars[i].high);
103
- if (isLow)
104
- lows.push(bars[i].low);
105
- }
106
- return { highs, lows };
107
- }