dexbot 1.6.4 → 1.6.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 (126) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +12 -12
  3. package/analysis/README.md +8 -1
  4. package/analysis/ama_fitting/package.json +1 -1
  5. package/analysis/analyze_dynamic_weight.ts +9 -3
  6. package/analysis/tradingview/analyze_tradingview.ts +5 -0
  7. package/analysis/tradingview/tradingview_uplot_chart_generator.ts +2 -2
  8. package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +35 -2
  9. package/analysis/trend_detection/dynamic_weight_chart_generator.ts +82 -10
  10. package/analysis/trend_detection/package.json +1 -1
  11. package/claw/modules/dexbot_profiles.ts +4 -3
  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/claw/tests/test_dexbot_profiles.ts +18 -1
  17. package/dist/analysis/analyze_dynamic_weight.js +9 -3
  18. package/dist/analysis/analyze_dynamic_weight.js.map +1 -1
  19. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -1
  20. package/dist/analysis/tradingview/analyze_tradingview.js +5 -0
  21. package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -1
  22. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +2 -2
  23. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -1
  24. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +82 -10
  25. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -1
  26. package/dist/dexbot.d.ts.map +1 -1
  27. package/dist/dexbot.js +27 -68
  28. package/dist/dexbot.js.map +1 -1
  29. package/dist/market_adapter/core/asymmetric_bounds.d.ts +2 -2
  30. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
  31. package/dist/market_adapter/core/asymmetric_bounds.js +15 -12
  32. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
  33. package/dist/market_adapter/interval_utils.d.ts +1 -1
  34. package/dist/market_adapter/interval_utils.js +1 -1
  35. package/dist/modules/account_bots.d.ts +55 -5
  36. package/dist/modules/account_bots.d.ts.map +1 -1
  37. package/dist/modules/account_bots.js +258 -117
  38. package/dist/modules/account_bots.js.map +1 -1
  39. package/dist/modules/bot_defaults.d.ts +98 -0
  40. package/dist/modules/bot_defaults.d.ts.map +1 -0
  41. package/dist/modules/bot_defaults.js +169 -0
  42. package/dist/modules/bot_defaults.js.map +1 -0
  43. package/dist/modules/bot_settings.d.ts.map +1 -1
  44. package/dist/modules/bot_settings.js +4 -1
  45. package/dist/modules/bot_settings.js.map +1 -1
  46. package/dist/modules/config.d.ts +1 -0
  47. package/dist/modules/config.d.ts.map +1 -1
  48. package/dist/modules/config.js +1 -0
  49. package/dist/modules/config.js.map +1 -1
  50. package/dist/modules/constants.d.ts +11 -2
  51. package/dist/modules/constants.d.ts.map +1 -1
  52. package/dist/modules/constants.js +40 -27
  53. package/dist/modules/constants.js.map +1 -1
  54. package/dist/modules/dexbot_maintenance_runtime.d.ts +1 -1
  55. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  56. package/dist/modules/dexbot_maintenance_runtime.js +9 -4
  57. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  58. package/dist/modules/launcher/adapter_requirement.js +1 -1
  59. package/dist/modules/launcher/launch_modes.d.ts +17 -1
  60. package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
  61. package/dist/modules/launcher/launch_modes.js +18 -1
  62. package/dist/modules/launcher/launch_modes.js.map +1 -1
  63. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
  64. package/dist/modules/launcher/monolithic_runtime.js +8 -1
  65. package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
  66. package/dist/modules/market_adapter_whitelist.d.ts +40 -1
  67. package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
  68. package/dist/modules/market_adapter_whitelist.js +161 -11
  69. package/dist/modules/market_adapter_whitelist.js.map +1 -1
  70. package/dist/modules/order/grid.d.ts +9 -0
  71. package/dist/modules/order/grid.d.ts.map +1 -1
  72. package/dist/modules/order/grid.js +23 -5
  73. package/dist/modules/order/grid.js.map +1 -1
  74. package/dist/modules/order/manager.js +3 -2
  75. package/dist/modules/order/manager.js.map +1 -1
  76. package/dist/modules/order/utils/system.d.ts +5 -1
  77. package/dist/modules/order/utils/system.d.ts.map +1 -1
  78. package/dist/modules/order/utils/system.js +5 -2
  79. package/dist/modules/order/utils/system.js.map +1 -1
  80. package/dist/modules/settings_merge.d.ts +10 -1
  81. package/dist/modules/settings_merge.d.ts.map +1 -1
  82. package/dist/modules/settings_merge.js +27 -17
  83. package/dist/modules/settings_merge.js.map +1 -1
  84. package/dist/modules/validate_profiles.d.ts.map +1 -1
  85. package/dist/modules/validate_profiles.js +4 -3
  86. package/dist/modules/validate_profiles.js.map +1 -1
  87. package/dist/scripts/chart_command.d.ts +48 -0
  88. package/dist/scripts/chart_command.d.ts.map +1 -0
  89. package/dist/scripts/chart_command.js +504 -0
  90. package/dist/scripts/chart_command.js.map +1 -0
  91. package/dist/scripts/dw.d.ts +3 -0
  92. package/dist/scripts/dw.d.ts.map +1 -0
  93. package/dist/scripts/dw.js +30 -0
  94. package/dist/scripts/dw.js.map +1 -0
  95. package/dist/scripts/tv.d.ts +1 -31
  96. package/dist/scripts/tv.d.ts.map +1 -1
  97. package/dist/scripts/tv.js +10 -463
  98. package/dist/scripts/tv.js.map +1 -1
  99. package/dist/scripts/update.js +99 -62
  100. package/dist/scripts/update.js.map +1 -1
  101. package/dist/scripts/update_dist_freshness.d.ts +46 -0
  102. package/dist/scripts/update_dist_freshness.d.ts.map +1 -0
  103. package/dist/scripts/update_dist_freshness.js +115 -0
  104. package/dist/scripts/update_dist_freshness.js.map +1 -0
  105. package/dist/unlock.js +1 -1
  106. package/dist/unlock.js.map +1 -1
  107. package/docs/BITSHARES_ONBOARDING.md +10 -7
  108. package/docs/DEXBOT_COMPARISON.md +3 -3
  109. package/docs/EVOLUTION.md +8 -7
  110. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +4 -4
  111. package/docs/GRID_RECALCULATION.md +20 -24
  112. package/docs/GRID_RECONCILE.md +2 -2
  113. package/docs/LOGGING.md +1 -0
  114. package/docs/README.md +16 -16
  115. package/docs/WORKFLOW.md +1 -2
  116. package/docs/architecture.md +2 -2
  117. package/docs/developer_guide.md +1 -0
  118. package/market_adapter/README.md +36 -60
  119. package/modules/README.md +2 -1
  120. package/package.json +1 -2
  121. package/scripts/README.md +18 -25
  122. package/scripts/reset-settings.sh +1 -1
  123. package/dist/scripts/generate_market_adapter_whitelist.d.ts +0 -15
  124. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +0 -1
  125. package/dist/scripts/generate_market_adapter_whitelist.js +0 -191
  126. package/dist/scripts/generate_market_adapter_whitelist.js.map +0 -1
