dexbot 1.4.23 → 1.4.25

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 (137) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +1 -0
  3. package/analysis/README.md +49 -0
  4. package/analysis/ama_fitting/package.json +1 -1
  5. package/analysis/grid_correction_check.ts +896 -0
  6. package/analysis/trend_detection/package.json +1 -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/analysis/grid_correction_check.d.ts +90 -0
  12. package/dist/analysis/grid_correction_check.d.ts.map +1 -0
  13. package/dist/analysis/grid_correction_check.js +861 -0
  14. package/dist/analysis/grid_correction_check.js.map +1 -0
  15. package/dist/dexbot.d.ts.map +1 -1
  16. package/dist/dexbot.js +62 -6
  17. package/dist/dexbot.js.map +1 -1
  18. package/dist/modules/account_bots.d.ts.map +1 -1
  19. package/dist/modules/account_bots.js +53 -5
  20. package/dist/modules/account_bots.js.map +1 -1
  21. package/dist/modules/account_orders.d.ts +7 -10
  22. package/dist/modules/account_orders.d.ts.map +1 -1
  23. package/dist/modules/account_orders.js +26 -2
  24. package/dist/modules/account_orders.js.map +1 -1
  25. package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
  26. package/dist/modules/bitshares-native/subscriptions.js +176 -21
  27. package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
  28. package/dist/modules/chain_orders.d.ts.map +1 -1
  29. package/dist/modules/chain_orders.js +21 -2
  30. package/dist/modules/chain_orders.js.map +1 -1
  31. package/dist/modules/config.d.ts.map +1 -1
  32. package/dist/modules/config.js +27 -0
  33. package/dist/modules/config.js.map +1 -1
  34. package/dist/modules/constants.d.ts +15 -1
  35. package/dist/modules/constants.d.ts.map +1 -1
  36. package/dist/modules/constants.js +70 -6
  37. package/dist/modules/constants.js.map +1 -1
  38. package/dist/modules/credit_runtime.d.ts.map +1 -1
  39. package/dist/modules/credit_runtime.js +31 -32
  40. package/dist/modules/credit_runtime.js.map +1 -1
  41. package/dist/modules/dexbot_class.d.ts +24 -0
  42. package/dist/modules/dexbot_class.d.ts.map +1 -1
  43. package/dist/modules/dexbot_class.js +66 -12
  44. package/dist/modules/dexbot_class.js.map +1 -1
  45. package/dist/modules/dexbot_cow_runtime.d.ts +22 -17
  46. package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
  47. package/dist/modules/dexbot_cow_runtime.js +646 -128
  48. package/dist/modules/dexbot_cow_runtime.js.map +1 -1
  49. package/dist/modules/dexbot_fill_runtime.d.ts +11 -1
  50. package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
  51. package/dist/modules/dexbot_fill_runtime.js +108 -1
  52. package/dist/modules/dexbot_fill_runtime.js.map +1 -1
  53. package/dist/modules/dexbot_maintenance_runtime.d.ts +17 -1
  54. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  55. package/dist/modules/dexbot_maintenance_runtime.js +215 -26
  56. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  57. package/dist/modules/dexbot_startup_runtime.d.ts +1 -0
  58. package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
  59. package/dist/modules/dexbot_startup_runtime.js +58 -7
  60. package/dist/modules/dexbot_startup_runtime.js.map +1 -1
  61. package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
  62. package/dist/modules/dexbot_state_recovery.js +55 -3
  63. package/dist/modules/dexbot_state_recovery.js.map +1 -1
  64. package/dist/modules/graceful_shutdown.d.ts +12 -1
  65. package/dist/modules/graceful_shutdown.d.ts.map +1 -1
  66. package/dist/modules/graceful_shutdown.js +39 -1
  67. package/dist/modules/graceful_shutdown.js.map +1 -1
  68. package/dist/modules/key_store.d.ts.map +1 -1
  69. package/dist/modules/key_store.js +38 -1
  70. package/dist/modules/key_store.js.map +1 -1
  71. package/dist/modules/order/accounting.d.ts.map +1 -1
  72. package/dist/modules/order/accounting.js +20 -3
  73. package/dist/modules/order/accounting.js.map +1 -1
  74. package/dist/modules/order/grid.d.ts +1 -1
  75. package/dist/modules/order/grid.d.ts.map +1 -1
  76. package/dist/modules/order/grid.js +288 -31
  77. package/dist/modules/order/grid.js.map +1 -1
  78. package/dist/modules/order/grid_reconcile.d.ts +4 -2
  79. package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
  80. package/dist/modules/order/grid_reconcile.js +242 -222
  81. package/dist/modules/order/grid_reconcile.js.map +1 -1
  82. package/dist/modules/order/grid_reconcile_internal.d.ts +11 -1
  83. package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
  84. package/dist/modules/order/grid_reconcile_internal.js +132 -6
  85. package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
  86. package/dist/modules/order/manager.d.ts +68 -14
  87. package/dist/modules/order/manager.d.ts.map +1 -1
  88. package/dist/modules/order/manager.js +241 -52
  89. package/dist/modules/order/manager.js.map +1 -1
  90. package/dist/modules/order/strategy.d.ts.map +1 -1
  91. package/dist/modules/order/strategy.js +25 -8
  92. package/dist/modules/order/strategy.js.map +1 -1
  93. package/dist/modules/order/sync_engine.d.ts.map +1 -1
  94. package/dist/modules/order/sync_engine.js +261 -166
  95. package/dist/modules/order/sync_engine.js.map +1 -1
  96. package/dist/modules/order/utils/math.d.ts +47 -5
  97. package/dist/modules/order/utils/math.d.ts.map +1 -1
  98. package/dist/modules/order/utils/math.js +175 -11
  99. package/dist/modules/order/utils/math.js.map +1 -1
  100. package/dist/modules/order/utils/order.d.ts +16 -15
  101. package/dist/modules/order/utils/order.d.ts.map +1 -1
  102. package/dist/modules/order/utils/order.js +199 -32
  103. package/dist/modules/order/utils/order.js.map +1 -1
  104. package/dist/modules/order/utils/slot.d.ts +8 -0
  105. package/dist/modules/order/utils/slot.d.ts.map +1 -0
  106. package/dist/modules/order/utils/slot.js +16 -0
  107. package/dist/modules/order/utils/slot.js.map +1 -0
  108. package/dist/modules/order/utils/system.d.ts.map +1 -1
  109. package/dist/modules/order/utils/system.js +3 -2
  110. package/dist/modules/order/utils/system.js.map +1 -1
  111. package/dist/modules/order/utils/validate.d.ts +5 -8
  112. package/dist/modules/order/utils/validate.d.ts.map +1 -1
  113. package/dist/modules/order/utils/validate.js +64 -82
  114. package/dist/modules/order/utils/validate.js.map +1 -1
  115. package/dist/modules/order/working_grid.d.ts +5 -0
  116. package/dist/modules/order/working_grid.d.ts.map +1 -1
  117. package/dist/modules/order/working_grid.js +21 -0
  118. package/dist/modules/order/working_grid.js.map +1 -1
  119. package/dist/modules/paths.d.ts +4 -2
  120. package/dist/modules/paths.d.ts.map +1 -1
  121. package/dist/modules/paths.js +79 -24
  122. package/dist/modules/paths.js.map +1 -1
  123. package/dist/scripts/analyze-orders.d.ts.map +1 -1
  124. package/dist/scripts/analyze-orders.js +23 -2
  125. package/dist/scripts/analyze-orders.js.map +1 -1
  126. package/dist/scripts/generate_market_adapter_whitelist.d.ts +2 -5
  127. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
  128. package/dist/scripts/generate_market_adapter_whitelist.js +83 -1
  129. package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
  130. package/docs/DEXBOT_COMPARISON.md +15 -15
  131. package/docs/EVOLUTION.md +10 -8
  132. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
  133. package/docs/GRID_RECALCULATION.md +6 -0
  134. package/docs/README.md +2 -2
  135. package/market_adapter/README.md +10 -0
  136. package/package.json +2 -1
  137. package/scripts/README.md +4 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trend-detection",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "description": "Kalman filter trend detection with tactical/modal state tracking",
