dexbot 1.5.2 → 1.5.3

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 (69) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/analysis/ama_fitting/package.json +1 -1
  3. package/analysis/resolve_source.ts +3 -0
  4. package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +2455 -0
  5. package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +218 -0
  6. package/analysis/tradingview/README.md +5 -1
  7. package/analysis/tradingview/analyze_tradingview.ts +27 -1
  8. package/analysis/tradingview/h-bts_tradingview.html +1570 -0
  9. package/analysis/tradingview/t-bts_tradingview.html +1570 -0
  10. package/analysis/tradingview/tradingview_uplot_chart_generator.ts +351 -22
  11. package/analysis/trend_detection/package.json +1 -1
  12. package/claw/package.json +1 -1
  13. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  14. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  15. package/claw/tests/test_claw_mcp_transport.ts +2 -2
  16. package/dist/analysis/resolve_source.d.ts.map +1 -1
  17. package/dist/analysis/resolve_source.js +3 -0
  18. package/dist/analysis/resolve_source.js.map +1 -1
  19. package/dist/analysis/tradingview/analyze_tradingview.d.ts +3 -0
  20. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -1
  21. package/dist/analysis/tradingview/analyze_tradingview.js +27 -2
  22. package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -1
  23. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
  24. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +348 -22
  25. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
  26. package/dist/market_adapter/core/asymmetric_bounds.d.ts +33 -1
  27. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
  28. package/dist/market_adapter/core/asymmetric_bounds.js +38 -1
  29. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
  30. package/dist/modules/dexbot_class.d.ts +2 -18
  31. package/dist/modules/dexbot_class.d.ts.map +1 -1
  32. package/dist/modules/dexbot_cow_runtime.d.ts +37 -37
  33. package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
  34. package/dist/modules/dexbot_cow_runtime.js +655 -556
  35. package/dist/modules/dexbot_cow_runtime.js.map +1 -1
  36. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  37. package/dist/modules/dexbot_maintenance_runtime.js +31 -51
  38. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  39. package/dist/modules/order/grid.d.ts.map +1 -1
  40. package/dist/modules/order/grid.js +28 -37
  41. package/dist/modules/order/grid.js.map +1 -1
  42. package/dist/modules/order/manager.d.ts +2 -1
  43. package/dist/modules/order/manager.d.ts.map +1 -1
  44. package/dist/modules/order/manager.js +10 -1
  45. package/dist/modules/order/manager.js.map +1 -1
  46. package/dist/modules/order/sync_engine.d.ts.map +1 -1
  47. package/dist/modules/order/sync_engine.js +74 -0
  48. package/dist/modules/order/sync_engine.js.map +1 -1
  49. package/dist/modules/order/utils/math.d.ts +9 -11
  50. package/dist/modules/order/utils/math.d.ts.map +1 -1
  51. package/dist/modules/order/utils/math.js +9 -11
  52. package/dist/modules/order/utils/math.js.map +1 -1
  53. package/dist/modules/order/utils/order.d.ts +51 -16
  54. package/dist/modules/order/utils/order.d.ts.map +1 -1
  55. package/dist/modules/order/utils/order.js +203 -29
  56. package/dist/modules/order/utils/order.js.map +1 -1
  57. package/dist/modules/order/utils/system.d.ts +1 -30
  58. package/dist/modules/order/utils/system.d.ts.map +1 -1
  59. package/dist/modules/order/utils/system.js +31 -98
  60. package/dist/modules/order/utils/system.js.map +1 -1
  61. package/dist/modules/order/utils/validate.d.ts +3 -2
  62. package/dist/modules/order/utils/validate.d.ts.map +1 -1
  63. package/dist/modules/order/utils/validate.js +5 -1
  64. package/dist/modules/order/utils/validate.js.map +1 -1
  65. package/docs/DEXBOT_COMPARISON.md +3 -3
  66. package/docs/EVOLUTION.md +6 -5
  67. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
  68. package/docs/README.md +2 -2
  69. package/package.json +1 -1
