dexbot 1.4.14 → 1.4.16

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 (74) hide show
  1. package/README.md +50 -59
  2. package/claw/data/positions.json +2939 -1
  3. package/claw/modules/chain_broadcast.ts +4 -5
  4. package/claw/modules/credit_runtime_adapter.ts +6 -7
  5. package/claw/modules/dexbot_profiles.ts +4 -1
  6. package/claw/modules/launcher_paths.ts +4 -1
  7. package/claw/package.json +1 -1
  8. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  9. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  10. package/claw/tests/test_claw_mcp_transport.ts +2 -2
  11. package/dist/credential-daemon.js +7 -7
  12. package/dist/credential-daemon.js.map +1 -1
  13. package/dist/dexbot.d.ts.map +1 -1
  14. package/dist/dexbot.js +17 -1
  15. package/dist/dexbot.js.map +1 -1
  16. package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
  17. package/dist/market_adapter/core/market_adapter_service.js +7 -1
  18. package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
  19. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +1 -2
  20. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
  21. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
  22. package/dist/market_adapter/inputs/fetch_lp_data.js +2 -3
  23. package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
  24. package/dist/market_adapter/market_adapter.d.ts.map +1 -1
  25. package/dist/market_adapter/market_adapter.js +1 -0
  26. package/dist/market_adapter/market_adapter.js.map +1 -1
  27. package/dist/market_adapter/utils/data_discovery.js +2 -2
  28. package/dist/market_adapter/utils/data_discovery.js.map +1 -1
  29. package/dist/modules/chain_keys.d.ts.map +1 -1
  30. package/dist/modules/chain_keys.js +7 -1
  31. package/dist/modules/chain_keys.js.map +1 -1
  32. package/dist/modules/config.d.ts +3 -0
  33. package/dist/modules/config.d.ts.map +1 -1
  34. package/dist/modules/config.js +3 -0
  35. package/dist/modules/config.js.map +1 -1
  36. package/dist/modules/credential_policy.js +1 -1
  37. package/dist/modules/credential_policy.js.map +1 -1
  38. package/dist/modules/credential_runtime.d.ts +0 -3
  39. package/dist/modules/credential_runtime.d.ts.map +1 -1
  40. package/dist/modules/credential_runtime.js +5 -27
  41. package/dist/modules/credential_runtime.js.map +1 -1
  42. package/dist/modules/key_store.js +1 -1
  43. package/dist/modules/key_store.js.map +1 -1
  44. package/dist/modules/launcher/child_env.d.ts.map +1 -1
  45. package/dist/modules/launcher/child_env.js +3 -0
  46. package/dist/modules/launcher/child_env.js.map +1 -1
  47. package/dist/modules/launcher/credential_daemon.d.ts.map +1 -1
  48. package/dist/modules/launcher/credential_daemon.js +3 -3
  49. package/dist/modules/launcher/credential_daemon.js.map +1 -1
  50. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
  51. package/dist/modules/launcher/monolithic_runtime.js +2 -2
  52. package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
  53. package/dist/modules/order/utils/system.d.ts.map +1 -1
  54. package/dist/modules/order/utils/system.js +11 -1
  55. package/dist/modules/order/utils/system.js.map +1 -1
  56. package/dist/modules/paths.d.ts +72 -2
  57. package/dist/modules/paths.d.ts.map +1 -1
  58. package/dist/modules/paths.js +199 -29
  59. package/dist/modules/paths.js.map +1 -1
  60. package/dist/pm2.js +3 -3
  61. package/dist/pm2.js.map +1 -1
  62. package/dist/scripts/update.d.ts +14 -5
  63. package/dist/scripts/update.d.ts.map +1 -1
  64. package/dist/scripts/update.js +335 -172
  65. package/dist/scripts/update.js.map +1 -1
  66. package/package.json +4 -3
  67. package/scripts/README.md +20 -4
  68. package/scripts/clear-all.sh +39 -12
  69. package/scripts/clear-logs.sh +1 -1
  70. package/scripts/clear-market-adapter.sh +3 -3
  71. package/scripts/clear-orders.sh +1 -1
  72. package/scripts/create-bot-symlinks.sh +4 -2
  73. package/scripts/lib/dexbot-paths.sh +114 -0
  74. package/scripts/reset-settings.sh +1 -1
package/README.md CHANGED
@@ -31,22 +31,13 @@ DEXBot2 is the first open source trading bot with zero runtime dependencies and
31
31
 
32
32
  ```bash
33
33
  # Requires Node.js v22.12 or newer
34
- # Option A — Global install
35
34
  npm i -g dexbot
36
35
 
37
- # Option B — Clone + npm link
38
- git clone https://github.com/froooze/DEXBot2.git && cd DEXBot2 && npm install && npm link
39
-
40
36
  dexbot key # Set up master password and import keys
41
37
  dexbot bot # Create and manage bot configurations
42
38
  dexbot start # Start DEXBot2
43
39
 
44
- # Option C — Clone + local (no global install, works on all platforms)
45
- git clone https://github.com/froooze/DEXBot2.git && cd DEXBot2 && npm install
46
-
47
- npx dexbot key # Set up master password and import keys
48
- npx dexbot bot # Create and manage bot configurations
49
- npx dexbot start # Start DEXBot2
40
+ # Developing on DEXBot2? See Install from source below — same commands, same data.
50
41
  ```