5
5
  "main": "../../dist/analysis/trend_detection/kalman_trend_analyzer.js",
6
6
  "scripts": {
package/claw/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dexbot2-claw",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "private": true,
5
5
  "description": "Claw bridge and runtime integration layer for BitShares and DEXBot2.",
6
6
  "type": "module",
@@ -2,7 +2,7 @@
2
2
  "id": "bitshares-claw",
3
3
  "name": "BitShares Claw",
4
4
  "description": "Native BitShares and DEXBot2 tools from the DEXBot2 claw integration",
5
- "version": "1.4.23",
5
+ "version": "1.4.25",
6
6
  "skills": [
7
7
  "skills"
8
8
  ],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bitshares-claw-openclaw-plugin",
3
3
  "private": true,
4
- "version": "1.4.23",
4
+ "version": "1.4.25",
5
5
  "type": "module",
6
6
  "main": "index.js"
7
7
  }
@@ -30,7 +30,7 @@ async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
30
30
  capabilities: {},
31
31
  clientInfo: {
32
32
  name: 'claw-mcp-transport-test',
33
- version: '1.4.23'
33
+ version: '1.4.25'
34
34
  },
35
35
  protocolVersion: '2024-11-05'
36
36
  }
@@ -187,7 +187,7 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
187
187
  capabilities: {},