@@ -12,7 +12,7 @@ function toIntervalLabel(intervalSeconds) {
12
12
  * Filename-safe slug: lowercase, non-alphanumerics collapsed to a single
13
13
  * underscore, no leading/trailing underscores. Single home for the helper
14
14
  * previously copied into fetch_lp_data.ts, kibana_feed_source.ts,
15
- * fetch_book_data.ts and scripts/tv.ts.
15
+ * fetch_book_data.ts and scripts/chart_command.ts.
16
16
  */
17
17
  function slugPart(value) {
18
18
  return String(value || '')
@@ -49,12 +49,13 @@
49
49
  * "active": true,
50
50
  * "dryRun": false,
51
51
  * "startPrice": "pool", // Price for order alignment: "pool", "book", or numeric
52
- * "gridPrice": null, // Reference price for x-factor bounds (3 options):
53
- * // "pool" / "book" = live pair price reference
52
+ * "gridPrice": "ama3", // Reference price for x-factor bounds (default "ama3"):
54
53
  * // "ama"/"ama1".."ama4" = market adapter writes a center snapshot to
55
54
  * // profiles/orders/<botKey>.dynamicgrid.json; grid reads the effective center on reset
56
- * // <number> = fixed numeric reference
57
- * // null = use startPrice
55
+ * // "pool" / "book" = live pair price reference (legacy, editor no longer offers it)
56
+ * // <number> = fixed numeric reference (legacy)
57
+ * // null = use startPrice (legacy); also accepted: false, empty/blank,
58
+ * // and the "none"/"null"/"start"/"startprice"/"s"/"n"/"no"/"f"/"0" spellings
58
59
  * "minPrice": "2x",
59
60
  * "maxPrice": "2x",
60
61
  * "incrementPercent": 0.5,
@@ -84,6 +85,55 @@
84
85
  * ===============================================================================
85
86
  */
86
87
  import { parseJsonWithComments } from './order/utils/system.js';
88
+ /**
89
+ * Loads general settings from profiles/general.settings.json.
90
+ * Delegates all merge logic to mergeSettings() in settings_merge.ts,
91
+ * which handles per-section strategies, NODES⇄NODE_MANAGEMENT mapping,
92
+ * and passthrough of unmapped NODES sub-keys.
93
+ * @returns {Object} The loaded settings or default settings if the file doesn't exist.
94
+ */
95
+ declare function loadGeneralSettings(): Record<string, any>;
96
+ /**
97
+ * Saves general settings to profiles/general.settings.json.
98
+ * @param {Object} settings - The settings object to save.
99
+ */
100
+ declare function saveGeneralSettings(settings: any): void;
101
+ /**
102
+ * Colors a grid-price value for display: GREEN only for AMA values
103
+ * ("ama"/"ama1".."ama4"), RED for everything else — pool/book references,
104
+ * numeric values and any unset grid price (null, false, blank/whitespace, and
105
+ * the "none"/"s"/"no"/"f"/"start" aliases) which delegates to startPrice and is
106
+ * therefore labeled "startPrice", always in red: the delegation itself is the
107
+ * thing the editor wants replaced by an AMA preset.
108
+ * @param {*} value - The grid price value to color.
109
+ * @returns {string} ANSI-colored value string.
110
+ */
111
+ declare function colorGridPriceValue(value: any): string;
112
+ /**
113
+ * Colors the pool label for the editor summary. An unset poolRef does NOT
114
+ * mean "no pool": when startPrice is "pool" the runtime auto-selects the
115
+ * pair's default pool, so it reads green `default`. Otherwise the pin is
116
+ * inert, shown as grey `none` so it does not compete with live values (a
117
+ * gridPrice of "pool"/"book" is discouraged and stays red in its own field).
118
+ * Display only — the stored poolRef is never changed here.
119
+ * @param {*} data - The bot draft.
120
+ * @returns {string} ANSI-colored pinned pool ID, `default` (green), or `none` (grey).
121
+ */
122
+ declare function formatPoolRefLabel(data: any): string;
123
+ /**
124
+ * Parses a raw boolean answer.
125
+ * Accepted: y/yes/true/1/t → true, n/no/false/0/f → false (case-insensitive);
126
+ * empty input keeps the current/default value; anything else is rejected so
127
+ * the caller can re-prompt (the old `startsWith('y')` rule silently parsed
128
+ * "true" as false).
129
+ * @param {string} raw - Raw prompt input.
130
+ * @param {boolean} [defaultValue] - Value returned for empty input.
131
+ * @returns {{ ok: boolean, value?: boolean }} ok=false for unrecognized input.
132
+ */
133
+ declare function parseBooleanInput(raw: any, defaultValue?: boolean): {
134
+ ok: boolean;
135
+ value?: boolean;
136
+ };
87
137
  /**
88
138
  * Normalizes a bot draft for editing or saving.
89
139
  * Preserves existing fields and strips unsupported runtime-managed fields.
@@ -137,5 +187,5 @@ declare function ensureBotAccountId(data: any, timeoutMs?: number, quiet?: boole
137
187
  * @returns {Promise<void>}
138
188
  */
139
189
  declare function main(): Promise<void>;
140
- export { main, normalizeBotDraft, ensureBotAccountId, parseJsonWithComments };
190
+ export { main, normalizeBotDraft, ensureBotAccountId, parseJsonWithComments, parseBooleanInput, colorGridPriceValue, formatPoolRefLabel, loadGeneralSettings, saveGeneralSettings };
141
191
  //# sourceMappingURL=account_bots.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account_bots.d.ts","sourceRoot":"","sources":["../../modules/account_bots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAUH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAg5BhE;;;;;GAKG;AACH,iBAAS,iBAAiB,CAAC,IAAI,KAAK,OAoBnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,iBAAe,kBAA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