51
42
 
52
43
  Detailed setup: [Installation](#-installation).
@@ -65,12 +56,10 @@ New to BitShares? Work through the [BitShares Onboarding Tutorial](docs/BITSHARE
65
56
 
66
57
  ### Prerequisites
67
58
 
68
- You'll need **Git** and **Node.js** installed.
59
+ You'll need **Git** and **Node.js** v22.12 or newer installed.
69
60
 
70
61
  #### Linux Users
71
62
 
72
- DEXBot needs Node.js v22.12 or newer. Most distro repos ship an outdated `nodejs` package, so install Node from [nodejs.org](https://nodejs.org/en/download).
73
-
74
63
  Install Git:
75
64
 
76
65
  ```bash
@@ -82,7 +71,7 @@ sudo apt-get install git
82
71
  sudo dnf install git
83
72
  ```
84
73
 
85
- Then install Node.js via nvm:
74
+ Most distro repos ship an outdated `nodejs` package, so install Node from [nodejs.org](https://nodejs.org/en/download).
86
75
 
87
76
  ```bash
88
77
  # e.g. via nvm (from https://nodejs.org/en/download)
@@ -99,8 +88,6 @@ node --version && npm --version && git --version
99
88
 
100
89
  #### macOS Users
101
90
 
102
- DEXBot needs Node.js v22.12 or newer.
103
-
104
91
  Use Homebrew to install Node.js and Git:
105
92
  ```bash
106
93
  # Install Homebrew if not already installed
@@ -112,8 +99,6 @@ brew install node git
112
99
 
113
100
  #### Windows Users
114
101
 
115
- DEXBot needs Node.js v22.12 or newer.
116
-
117
102
  1. Install **Git** from [git-scm.com](https://git-scm.com/install/windows) (accept defaults, restart after)
118
103
  2. Install **Node.js LTS** from [nodejs.org](https://nodejs.org/en/download) (accept defaults, restart after)
119
104
  3. Verify installation in Command Prompt:
@@ -122,72 +107,78 @@ DEXBot needs Node.js v22.12 or newer.
122
107
  ```
123
108
  All three should display version numbers.
124
109
 
125
- ### Install
110
+ ### Install from npm
126
111
 
127
112
  ```bash
128
- # Option A — Install globally via npm
129
- npm i -g dexbot
130
-
131
- # Option B — Clone + npm link
132
- git clone https://github.com/froooze/DEXBot2.git && cd DEXBot2 && npm install && npm link
133
-
134
- # Option C — Clone + local (no global install, works on all platforms)
135
- git clone https://github.com/froooze/DEXBot2.git && cd DEXBot2 && npm install
136
- npx dexbot
137
- npx dexbot start
113
+ npm i -g dexbot # stable release from the npm registry
138
114
  ```
139
115
 
140
- Then set up your master password, keys and add bots:
116
+ ### Install from source (developers)
141
117
 
142
118
  ```bash
143
- dexbot key
144
- dexbot bot
119
+ git clone https://github.com/froooze/DEXBot2.git && cd DEXBot2
120
+ npm install
121
+ npm link # optional: exposes `dexbot` from your checkout
145
122
  ```
146
123
 
124
+ ### Where your data lives
125
+
126
+ Both installs use the same CLI and store all user state — keys, `bots.json`, logs — in `~/.config/dexbot2/profiles` (Windows: `%USERPROFILE%\.config\dexbot2\profiles`). State lives outside the repo/package tree, so it survives reinstalls and `npm update -g`. A source checkout that already contains a populated `profiles/` directory keeps using it. Override the location with `DEXBOT_PROFILE_ROOT` (see the [developer guide](docs/developer_guide.md)).
127
+
147
128
  ## 🔧 Configuration
148
129
 
149
- ### Recommended Bot Setup
130
+ ### Create Your Bot
150
131
 
151
- Keep the generated defaults and tune only these first:
132
+ 1. Set up your master password and import your BitShares **active** key (WIF):
152
133
 
153
- 1. `targetSpreadPercent`
154
- 2. `incrementPercent`
155
- 3. `gridPrice: "ama"`
156
- 4. `minPrice` / `maxPrice`
134
+ ```bash
135
+ dexbot key
136
+ ```
137
+
138
+ 2. Create a bot through the interactive prompts:
139
+
140
+ ```bash
141
+ dexbot bot
142
+ ```
143
+
144
+ This stores your configuration in `bots.json` in the [profiles directory](#where-your-data-lives). The generated
145
+ defaults are a good starting point — the next step walks through the few
146
+ options worth tuning.
157
147
 
158
- `targetSpreadPercent` controls profit room per completed cycle. A wider spread
159
- targets more profit per cycle but trades less often.
148
+ ### Recommended Bot Setup
160
149
 
161
- `incrementPercent` controls grid density and order size. Smaller increments
162
- create more grid levels and smaller orders; larger increments create fewer
163
- levels and larger orders.
150
+ Keep the default settings first, and tune these:
164
151
 
165
- Use `gridPrice: "ama"` so the market adapter can center the grid on AMA. Once
166
- AMA is active, tighten `minPrice` / `maxPrice` around the maximum expected
167
- market volatility instead of using an unnecessarily wide range.
152
+ 1. **Tune `targetSpreadPercent`** — controls profit room per completed cycle. A
153
+ wider spread targets more profit per cycle but trades less often.
168
154
 
169
- ### Simple AMA Workflow
155
+ 2. **Tune `incrementPercent`** — controls grid density and order size. Smaller
156
+ increments create more grid levels and smaller orders; larger increments
157
+ create fewer levels and larger orders.
170
158
 
171
- 1. Create the bot with `dexbot bot`.
172
- 2. Leave defaults unchanged.
173
- 3. Tune `targetSpreadPercent` and `incrementPercent`.
174
- 4. Set `gridPrice` to `ama`.
175
- 5. Generate the market-adapter whitelist:
159
+ 3. **Set `gridPrice` to `"ama"`** — so the market adapter can center the grid
160
+ on AMA. Pick a specific preset if desired: `"ama1"` is the fastest,
161
+ `"ama4"` the slowest, and `"ama"` uses the pair's default preset.
162
+
163
+ 4. **Generate the market-adapter whitelist:**
176
164
 
177
165
  ```bash
178
166
  dexbot white
179
167
  ```
180
168
 
181
- This writes `profiles/market_adapter_whitelist.json`. New AMA bots get AMA
169
+ This writes `market_adapter_whitelist.json` in the profiles directory. New AMA bots get AMA
182
170
  live writes and range scaling. Use `dexbot white --dynamic-weight` for
183
171
  newly generated dynamic-weight entries; existing entries are preserved.
184
172
 
185
- 6. Start DEXBot2 with `dexbot start` (or `dexbot pm2` for PM2).
186
- 7. Then tune `minPrice` / `maxPrice` for the market's volatility range.
173
+ 5. **Start DEXBot2** with `dexbot start`.
174
+
175
+ 6. **Tune `minPrice` / `maxPrice`** around the market's volatility range. Once
176
+ AMA is active, tighten them around the maximum expected market volatility
177
+ instead of using an unnecessarily wide range.
187
178
 
188
179
  ### Bot Options Reference
189
180
 
190
- Configuration options from `dexbot bot`, stored in `profiles/bots.json`:
181
+ Configuration options from `dexbot bot`, stored in `bots.json` in the profiles directory:
191
182
 
192
183
  <details><summary><mark>Full parameter reference (click to expand)</mark></summary>
193
184
 
@@ -214,7 +205,7 @@ Configuration options from `dexbot bot`, stored in `profiles/bots.json`:
214
205
 
215
206
  ### General Options (Global)
216
207
 
217
- Global settings via `dexbot bot`, stored in `profiles/general.settings.json`:
208
+ Global settings via `dexbot bot`, stored in `general.settings.json` in the profiles directory:
218
209
 
219
210
  <details><summary><mark>Global settings reference (click to expand)</mark></summary>
220
211
 
@@ -228,7 +219,7 @@ Global settings via `dexbot bot`, stored in `profiles/general.settings.json`:
228
219
 
229
220
  ### Constants and Overrides
230
221
 
231
- Defaults in [`modules/constants.ts`](modules/constants.ts) are overridable at global, pair, and bot level via `profiles/general.settings.json`, `profiles/market_profiles.json`, and `profiles/market_adapter_settings.json`. See [market_adapter/README.md](market_adapter/README.md#settings-and-overrides) for examples.
222
+ Defaults in [`modules/constants.ts`](modules/constants.ts) are overridable at global, pair, and bot level via `general.settings.json`, `market_profiles.json`, and `market_adapter_settings.json` in the profiles directory. See [market_adapter/README.md](market_adapter/README.md#settings-and-overrides) for examples.
232
223
 
233
224
  ## 🎯 Zero-Dependency Process Management
234
225
 
@@ -279,7 +270,7 @@ Always use `dexbot pm2 restart` instead of raw `pm2 restart all` — the wrapper
279
270
 
280
271
  > Repo-root users can use `./pm2` instead of `dexbot pm2`.
281
272
 
282
- Logs are written to `profiles/logs/` in all modes: the monolithic runtime uses `dexbot.log` / `dexbot-error.log`, and per-bot output uses `<bot>.log` / `<bot>-error.log`.
273
+ Logs are written to `logs/` in the profiles directory in all modes: the monolithic runtime uses `dexbot.log` / `dexbot-error.log`, and per-bot output uses `<bot>.log` / `<bot>-error.log`.
283
274
 
284
275
  ## 📚 Documentation
285
276