188
188
  clientInfo: {
189
189
  name: 'claw-mcp-transport-test',
190
- version: '1.4.23'
190
+ version: '1.4.25'
191
191
  },
192
192
  protocolVersion: '2024-11-05'
193
193
  }
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ interface FillRecord {
3
+ time: string;
4
+ blockNum: number;
5
+ opNum: number;
6
+ orderId: string;
7
+ accountId: string;
8
+ pays: {
9
+ amount: number;
10
+ asset_id: string;
11
+ };
12
+ receives: {
13
+ amount: number;
14
+ asset_id: string;
15
+ };
16
+ fee: {
17
+ amount: number;
18
+ asset_id: string;
19
+ };
20
+ isMaker: boolean;
21
+ sort: any[];
22
+ }
23
+ interface TradeFill {
24
+ time: string;
25
+ orderId: string;
26
+ direction: 'buy' | 'sell';
27
+ baseAsset: string;
28
+ quoteAsset: string;
29
+ baseAmount: number;
30
+ quoteAmount: number;
31
+ price: number;
32
+ isMaker: boolean;
33
+ sequence: number;
34
+ }
35
+ interface Violation {
36
+ index: number;
37
+ pair: string;
38
+ direction: 'buy' | 'sell';
39
+ expected: string;
40
+ prev: TradeFill;
41
+ curr: TradeFill;
42
+ priceDelta: number;
43
+ priceDeltaPct: number;
44
+ pivot: number;
45
+ halfInc: number;
46
+ threshold: number;
47
+ }
48
+ interface AggregatedOrder {
49
+ orderId: string;
50
+ direction: 'buy' | 'sell';
51
+ baseAsset: string;
52
+ quoteAsset: string;
53
+ baseAmount: number;
54
+ quoteAmount: number;
55
+ price: number;
56
+ time: string;
57
+ sequence: number;
58
+ fillCount: number;
59
+ isMaker: boolean;
60
+ }
61
+ /**
62
+ * LAST-FILL-GUARD helper — pivot ± halfIncrement (replaces price-tolerance).
63
+ * last fill @x with increment i: BUY < x*(1 - i/2/100), SELL > x*(1 + i/2/100)
64
+ * e.g. x=1000, i=0.5% => BUY < 997.5, SELL > 1002.5
65
+ * Cold (pivot null or lastType null) => disabled.
66
+ * @param {number} price - Target order price
67
+ * @param {string} type - buy/sell
68
+ * @param {number|null} lastPrice - Most recent fill price
69
+ * @param {string|null} lastType - Most recent fill side (buy/sell)
70
+ * @param {number|any} incrementPercent - Grid increment percent (e.g. 0.5). If not finite/<=0 falls back to DEFAULT_CONFIG.
71
+ * @returns {{blocked: boolean, pivot: number|null, halfInc: number, threshold: number|null}}
72
+ */
73
+ declare function isLastFillGuardBlocked(price: any, type: any, lastPrice: any, lastType: any, incrementPercent: any): {
74
+ blocked: boolean;
75
+ pivot: number | null;
76
+ halfInc?: number;
77
+ threshold?: number | null;
78
+ };
79
+ declare function classifyFills(fills: FillRecord[]): {
80
+ trades: TradeFill[];
81
+ skipped: number;
82
+ };
83
+ declare function aggregateByOrder(trades: TradeFill[]): AggregatedOrder[];
84
+ declare function detectViolations(items: (TradeFill | AggregatedOrder)[], includeCrossPair: boolean, incrementPercent: number): {
85
+ violations: Violation[];
86
+ checkedPairs: number;
87
+ sameDirectionPairs: number;
88
+ };
89
+ export { isLastFillGuardBlocked, classifyFills, aggregateByOrder, detectViolations, TradeFill, FillRecord, Violation, AggregatedOrder };
90
+ //# sourceMappingURL=grid_correction_check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid_correction_check.d.ts","sourceRoot":"","sources":["../../analysis/grid_correction_check.ts"],"names":[],"mappings":";AAuGA,UAAU,UAAU;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,GAAG,EAAE,CAAC;CACf;AACD,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB;AACD,UAAU,SAAS;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,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