@@ -0,0 +1,218 @@
1
+ {
2
+ "meta": {
3
+ "generatedAt": "2026-08-26T15:40:53.423Z",
4
+ "dataPath": "market_adapter/data/lp/1_3_5537_1_3_0/lp_pool_133_1h.json",
5
+ "resultsPath": "analysis/ama_fitting/optimization_results_lp_pool_133_1h.json",
6
+ "candles": 26281,
7
+ "activeOrders": "all",
8
+ "feeRoundtripPct": 0.2,
9
+ "btsCreateFee": 0.4826,
10
+ "btsCancelFee": 0.00482,
11
+ "makerCreateFactor": 0.1,
12
+ "txFeePrice": 1,
13
+ "btsFeeCapital": 10000,
14
+ "search": {
15
+ "spreadValues": [
16
+ 2,
17
+ 4
18
+ ],
19
+ "incrementValues": [
20
+ 0.5,
21
+ 1
22
+ ],
23
+ "ratioValues": [
24
+ 2,
25
+ 3
26
+ ],
27
+ "minSpreadFactor": 2.1,
28
+ "repositionPct": 1,
29
+ "asymmetricBounds": false,
30
+ "combosPerAma": 8
31
+ },
32
+ "scoring": {
33
+ "baseScore": "totalNetCaptureAfterFeesPct * (fillEfficiency / 100)",
34
+ "gridModel": "persistent fixed chain prices (createOrderGrid port): master rail at sqrt(1±inc) offsets bounded by [center/ratio, center*ratio], gapSlots spread zone centered on center; prices never follow AMA after placement",
35
+ "spreadParam": "targetSpreadPercent for calculateGapSlots (floored at increment * MIN_SPREAD_FACTOR)",
36
+ "resetTriggers": "(A) AMA drift >= 1% from recorded center (ratchet) (trigger B gated off — asymmetricBounds whitelist)",
37
+ "gridPriceOffset": "disabled (asymmetricBounds whitelist)",
38
+ "repositionAccounting": "unfilled orders canceled + counted (incl armed refills/rebids); bought-and-held base carries across resets in a weighted-average-entry inventory pool (resync never market-sells); end-of-run inventory mark is informational and excluded from scoring",
39
+ "cycleEconomics": "slot rotation: filled buy re-offers one rail step up; that refill selling books ~increment% minus round-trip fee and the freed quote re-bids one step down; unlinked initial-grid sells only execute against held inventory at weighted-average entry (no shorting)",
40
+ "totalGrossCapturePct": "sum of realized per-rotation gross from actual fixed prices (linked rotations + inventory sales)",
41
+ "totalNetCapturePct": "realized gross - roundtrip fee per completed disposition; excludes the end-of-run inventory mark",
42
+ "btsFees": "every order placement (initial grid + armed refills/rebids) pays maker create (0.4826*0.1 BTS), every reset cancel pays 0.00482 BTS; btsFeePts = total BTS * txFeePrice / btsFeeCapital * 100 deducted from net before scoring",
43
+ "warmup": "getAmaWarmupBars(er, slow, 0, fast)",
44
+ "riskPenalty": "avgOpenDurationBars*1 + peakOpenOrders*2 + avgImbalance*1.2 + canceledOnReposition*0.15",
45
+ "finalScore": "baseScore - riskPenalty"
46
+ }
47
+ },
48
+ "results": [
49
+ {
50
+ "strategy": {
51
+ "id": "AMA1",
52
+ "name": "AMA1",
53
+ "er": 500,
54
+ "fast": 2,
55
+ "slow": 50
56
+ },
57
+ "best": {
58
+ "spreadPct": 4,
59
+ "incrementPct": 0.01,
60
+ "maxMinRatio": 2,
61
+ "touchedOrders": 17118,
62
+ "matchedPairs": 4463,
63
+ "cyclesTotal": 4463,
64
+ "rotationCount": 1911,
65
+ "inventorySaleCount": 2552,
66
+ "avgCyclesPerSlot": 32.81617647058823,
67
+ "fillEfficiency": 26.071971024652413,
68
+ "totalGrossCapturePct": 74380.64032509834,
69
+ "totalNetCapturePct": 73488.04032508115,
70
+ "btsFeePts": 73.45986739997919,
71
+ "btsFeesBts": 7345.986739997918,
72
+ "totalNetCaptureAfterFeesPct": 73414.58045768116,
73
+ "avgNetPerPair": 16.46606325903678,
74
+ "canceledOnReposition": 129640,
75
+ "repositionCount": 972,
76
+ "driftTriggerCount": 972,
77
+ "slopeTriggerCount": 0,
78
+ "inventoryUnits": 567,
79
+ "inventoryAvgEntry": 1480.717680275907,
80
+ "inventoryNetPts": -8250.559317877065,
81
+ "offsetAppliedCount": 0,
82
+ "avgOpenDurationBars": 7.108843537414966,
83
+ "peakOpenOrders": 136,
84
+ "avgImbalance": 4.6666405484818805,
85
+ "riskPenalty": 19730.708812195593,
86
+ "baseScore": 19140.628144796767,
87
+ "utilization": 67.06103580662854,
88
+ "score": -590.0806673988263
89
+ }
90
+ },
91
+ {
92
+ "strategy": {
93
+ "id": "AMA2",
94
+ "name": "AMA2",
95
+ "er": 500,
96
+ "fast": 2,
97
+ "slow": 50
98
+ },
99
+ "best": {
100
+ "spreadPct": 4,
101
+ "incrementPct": 0.01,
102
+ "maxMinRatio": 2,
103
+ "touchedOrders": 17118,
104
+ "matchedPairs": 4463,
105
+ "cyclesTotal": 4463,
106
+ "rotationCount": 1911,
107
+ "inventorySaleCount": 2552,
108
+ "avgCyclesPerSlot": 32.81617647058823,
109
+ "fillEfficiency": 26.071971024652413,
110
+ "totalGrossCapturePct": 74380.64032509834,
111
+ "totalNetCapturePct": 73488.04032508115,
112
+ "btsFeePts": 73.45986739997919,
113
+ "btsFeesBts": 7345.986739997918,
114
+ "totalNetCaptureAfterFeesPct": 73414.58045768116,
115
+ "avgNetPerPair": 16.46606325903678,
116
+ "canceledOnReposition": 129640,
117
+ "repositionCount": 972,
118
+ "driftTriggerCount": 972,
119
+ "slopeTriggerCount": 0,
120
+ "inventoryUnits": 567,
121
+ "inventoryAvgEntry": 1480.717680275907,
122
+ "inventoryNetPts": -8250.559317877065,
123
+ "offsetAppliedCount": 0,
124
+ "avgOpenDurationBars": 7.108843537414966,
125
+ "peakOpenOrders": 136,
126
+ "avgImbalance": 4.6666405484818805,
127
+ "riskPenalty": 19730.708812195593,
128
+ "baseScore": 19140.628144796767,
129
+ "utilization": 67.06103580662854,
130
+ "score": -590.0806673988263
131
+ }
132
+ },
133
+ {
134
+ "strategy": {
135
+ "id": "AMA3",
136
+ "name": "AMA3",
137
+ "er": 500,
138
+ "fast": 2,
139
+ "slow": 50
140
+ },
141
+ "best": {
142
+ "spreadPct": 4,
143
+ "incrementPct": 0.01,
144
+ "maxMinRatio": 2,
145
+ "touchedOrders": 17118,
146
+ "matchedPairs": 4463,
147
+ "cyclesTotal": 4463,
148
+ "rotationCount": 1911,
149
+ "inventorySaleCount": 2552,
150
+ "avgCyclesPerSlot": 32.81617647058823,
151
+ "fillEfficiency": 26.071971024652413,
152
+ "totalGrossCapturePct": 74380.64032509834,
153
+ "totalNetCapturePct": 73488.04032508115,
154
+ "btsFeePts": 73.45986739997919,
155
+ "btsFeesBts": 7345.986739997918,
156
+ "totalNetCaptureAfterFeesPct": 73414.58045768116,
157
+ "avgNetPerPair": 16.46606325903678,
158
+ "canceledOnReposition": 129640,
159
+ "repositionCount": 972,
160
+ "driftTriggerCount": 972,
161
+ "slopeTriggerCount": 0,
162
+ "inventoryUnits": 567,
163
+ "inventoryAvgEntry": 1480.717680275907,
164
+ "inventoryNetPts": -8250.559317877065,
165
+ "offsetAppliedCount": 0,
166
+ "avgOpenDurationBars": 7.108843537414966,
167
+ "peakOpenOrders": 136,
168
+ "avgImbalance": 4.6666405484818805,
169
+ "riskPenalty": 19730.708812195593,
170
+ "baseScore": 19140.628144796767,
171
+ "utilization": 67.06103580662854,
172
+ "score": -590.0806673988263
173
+ }
174
+ },
175
+ {
176
+ "strategy": {
177
+ "id": "AMA4",
178
+ "name": "AMA4",
179
+ "er": 500,
180
+ "fast": 2,
181
+ "slow": 50
182
+ },
183
+ "best": {
184
+ "spreadPct": 4,
185
+ "incrementPct": 0.01,
186
+ "maxMinRatio": 2,
187
+ "touchedOrders": 17118,
188
+ "matchedPairs": 4463,
189
+ "cyclesTotal": 4463,
190
+ "rotationCount": 1911,
191
+ "inventorySaleCount": 2552,
192
+ "avgCyclesPerSlot": 32.81617647058823,
193
+ "fillEfficiency": 26.071971024652413,
194
+ "totalGrossCapturePct": 74380.64032509834,
195
+ "totalNetCapturePct": 73488.04032508115,
196
+ "btsFeePts": 73.45986739997919,
197
+ "btsFeesBts": 7345.986739997918,
198
+ "totalNetCaptureAfterFeesPct": 73414.58045768116,
199
+ "avgNetPerPair": 16.46606325903678,
200
+ "canceledOnReposition": 129640,
201
+ "repositionCount": 972,
202
+ "driftTriggerCount": 972,
203
+ "slopeTriggerCount": 0,
204
+ "inventoryUnits": 567,
205
+ "inventoryAvgEntry": 1480.717680275907,
206
+ "inventoryNetPts": -8250.559317877065,
207
+ "offsetAppliedCount": 0,
208
+ "avgOpenDurationBars": 7.108843537414966,
209
+ "peakOpenOrders": 136,
210
+ "avgImbalance": 4.6666405484818805,
211
+ "riskPenalty": 19730.708812195593,
212
+ "baseScore": 19140.628144796767,
213
+ "utilization": 67.06103580662854,
214
+ "score": -590.0806673988263
215
+ }
216
+ }
217
+ ]
218
+ }
@@ -33,7 +33,8 @@ The sections below cover manual usage (explicit candle files, direct runner flag
33
33
  - Candle timeframe buttons: `1h`, `4h`, `1d`, `1w`
34
34
  - Pair-orientation switcher for `A/B` and `B/A`
35
35
  - SMA overlay
36
- - AMA overlay with explicit `erPeriod`, `fastPeriod`, and `slowPeriod` inputs
36
+ - Bot-grid range highlight (the bot's min/max around AMA with live asymmetric tilt; green above AMA when up, red below when down)
37
+ - Range-scale switch: fit the price axis to the range band
37
38
  - VWMA overlay
38
39
  - Bottom volume panel
39
40
  - Crosshair legend with current candle values
@@ -181,6 +182,9 @@ market_adapter/data/lp/<pair>/lp_pool_<id>_<interval>.json
181
182
  | `--no-sma` | Disable SMA | — |
182
183
  | `--no-ama` | Disable AMA | — |
183
184
  | `--no-vwap` | Disable VWMA | — |
185
+ | `--no-range` | Disable range highlight | — |
186
+ | `--range-scale` | Range Scaling: size the band by AMA slope like the grid build + fit price axis to it | — |
187
+ | `--range-span <mult>` | x-range around AMA, 1.25–2 (default: bot grid setting) | bot grid |
184
188
  | `--quiet` | Suppress progress logs | — |
185
189
 
186
190
  ## Notes
@@ -35,6 +35,9 @@ function parseArgs() {
35
35
  amaEnabled: boolean;
36
36
  vwapEnabled: boolean;
37
37
  vwapBars: number;
38
+ rangeEnabled: boolean;
39
+ rangeScaleEnabled: boolean;
40
+ rangeSpan: number | undefined;
38
41
  quiet: boolean;
39
42
  listBots: boolean;
40
43
  } = {
@@ -50,6 +53,9 @@ function parseArgs() {
50
53
  amaEnabled: true,
51
54
  vwapEnabled: false,
52
55
  vwapBars: 500,
56
+ rangeEnabled: true,
57
+ rangeScaleEnabled: false,
58
+ rangeSpan: undefined,
53
59
  quiet: false,
54
60
  listBots: false,
55
61
  };
@@ -72,7 +78,9 @@ function parseArgs() {
72
78
  else if (arg === '--no-sma') config.smaEnabled = false;
73
79
  else if (arg === '--no-ama') config.amaEnabled = false;
74
80
  else if (arg === '--no-vwap') config.vwapEnabled = false;
75
- else if (arg === '--vwap-bars') config.vwapBars = Math.max(24, parseInt(args[++i], 10) || 500);
81
+ else if (arg === '--no-range') config.rangeEnabled = false;
82
+ else if (arg === '--range-scale') config.rangeScaleEnabled = true;
83
+ else if (arg === '--range-span') config.rangeSpan = parseFloat(args[++i]);
76
84
  else if (arg === '--list-bots') config.listBots = true;
77
85
  else if (arg === '--quiet') config.quiet = true;
78
86
  }
@@ -125,6 +133,20 @@ async function main() {
125
133
  const hasAmaGridPrice = AMA_KEYWORDS.has(String(botMeta?.gridPrice || '').trim().toLowerCase());
126
134
  const amaEnabled = hasAmaGridPrice ? config.amaEnabled : false;
127
135
 
136
+ // Bot grid bounds for the range highlight: mirrors the runtime grid
137
+ // (center = AMA, min "Nx" = center/N, max "Nx" = center*N) with the
138
+ // live asymmetric tilt. Null when no bot key (width% fallback in-page).
139
+ const grid = botMeta?.minPrice != null && botMeta?.maxPrice != null ? {
140
+ minPrice: botMeta.minPrice,
141
+ maxPrice: botMeta.maxPrice,
142
+ incrementPercent: Number(botMeta.incrementPercent) > 0 ? Number(botMeta.incrementPercent) : null,
143
+ maxAsymmetryFactor: Number.isFinite(Number(botMeta?.asymmetricBounds?.maxAsymmetryFactor))
144
+ ? Number(botMeta.asymmetricBounds.maxAsymmetryFactor)
145
+ : null,
146
+ minScaleSlots: Number.isFinite(Number(botMeta?.asymmetricBounds?.minScaleSlots))
147
+ ? Number(botMeta.asymmetricBounds.minScaleSlots)
148
+ : null,
149
+ } : null;
128
150
  const html = generateHTML({
129
151
  candles,
130
152
  meta: jsonMeta || {
@@ -141,6 +163,10 @@ async function main() {
141
163
  amaEnabled,
142
164
  vwapEnabled: config.vwapEnabled,
143
165
  vwapBars: config.vwapBars,
166
+ rangeEnabled: config.rangeEnabled,
167
+ rangeScaleEnabled: config.rangeScaleEnabled,
168
+ rangeSpan: config.rangeSpan,
169
+ grid,
144
170
  priceScale: config.priceScale === 'linear' ? 'linear' : 'log',
145
171
  defaultTimeframe: '1h',
146
172
  marketAdapter: MARKET_ADAPTER,