dexbot 1.3.2 → 1.4.0

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 (738) hide show
  1. package/dist/analysis/chart_utils.d.ts +11 -9
  2. package/dist/analysis/chart_utils.d.ts.map +1 -1
  3. package/dist/analysis/chart_utils.js +21 -16
  4. package/dist/analysis/chart_utils.js.map +1 -1
  5. package/dist/analysis/math_utils.d.ts +4 -13
  6. package/dist/analysis/math_utils.d.ts.map +1 -1
  7. package/dist/analysis/math_utils.js +16 -18
  8. package/dist/analysis/math_utils.js.map +1 -1
  9. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +3 -7
  10. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
  11. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +38 -34
  12. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
  13. package/dist/analysis/trend_detection/hurst_analyzer.d.ts +1 -4
  14. package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -1
  15. package/dist/analysis/trend_detection/hurst_analyzer.js +10 -7
  16. package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
  17. package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts +6 -6
  18. package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +1 -1
  19. package/dist/analysis/trend_detection/kalman_trend_analyzer.js +23 -15
  20. package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
  21. package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts +12 -13
  22. package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +1 -1
  23. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +16 -16
  24. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
  25. package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts +1 -4
  26. package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +1 -1
  27. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +10 -7
  28. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
  29. package/dist/bot.d.ts.map +1 -1
  30. package/dist/bot.js +6 -13
  31. package/dist/bot.js.map +1 -1
  32. package/dist/credential-daemon.d.ts.map +1 -1
  33. package/dist/credential-daemon.js +74 -35
  34. package/dist/credential-daemon.js.map +1 -1
  35. package/dist/dexbot.d.ts.map +1 -1
  36. package/dist/dexbot.js +16 -15
  37. package/dist/dexbot.js.map +1 -1
  38. package/dist/market_adapter/ama_signal_runner.d.ts +1 -1
  39. package/dist/market_adapter/ama_signal_runner.d.ts.map +1 -1
  40. package/dist/market_adapter/ama_signal_runner.js +8 -20
  41. package/dist/market_adapter/ama_signal_runner.js.map +1 -1
  42. package/dist/market_adapter/candle_utils.d.ts +2 -10
  43. package/dist/market_adapter/candle_utils.d.ts.map +1 -1
  44. package/dist/market_adapter/candle_utils.js +7 -8
  45. package/dist/market_adapter/candle_utils.js.map +1 -1
  46. package/dist/market_adapter/core/asymmetric_bounds.d.ts +12 -7
  47. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
  48. package/dist/market_adapter/core/asymmetric_bounds.js +4 -5
  49. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
  50. package/dist/market_adapter/core/config_normalizers.d.ts +4 -9
  51. package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -1
  52. package/dist/market_adapter/core/config_normalizers.js +9 -9
  53. package/dist/market_adapter/core/config_normalizers.js.map +1 -1
  54. package/dist/market_adapter/core/kibana_candles.d.ts +16 -20
  55. package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -1
  56. package/dist/market_adapter/core/kibana_candles.js +16 -15
  57. package/dist/market_adapter/core/kibana_candles.js.map +1 -1
  58. package/dist/market_adapter/core/kibana_client.d.ts +8 -11
  59. package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
  60. package/dist/market_adapter/core/kibana_client.js +13 -11
  61. package/dist/market_adapter/core/kibana_client.js.map +1 -1
  62. package/dist/market_adapter/core/kibana_market_candles.d.ts +5 -12
  63. package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -1
  64. package/dist/market_adapter/core/kibana_market_candles.js +12 -21
  65. package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
  66. package/dist/market_adapter/core/market_adapter_service.d.ts +75 -53
  67. package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
  68. package/dist/market_adapter/core/market_adapter_service.js +102 -98
  69. package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
  70. package/dist/market_adapter/core/strategies/ama.d.ts +21 -1
  71. package/dist/market_adapter/core/strategies/ama.d.ts.map +1 -1
  72. package/dist/market_adapter/core/strategies/ama.js +10 -10
  73. package/dist/market_adapter/core/strategies/ama.js.map +1 -1
  74. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +7 -11
  75. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -1
  76. package/dist/market_adapter/core/strategies/ama_slope_model.js +23 -30
  77. package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
  78. package/dist/market_adapter/core/strategies/atr/calculator.d.ts +5 -4
  79. package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -1
  80. package/dist/market_adapter/core/strategies/atr/calculator.js +5 -3
  81. package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
  82. package/dist/market_adapter/core/strategies/collateral_manager.d.ts +4 -7
  83. package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -1
  84. package/dist/market_adapter/core/strategies/collateral_manager.js +5 -4
  85. package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
  86. package/dist/market_adapter/core/strategies/regime_gate.d.ts +11 -19
  87. package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
  88. package/dist/market_adapter/core/strategies/regime_gate.js +22 -22
  89. package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
  90. package/dist/market_adapter/index.d.ts +24 -2
  91. package/dist/market_adapter/index.d.ts.map +1 -1
  92. package/dist/market_adapter/index.js +82 -56
  93. package/dist/market_adapter/index.js.map +1 -1
  94. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +26 -37
  95. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
  96. package/dist/market_adapter/inputs/fetch_lp_data.d.ts +4 -12
  97. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
  98. package/dist/market_adapter/inputs/fetch_lp_data.js +100 -66
  99. package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
  100. package/dist/market_adapter/inputs/kibana_source.d.ts +4 -9
  101. package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
  102. package/dist/market_adapter/inputs/kibana_source.js +17 -18
  103. package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
  104. package/dist/market_adapter/interval_utils.d.ts +1 -4
  105. package/dist/market_adapter/interval_utils.d.ts.map +1 -1
  106. package/dist/market_adapter/interval_utils.js +2 -3
  107. package/dist/market_adapter/interval_utils.js.map +1 -1
  108. package/dist/market_adapter/log_format.d.ts +1 -9
  109. package/dist/market_adapter/log_format.d.ts.map +1 -1
  110. package/dist/market_adapter/log_format.js +7 -8
  111. package/dist/market_adapter/log_format.js.map +1 -1
  112. package/dist/market_adapter/lp_chart_core.d.ts +1 -4
  113. package/dist/market_adapter/lp_chart_core.d.ts.map +1 -1
  114. package/dist/market_adapter/lp_chart_core.js +22 -20
  115. package/dist/market_adapter/lp_chart_core.js.map +1 -1
  116. package/dist/market_adapter/lp_chart_runner.d.ts +13 -24
  117. package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
  118. package/dist/market_adapter/lp_chart_runner.js +58 -56
  119. package/dist/market_adapter/lp_chart_runner.js.map +1 -1
  120. package/dist/market_adapter/lp_chart_strategy_loader.d.ts +4 -17
  121. package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -1
  122. package/dist/market_adapter/lp_chart_strategy_loader.js +36 -36
  123. package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
  124. package/dist/market_adapter/market_adapter.d.ts +51 -72
  125. package/dist/market_adapter/market_adapter.d.ts.map +1 -1
  126. package/dist/market_adapter/market_adapter.js +227 -192
  127. package/dist/market_adapter/market_adapter.js.map +1 -1
  128. package/dist/market_adapter/merge_lp_data.js +17 -16
  129. package/dist/market_adapter/merge_lp_data.js.map +1 -1
  130. package/dist/market_adapter/test_helpers.d.ts +9 -13
  131. package/dist/market_adapter/test_helpers.d.ts.map +1 -1
  132. package/dist/market_adapter/test_helpers.js +14 -14
  133. package/dist/market_adapter/test_helpers.js.map +1 -1
  134. package/dist/market_adapter/utils/adapter_client.d.ts +6 -14
  135. package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -1
  136. package/dist/market_adapter/utils/adapter_client.js +16 -15
  137. package/dist/market_adapter/utils/adapter_client.js.map +1 -1
  138. package/dist/market_adapter/utils/atomic_write.d.ts +2 -5
  139. package/dist/market_adapter/utils/atomic_write.d.ts.map +1 -1
  140. package/dist/market_adapter/utils/atomic_write.js +5 -5
  141. package/dist/market_adapter/utils/atomic_write.js.map +1 -1
  142. package/dist/market_adapter/utils/chain.d.ts +19 -21
  143. package/dist/market_adapter/utils/chain.d.ts.map +1 -1
  144. package/dist/market_adapter/utils/chain.js +15 -16
  145. package/dist/market_adapter/utils/chain.js.map +1 -1
  146. package/dist/market_adapter/utils/data_discovery.d.ts +1 -4
  147. package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -1
  148. package/dist/market_adapter/utils/data_discovery.js +10 -10
  149. package/dist/market_adapter/utils/data_discovery.js.map +1 -1
  150. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +1 -6
  151. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
  152. package/dist/market_adapter/utils/dynamic_grid_snapshot.js +14 -14
  153. package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
  154. package/dist/market_adapter/utils/file_lock.d.ts +1 -7
  155. package/dist/market_adapter/utils/file_lock.d.ts.map +1 -1
  156. package/dist/market_adapter/utils/file_lock.js +21 -25
  157. package/dist/market_adapter/utils/file_lock.js.map +1 -1
  158. package/dist/market_adapter/utils/native_history.d.ts +12 -12
  159. package/dist/market_adapter/utils/native_history.d.ts.map +1 -1
  160. package/dist/market_adapter/utils/native_history.js +15 -15
  161. package/dist/market_adapter/utils/native_history.js.map +1 -1
  162. package/dist/market_adapter/utils/paths.d.ts +2 -4
  163. package/dist/market_adapter/utils/paths.d.ts.map +1 -1
  164. package/dist/market_adapter/utils/paths.js +6 -5
  165. package/dist/market_adapter/utils/paths.js.map +1 -1
  166. package/dist/modules/account_bots.d.ts +7 -8
  167. package/dist/modules/account_bots.d.ts.map +1 -1
  168. package/dist/modules/account_bots.js +92 -114
  169. package/dist/modules/account_bots.js.map +1 -1
  170. package/dist/modules/account_orders.d.ts +5 -9
  171. package/dist/modules/account_orders.d.ts.map +1 -1
  172. package/dist/modules/account_orders.js +69 -32
  173. package/dist/modules/account_orders.js.map +1 -1
  174. package/dist/modules/authority_resolver.d.ts +32 -1
  175. package/dist/modules/authority_resolver.d.ts.map +1 -1
  176. package/dist/modules/authority_resolver.js +18 -12
  177. package/dist/modules/authority_resolver.js.map +1 -1
  178. package/dist/modules/bitshares-native/chain_client.d.ts +3 -8
  179. package/dist/modules/bitshares-native/chain_client.d.ts.map +1 -1
  180. package/dist/modules/bitshares-native/chain_client.js +21 -16
  181. package/dist/modules/bitshares-native/chain_client.js.map +1 -1
  182. package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +21 -29
  183. package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -1
  184. package/dist/modules/bitshares-native/crypto/ecc.browser.js +72 -38
  185. package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
  186. package/dist/modules/bitshares-native/crypto/ecc.d.ts +9 -36
  187. package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -1
  188. package/dist/modules/bitshares-native/crypto/ecc.js +40 -83
  189. package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
  190. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +14 -1
  191. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
  192. package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -3
  193. package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
  194. package/dist/modules/bitshares-native/index.d.ts +10 -2
  195. package/dist/modules/bitshares-native/index.d.ts.map +1 -1
  196. package/dist/modules/bitshares-native/index.js +68 -31
  197. package/dist/modules/bitshares-native/index.js.map +1 -1
  198. package/dist/modules/bitshares-native/lru_cache.d.ts +1 -4
  199. package/dist/modules/bitshares-native/lru_cache.d.ts.map +1 -1
  200. package/dist/modules/bitshares-native/lru_cache.js +6 -3
  201. package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
  202. package/dist/modules/bitshares-native/resolvers.d.ts +3 -6
  203. package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -1
  204. package/dist/modules/bitshares-native/resolvers.js +11 -9
  205. package/dist/modules/bitshares-native/resolvers.js.map +1 -1
  206. package/dist/modules/bitshares-native/serial/chain_constants.d.ts +53 -55
  207. package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -1
  208. package/dist/modules/bitshares-native/serial/chain_constants.js +28 -27
  209. package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
  210. package/dist/modules/bitshares-native/serial/index.d.ts +5 -9
  211. package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
  212. package/dist/modules/bitshares-native/serial/index.js +46 -12
  213. package/dist/modules/bitshares-native/serial/index.js.map +1 -1
  214. package/dist/modules/bitshares-native/serial/operations.d.ts +102 -100
  215. package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
  216. package/dist/modules/bitshares-native/serial/operations.js +473 -471
  217. package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
  218. package/dist/modules/bitshares-native/serial/serializer.d.ts +2 -7
  219. package/dist/modules/bitshares-native/serial/serializer.d.ts.map +1 -1
  220. package/dist/modules/bitshares-native/serial/serializer.js +8 -3
  221. package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
  222. package/dist/modules/bitshares-native/serial/types.d.ts +26 -41
  223. package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -1
  224. package/dist/modules/bitshares-native/serial/types.js +76 -42
  225. package/dist/modules/bitshares-native/serial/types.js.map +1 -1
  226. package/dist/modules/bitshares-native/signing_client.d.ts +1 -5
  227. package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
  228. package/dist/modules/bitshares-native/signing_client.js +49 -11
  229. package/dist/modules/bitshares-native/signing_client.js.map +1 -1
  230. package/dist/modules/bitshares-native/subscriptions.d.ts +1 -4
  231. package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
  232. package/dist/modules/bitshares-native/subscriptions.js +47 -84
  233. package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
  234. package/dist/modules/bitshares-native/transport.d.ts +1 -8
  235. package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
  236. package/dist/modules/bitshares-native/transport.js +22 -15
  237. package/dist/modules/bitshares-native/transport.js.map +1 -1
  238. package/dist/modules/bitshares-native/tx/builder.d.ts +3 -8
  239. package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -1
  240. package/dist/modules/bitshares-native/tx/builder.js +61 -23
  241. package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
  242. package/dist/modules/bitshares-native/tx/tx_cache.d.ts +1 -8
  243. package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +1 -1
  244. package/dist/modules/bitshares-native/tx/tx_cache.js +21 -17
  245. package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
  246. package/dist/modules/bitshares_client.d.ts +12 -23
  247. package/dist/modules/bitshares_client.d.ts.map +1 -1
  248. package/dist/modules/bitshares_client.js +109 -56
  249. package/dist/modules/bitshares_client.js.map +1 -1
  250. package/dist/modules/bot_settings.d.ts +1 -13
  251. package/dist/modules/bot_settings.d.ts.map +1 -1
  252. package/dist/modules/bot_settings.js +34 -34
  253. package/dist/modules/bot_settings.js.map +1 -1
  254. package/dist/modules/bots_file_lock.d.ts +3 -9
  255. package/dist/modules/bots_file_lock.d.ts.map +1 -1
  256. package/dist/modules/bots_file_lock.js +8 -9
  257. package/dist/modules/bots_file_lock.js.map +1 -1
  258. package/dist/modules/chain_keys.d.ts +7 -39
  259. package/dist/modules/chain_keys.d.ts.map +1 -1
  260. package/dist/modules/chain_keys.js +126 -90
  261. package/dist/modules/chain_keys.js.map +1 -1
  262. package/dist/modules/chain_orders.d.ts +46 -52
  263. package/dist/modules/chain_orders.d.ts.map +1 -1
  264. package/dist/modules/chain_orders.js +152 -104
  265. package/dist/modules/chain_orders.js.map +1 -1
  266. package/dist/modules/config.d.ts +50 -57
  267. package/dist/modules/config.d.ts.map +1 -1
  268. package/dist/modules/config.js +28 -24
  269. package/dist/modules/config.js.map +1 -1
  270. package/dist/modules/constants.d.ts +492 -492
  271. package/dist/modules/constants.d.ts.map +1 -1
  272. package/dist/modules/constants.js +79 -39
  273. package/dist/modules/constants.js.map +1 -1
  274. package/dist/modules/cr_planner.d.ts +1 -13
  275. package/dist/modules/cr_planner.d.ts.map +1 -1
  276. package/dist/modules/cr_planner.js +28 -28
  277. package/dist/modules/cr_planner.js.map +1 -1
  278. package/dist/modules/credential_policy.d.ts +18 -33
  279. package/dist/modules/credential_policy.d.ts.map +1 -1
  280. package/dist/modules/credential_policy.js +114 -87
  281. package/dist/modules/credential_policy.js.map +1 -1
  282. package/dist/modules/credential_runtime.d.ts +11 -21
  283. package/dist/modules/credential_runtime.d.ts.map +1 -1
  284. package/dist/modules/credential_runtime.js +40 -40
  285. package/dist/modules/credential_runtime.js.map +1 -1
  286. package/dist/modules/credential_session_cache.d.ts +8 -8
  287. package/dist/modules/credential_session_cache.d.ts.map +1 -1
  288. package/dist/modules/credential_session_cache.js +41 -8
  289. package/dist/modules/credential_session_cache.js.map +1 -1
  290. package/dist/modules/credit_runtime.d.ts +51 -316
  291. package/dist/modules/credit_runtime.d.ts.map +1 -1
  292. package/dist/modules/credit_runtime.js +257 -183
  293. package/dist/modules/credit_runtime.js.map +1 -1
  294. package/dist/modules/crypto/browser_provider.js +6 -6
  295. package/dist/modules/crypto/browser_provider.js.map +1 -1
  296. package/dist/modules/crypto/index.d.ts.map +1 -1
  297. package/dist/modules/crypto/index.js +2 -0
  298. package/dist/modules/crypto/index.js.map +1 -1
  299. package/dist/modules/crypto/sync.js +3 -3
  300. package/dist/modules/crypto/sync.js.map +1 -1
  301. package/dist/modules/dexbot_class.d.ts +124 -73
  302. package/dist/modules/dexbot_class.d.ts.map +1 -1
  303. package/dist/modules/dexbot_class.js +198 -3577
  304. package/dist/modules/dexbot_class.js.map +1 -1
  305. package/dist/modules/dexbot_cow_runtime.d.ts +322 -0
  306. package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -0
  307. package/dist/modules/dexbot_cow_runtime.js +1836 -0
  308. package/dist/modules/dexbot_cow_runtime.js.map +1 -0
  309. package/dist/modules/dexbot_credential_client.d.ts +5 -11
  310. package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
  311. package/dist/modules/dexbot_credential_client.js +32 -30
  312. package/dist/modules/dexbot_credential_client.js.map +1 -1
  313. package/dist/modules/dexbot_fill_runtime.d.ts +47 -15
  314. package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
  315. package/dist/modules/dexbot_fill_runtime.js +565 -22
  316. package/dist/modules/dexbot_fill_runtime.js.map +1 -1
  317. package/dist/modules/dexbot_maintenance_runtime.d.ts +79 -10
  318. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  319. package/dist/modules/dexbot_maintenance_runtime.js +294 -55
  320. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  321. package/dist/modules/dexbot_startup_runtime.d.ts +26 -0
  322. package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -0
  323. package/dist/modules/dexbot_startup_runtime.js +575 -0
  324. package/dist/modules/dexbot_startup_runtime.js.map +1 -0
  325. package/dist/modules/dexbot_state_recovery.d.ts +115 -0
  326. package/dist/modules/dexbot_state_recovery.d.ts.map +1 -0
  327. package/dist/modules/dexbot_state_recovery.js +431 -0
  328. package/dist/modules/dexbot_state_recovery.js.map +1 -0
  329. package/dist/modules/fund_registry.d.ts +1 -13
  330. package/dist/modules/fund_registry.d.ts.map +1 -1
  331. package/dist/modules/fund_registry.js +23 -22
  332. package/dist/modules/fund_registry.js.map +1 -1
  333. package/dist/modules/general_settings.d.ts +3 -7
  334. package/dist/modules/general_settings.d.ts.map +1 -1
  335. package/dist/modules/general_settings.js +15 -15
  336. package/dist/modules/general_settings.js.map +1 -1
  337. package/dist/modules/graceful_shutdown.d.ts +1 -6
  338. package/dist/modules/graceful_shutdown.d.ts.map +1 -1
  339. package/dist/modules/graceful_shutdown.js +19 -16
  340. package/dist/modules/graceful_shutdown.js.map +1 -1
  341. package/dist/modules/key_store.d.ts.map +1 -1
  342. package/dist/modules/key_store.js +53 -20
  343. package/dist/modules/key_store.js.map +1 -1
  344. package/dist/modules/launcher/bot_supervisor.d.ts +23 -66
  345. package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
  346. package/dist/modules/launcher/bot_supervisor.js +115 -107
  347. package/dist/modules/launcher/bot_supervisor.js.map +1 -1
  348. package/dist/modules/launcher/child_env.d.ts +2 -5
  349. package/dist/modules/launcher/child_env.d.ts.map +1 -1
  350. package/dist/modules/launcher/child_env.js +4 -4
  351. package/dist/modules/launcher/child_env.js.map +1 -1
  352. package/dist/modules/launcher/credential_bootstrap.d.ts +4 -8
  353. package/dist/modules/launcher/credential_bootstrap.d.ts.map +1 -1
  354. package/dist/modules/launcher/credential_bootstrap.js +30 -26
  355. package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
  356. package/dist/modules/launcher/credential_daemon.d.ts +8 -15
  357. package/dist/modules/launcher/credential_daemon.d.ts.map +1 -1
  358. package/dist/modules/launcher/credential_daemon.js +72 -41
  359. package/dist/modules/launcher/credential_daemon.js.map +1 -1
  360. package/dist/modules/launcher/credential_secret.d.ts +1 -4
  361. package/dist/modules/launcher/credential_secret.d.ts.map +1 -1
  362. package/dist/modules/launcher/credential_secret.js +36 -4
  363. package/dist/modules/launcher/credential_secret.js.map +1 -1
  364. package/dist/modules/launcher/foreign_cred_daemon.d.ts +32 -1
  365. package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
  366. package/dist/modules/launcher/foreign_cred_daemon.js +25 -28
  367. package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
  368. package/dist/modules/launcher/headless_password.d.ts +1 -4
  369. package/dist/modules/launcher/headless_password.d.ts.map +1 -1
  370. package/dist/modules/launcher/headless_password.js +11 -11
  371. package/dist/modules/launcher/headless_password.js.map +1 -1
  372. package/dist/modules/launcher/launch_modes.d.ts +15 -14
  373. package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
  374. package/dist/modules/launcher/launch_modes.js +8 -8
  375. package/dist/modules/launcher/launch_modes.js.map +1 -1
  376. package/dist/modules/launcher/market_adapter_runtime.d.ts +10 -19
  377. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
  378. package/dist/modules/launcher/market_adapter_runtime.js +33 -34
  379. package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
  380. package/dist/modules/launcher/market_adapter_watchdog.d.ts +10 -17
  381. package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
  382. package/dist/modules/launcher/market_adapter_watchdog.js +42 -39
  383. package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
  384. package/dist/modules/launcher/monolithic_runtime.d.ts +28 -57
  385. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
  386. package/dist/modules/launcher/monolithic_runtime.js +135 -108
  387. package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
  388. package/dist/modules/launcher/runtime_entry.d.ts +5 -10
  389. package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
  390. package/dist/modules/launcher/runtime_entry.js +14 -14
  391. package/dist/modules/launcher/runtime_entry.js.map +1 -1
  392. package/dist/modules/launcher/status_reporting.d.ts +17 -37
  393. package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
  394. package/dist/modules/launcher/status_reporting.js +35 -34
  395. package/dist/modules/launcher/status_reporting.js.map +1 -1
  396. package/dist/modules/launcher/supervisor_control.d.ts +1 -4
  397. package/dist/modules/launcher/supervisor_control.d.ts.map +1 -1
  398. package/dist/modules/launcher/supervisor_control.js +9 -4
  399. package/dist/modules/launcher/supervisor_control.js.map +1 -1
  400. package/dist/modules/logger.d.ts +3 -1
  401. package/dist/modules/logger.d.ts.map +1 -1
  402. package/dist/modules/logger.js +38 -28
  403. package/dist/modules/logger.js.map +1 -1
  404. package/dist/modules/market_adapter_whitelist.d.ts +2 -10
  405. package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
  406. package/dist/modules/market_adapter_whitelist.js +18 -16
  407. package/dist/modules/market_adapter_whitelist.js.map +1 -1
  408. package/dist/modules/node_health_cache.d.ts +2 -12
  409. package/dist/modules/node_health_cache.d.ts.map +1 -1
  410. package/dist/modules/node_health_cache.js +24 -24
  411. package/dist/modules/node_health_cache.js.map +1 -1
  412. package/dist/modules/node_manager.d.ts +1 -1
  413. package/dist/modules/node_manager.d.ts.map +1 -1
  414. package/dist/modules/node_manager.js +44 -38
  415. package/dist/modules/node_manager.js.map +1 -1
  416. package/dist/modules/order/accounting.d.ts +12 -12
  417. package/dist/modules/order/accounting.d.ts.map +1 -1
  418. package/dist/modules/order/accounting.js +111 -76
  419. package/dist/modules/order/accounting.js.map +1 -1
  420. package/dist/modules/order/async_lock.d.ts +1 -2
  421. package/dist/modules/order/async_lock.d.ts.map +1 -1
  422. package/dist/modules/order/async_lock.js +4 -4
  423. package/dist/modules/order/async_lock.js.map +1 -1
  424. package/dist/modules/order/export.d.ts +8 -14
  425. package/dist/modules/order/export.d.ts.map +1 -1
  426. package/dist/modules/order/export.js +77 -42
  427. package/dist/modules/order/export.js.map +1 -1
  428. package/dist/modules/order/format.d.ts +17 -22
  429. package/dist/modules/order/format.d.ts.map +1 -1
  430. package/dist/modules/order/format.js +25 -31
  431. package/dist/modules/order/format.js.map +1 -1
  432. package/dist/modules/order/grid.d.ts +18 -104
  433. package/dist/modules/order/grid.d.ts.map +1 -1
  434. package/dist/modules/order/grid.js +246 -188
  435. package/dist/modules/order/grid.js.map +1 -1
  436. package/dist/modules/order/grid_reconcile.d.ts +8 -8
  437. package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
  438. package/dist/modules/order/grid_reconcile.js +24 -24
  439. package/dist/modules/order/grid_reconcile.js.map +1 -1
  440. package/dist/modules/order/grid_reconcile_internal.d.ts +224 -1
  441. package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
  442. package/dist/modules/order/grid_reconcile_internal.js +145 -72
  443. package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
  444. package/dist/modules/order/index.d.ts +1 -1
  445. package/dist/modules/order/index.d.ts.map +1 -1
  446. package/dist/modules/order/index.js +42 -7
  447. package/dist/modules/order/index.js.map +1 -1
  448. package/dist/modules/order/logger.d.ts +6 -16
  449. package/dist/modules/order/logger.d.ts.map +1 -1
  450. package/dist/modules/order/logger.js +76 -53
  451. package/dist/modules/order/logger.js.map +1 -1
  452. package/dist/modules/order/logger_state.d.ts +4 -4
  453. package/dist/modules/order/logger_state.d.ts.map +1 -1
  454. package/dist/modules/order/logger_state.js +3 -1
  455. package/dist/modules/order/logger_state.js.map +1 -1
  456. package/dist/modules/order/manager.d.ts +160 -37
  457. package/dist/modules/order/manager.d.ts.map +1 -1
  458. package/dist/modules/order/manager.js +166 -128
  459. package/dist/modules/order/manager.js.map +1 -1
  460. package/dist/modules/order/processed_fill_store.d.ts +6 -10
  461. package/dist/modules/order/processed_fill_store.d.ts.map +1 -1
  462. package/dist/modules/order/processed_fill_store.js +10 -9
  463. package/dist/modules/order/processed_fill_store.js.map +1 -1
  464. package/dist/modules/order/strategy.d.ts +3 -3
  465. package/dist/modules/order/strategy.d.ts.map +1 -1
  466. package/dist/modules/order/strategy.js +29 -27
  467. package/dist/modules/order/strategy.js.map +1 -1
  468. package/dist/modules/order/sync_engine.d.ts +9 -19
  469. package/dist/modules/order/sync_engine.d.ts.map +1 -1
  470. package/dist/modules/order/sync_engine.js +176 -126
  471. package/dist/modules/order/sync_engine.js.map +1 -1
  472. package/dist/modules/order/utils/math.d.ts +55 -85
  473. package/dist/modules/order/utils/math.d.ts.map +1 -1
  474. package/dist/modules/order/utils/math.js +155 -88
  475. package/dist/modules/order/utils/math.js.map +1 -1
  476. package/dist/modules/order/utils/order.d.ts +27 -72
  477. package/dist/modules/order/utils/order.d.ts.map +1 -1
  478. package/dist/modules/order/utils/order.js +144 -105
  479. package/dist/modules/order/utils/order.js.map +1 -1
  480. package/dist/modules/order/utils/system.d.ts +74 -44
  481. package/dist/modules/order/utils/system.d.ts.map +1 -1
  482. package/dist/modules/order/utils/system.js +188 -149
  483. package/dist/modules/order/utils/system.js.map +1 -1
  484. package/dist/modules/order/utils/validate.d.ts +21 -43
  485. package/dist/modules/order/utils/validate.d.ts.map +1 -1
  486. package/dist/modules/order/utils/validate.js +140 -110
  487. package/dist/modules/order/utils/validate.js.map +1 -1
  488. package/dist/modules/order/working_grid.d.ts +1 -4
  489. package/dist/modules/order/working_grid.d.ts.map +1 -1
  490. package/dist/modules/order/working_grid.js +9 -7
  491. package/dist/modules/order/working_grid.js.map +1 -1
  492. package/dist/modules/path_api.js +2 -2
  493. package/dist/modules/path_api.js.map +1 -1
  494. package/dist/modules/paths.d.ts +51 -55
  495. package/dist/modules/paths.d.ts.map +1 -1
  496. package/dist/modules/paths.js +72 -52
  497. package/dist/modules/paths.js.map +1 -1
  498. package/dist/modules/process_discovery.d.ts +1 -1
  499. package/dist/modules/process_discovery.d.ts.map +1 -1
  500. package/dist/modules/process_discovery.js +7 -7
  501. package/dist/modules/process_discovery.js.map +1 -1
  502. package/dist/modules/runtime.d.ts +1 -1
  503. package/dist/modules/runtime.d.ts.map +1 -1
  504. package/dist/modules/runtime.js +4 -4
  505. package/dist/modules/runtime.js.map +1 -1
  506. package/dist/modules/runtime_settings.d.ts +1 -0
  507. package/dist/modules/runtime_settings.d.ts.map +1 -1
  508. package/dist/modules/runtime_settings.js +15 -10
  509. package/dist/modules/runtime_settings.js.map +1 -1
  510. package/dist/modules/settings_merge.d.ts +1 -4
  511. package/dist/modules/settings_merge.d.ts.map +1 -1
  512. package/dist/modules/settings_merge.js +2 -1
  513. package/dist/modules/settings_merge.js.map +1 -1
  514. package/dist/modules/storage/browser_adapter.d.ts +7 -3
  515. package/dist/modules/storage/browser_adapter.d.ts.map +1 -1
  516. package/dist/modules/storage/browser_adapter.js +2 -0
  517. package/dist/modules/storage/browser_adapter.js.map +1 -1
  518. package/dist/modules/storage/index.d.ts +2 -2
  519. package/dist/modules/storage/index.d.ts.map +1 -1
  520. package/dist/modules/storage/index.js +2 -5
  521. package/dist/modules/storage/index.js.map +1 -1
  522. package/dist/modules/storage/node_adapter.d.ts +3 -3
  523. package/dist/modules/storage/node_adapter.d.ts.map +1 -1
  524. package/dist/modules/storage/node_adapter.js +9 -7
  525. package/dist/modules/storage/node_adapter.js.map +1 -1
  526. package/dist/modules/storage/types.d.ts +13 -10
  527. package/dist/modules/storage/types.d.ts.map +1 -1
  528. package/dist/modules/types.d.ts +0 -2
  529. package/dist/modules/types.d.ts.map +1 -1
  530. package/dist/modules/utils/base58check.d.ts +1 -9
  531. package/dist/modules/utils/base58check.d.ts.map +1 -1
  532. package/dist/modules/utils/base58check.js +14 -16
  533. package/dist/modules/utils/base58check.js.map +1 -1
  534. package/dist/modules/utils/build_dir.d.ts +2 -5
  535. package/dist/modules/utils/build_dir.d.ts.map +1 -1
  536. package/dist/modules/utils/build_dir.js +6 -3
  537. package/dist/modules/utils/build_dir.js.map +1 -1
  538. package/dist/modules/utils/errors.d.ts +2 -0
  539. package/dist/modules/utils/errors.d.ts.map +1 -0
  540. package/dist/modules/utils/errors.js +12 -0
  541. package/dist/modules/utils/errors.js.map +1 -0
  542. package/dist/modules/utils/fs_utils.d.ts +1 -8
  543. package/dist/modules/utils/fs_utils.d.ts.map +1 -1
  544. package/dist/modules/utils/fs_utils.js +8 -3
  545. package/dist/modules/utils/fs_utils.js.map +1 -1
  546. package/dist/modules/utils/math_utils.d.ts +2 -6
  547. package/dist/modules/utils/math_utils.d.ts.map +1 -1
  548. package/dist/modules/utils/math_utils.js +6 -2
  549. package/dist/modules/utils/math_utils.js.map +1 -1
  550. package/dist/modules/validate_profiles.d.ts +1 -11
  551. package/dist/modules/validate_profiles.d.ts.map +1 -1
  552. package/dist/modules/validate_profiles.js +25 -27
  553. package/dist/modules/validate_profiles.js.map +1 -1
  554. package/dist/pm2.d.ts +7 -6
  555. package/dist/pm2.d.ts.map +1 -1
  556. package/dist/pm2.js +132 -106
  557. package/dist/pm2.js.map +1 -1
  558. package/dist/scripts/analyze-git.d.ts.map +1 -1
  559. package/dist/scripts/analyze-git.js +15 -11
  560. package/dist/scripts/analyze-git.js.map +1 -1
  561. package/dist/scripts/analyze-orders.d.ts +146 -1
  562. package/dist/scripts/analyze-orders.d.ts.map +1 -1
  563. package/dist/scripts/analyze-orders.js +81 -105
  564. package/dist/scripts/analyze-orders.js.map +1 -1
  565. package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
  566. package/dist/scripts/diagnose-pool-history.js +9 -8
  567. package/dist/scripts/diagnose-pool-history.js.map +1 -1
  568. package/dist/scripts/divergence-calc.d.ts.map +1 -1
  569. package/dist/scripts/divergence-calc.js +11 -8
  570. package/dist/scripts/divergence-calc.js.map +1 -1
  571. package/dist/scripts/fix-err-message.d.ts +3 -0
  572. package/dist/scripts/fix-err-message.d.ts.map +1 -0
  573. package/dist/scripts/fix-err-message.js +198 -0
  574. package/dist/scripts/fix-err-message.js.map +1 -0
  575. package/dist/scripts/generate_lp_chart.d.ts +2 -9
  576. package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
  577. package/dist/scripts/generate_lp_chart.js +14 -10
  578. package/dist/scripts/generate_lp_chart.js.map +1 -1
  579. package/dist/scripts/generate_mainnet_corpus_report.js +4 -4
  580. package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
  581. package/dist/scripts/generate_market_adapter_whitelist.d.ts +17 -1
  582. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
  583. package/dist/scripts/generate_market_adapter_whitelist.js +23 -20
  584. package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
  585. package/dist/scripts/migrate_bot_keys.d.ts +1 -4
  586. package/dist/scripts/migrate_bot_keys.d.ts.map +1 -1
  587. package/dist/scripts/migrate_bot_keys.js +48 -124
  588. package/dist/scripts/migrate_bot_keys.js.map +1 -1
  589. package/dist/scripts/native_release_gates.d.ts.map +1 -1
  590. package/dist/scripts/native_release_gates.js +18 -14
  591. package/dist/scripts/native_release_gates.js.map +1 -1
  592. package/dist/scripts/print_grid.js +1 -1
  593. package/dist/scripts/print_grid.js.map +1 -1
  594. package/dist/scripts/run-tests.js +1 -0
  595. package/dist/scripts/run-tests.js.map +1 -1
  596. package/dist/scripts/runner.d.ts +1 -11
  597. package/dist/scripts/runner.d.ts.map +1 -1
  598. package/dist/scripts/runner.js +21 -19
  599. package/dist/scripts/runner.js.map +1 -1
  600. package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
  601. package/dist/scripts/test-credit-renewal.js +2 -1
  602. package/dist/scripts/test-credit-renewal.js.map +1 -1
  603. package/dist/scripts/update.d.ts.map +1 -1
  604. package/dist/scripts/update.js +85 -79
  605. package/dist/scripts/update.js.map +1 -1
  606. package/dist/scripts/validate_bots.js +2 -2
  607. package/dist/scripts/validate_bots.js.map +1 -1
  608. package/dist/scripts/verify-browser-bundle.js +25 -1
  609. package/dist/scripts/verify-browser-bundle.js.map +1 -1
  610. package/dist/unlock.d.ts +4 -17
  611. package/dist/unlock.d.ts.map +1 -1
  612. package/dist/unlock.js +141 -108
  613. package/dist/unlock.js.map +1 -1
  614. package/package.json +7 -2
  615. package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts +0 -3
  616. package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
  617. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +0 -149
  618. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
  619. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts +0 -3
  620. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
  621. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +0 -387
  622. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
  623. package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts +0 -3
  624. package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
  625. package/dist/analysis/ama_fitting/calibrate_convergence_er.js +0 -200
  626. package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
  627. package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts +0 -3
  628. package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
  629. package/dist/analysis/ama_fitting/fetch_lp_candles.js +0 -212
  630. package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
  631. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +0 -31
  632. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
  633. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +0 -249
  634. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
  635. package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +0 -2
  636. package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
  637. package/dist/analysis/ama_fitting/optimizer_high_resolution.js +0 -782
  638. package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
  639. package/dist/analysis/analyze_derivatives.d.ts +0 -95
  640. package/dist/analysis/analyze_derivatives.d.ts.map +0 -1
  641. package/dist/analysis/analyze_derivatives.js +0 -295
  642. package/dist/analysis/analyze_derivatives.js.map +0 -1
  643. package/dist/analysis/analyze_dynamic_weight.d.ts +0 -14
  644. package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
  645. package/dist/analysis/analyze_dynamic_weight.js +0 -207
  646. package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
  647. package/dist/analysis/analyze_kalman.d.ts +0 -13
  648. package/dist/analysis/analyze_kalman.d.ts.map +0 -1
  649. package/dist/analysis/analyze_kalman.js +0 -123
  650. package/dist/analysis/analyze_kalman.js.map +0 -1
  651. package/dist/analysis/analyze_regime.d.ts +0 -20
  652. package/dist/analysis/analyze_regime.d.ts.map +0 -1
  653. package/dist/analysis/analyze_regime.js +0 -139
  654. package/dist/analysis/analyze_regime.js.map +0 -1
  655. package/dist/analysis/analyze_regime_windows.d.ts +0 -19
  656. package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
  657. package/dist/analysis/analyze_regime_windows.js +0 -413
  658. package/dist/analysis/analyze_regime_windows.js.map +0 -1
  659. package/dist/analysis/analyze_risk_profile.d.ts +0 -3
  660. package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
  661. package/dist/analysis/analyze_risk_profile.js +0 -159
  662. package/dist/analysis/analyze_risk_profile.js.map +0 -1
  663. package/dist/analysis/analyze_trade_heatmap.d.ts +0 -3
  664. package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
  665. package/dist/analysis/analyze_trade_heatmap.js +0 -367
  666. package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
  667. package/dist/analysis/analyze_volatility.d.ts +0 -22
  668. package/dist/analysis/analyze_volatility.d.ts.map +0 -1
  669. package/dist/analysis/analyze_volatility.js +0 -172
  670. package/dist/analysis/analyze_volatility.js.map +0 -1
  671. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +0 -99
  672. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
  673. package/dist/analysis/bot_fitting/backtest_ama_sweep.js +0 -804
  674. package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
  675. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +0 -2
  676. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
  677. package/dist/analysis/bot_fitting/backtest_bot_fitting.js +0 -347
  678. package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
  679. package/dist/analysis/bot_fitting/shared_utils.d.ts +0 -15
  680. package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
  681. package/dist/analysis/bot_fitting/shared_utils.js +0 -48
  682. package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
  683. package/dist/analysis/bot_key_utils.d.ts +0 -22
  684. package/dist/analysis/bot_key_utils.d.ts.map +0 -1
  685. package/dist/analysis/bot_key_utils.js +0 -162
  686. package/dist/analysis/bot_key_utils.js.map +0 -1
  687. package/dist/analysis/bot_usage/discover_bot_accounts.d.ts +0 -3
  688. package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
  689. package/dist/analysis/bot_usage/discover_bot_accounts.js +0 -498
  690. package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
  691. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +0 -546
  692. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
  693. package/dist/analysis/bot_usage/kibana_bot_queries.js +0 -427
  694. package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
  695. package/dist/analysis/derivative_chart_generator.d.ts +0 -18
  696. package/dist/analysis/derivative_chart_generator.d.ts.map +0 -1
  697. package/dist/analysis/derivative_chart_generator.js +0 -896
  698. package/dist/analysis/derivative_chart_generator.js.map +0 -1
  699. package/dist/analysis/price_sources.d.ts +0 -34
  700. package/dist/analysis/price_sources.d.ts.map +0 -1
  701. package/dist/analysis/price_sources.js +0 -103
  702. package/dist/analysis/price_sources.js.map +0 -1
  703. package/dist/analysis/trade_profitability.d.ts +0 -115
  704. package/dist/analysis/trade_profitability.d.ts.map +0 -1
  705. package/dist/analysis/trade_profitability.js +0 -1247
  706. package/dist/analysis/trade_profitability.js.map +0 -1
  707. package/dist/analysis/tradingview/analyze_tradingview.d.ts +0 -36
  708. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
  709. package/dist/analysis/tradingview/analyze_tradingview.js +0 -172
  710. package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
  711. package/dist/analysis/trend_detection/derivative_analyzer.d.ts +0 -250
  712. package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +0 -1
  713. package/dist/analysis/trend_detection/derivative_analyzer.js +0 -903
  714. package/dist/analysis/trend_detection/derivative_analyzer.js.map +0 -1
  715. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +0 -6
  716. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
  717. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +0 -1450
  718. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
  719. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +0 -6
  720. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
  721. package/dist/analysis/trend_detection/kalman_chart_generator.js +0 -408
  722. package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
  723. package/dist/analysis/trend_detection/regime_chart_generator.d.ts +0 -6
  724. package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
  725. package/dist/analysis/trend_detection/regime_chart_generator.js +0 -345
  726. package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
  727. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
  728. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
  729. package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -130
  730. package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
  731. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
  732. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
  733. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -38
  734. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
  735. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +0 -6
  736. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
  737. package/dist/analysis/trend_detection/volatility_chart_generator.js +0 -732
  738. package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
@@ -31,18 +31,71 @@
31
31
  *
32
32
  * ===============================================================================
33
33
  */
34
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
35
+ if (k2 === undefined) k2 = k;
36
+ var desc = Object.getOwnPropertyDescriptor(m, k);
37
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
38
+ desc = { enumerable: true, get: function() { return m[k]; } };
39
+ }
40
+ Object.defineProperty(o, k2, desc);
41
+ }) : (function(o, m, k, k2) {
42
+ if (k2 === undefined) k2 = k;
43
+ o[k2] = m[k];
44
+ }));
45
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
46
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
47
+ }) : function(o, v) {
48
+ o["default"] = v;
49
+ });
50
+ var __importStar = (this && this.__importStar) || (function () {
51
+ var ownKeys = function(o) {
52
+ ownKeys = Object.getOwnPropertyNames || function (o) {
53
+ var ar = [];
54
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
55
+ return ar;
56
+ };
57
+ return ownKeys(o);
58
+ };
59
+ return function (mod) {
60
+ if (mod && mod.__esModule) return mod;
61
+ var result = {};
62
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
63
+ __setModuleDefault(result, mod);
64
+ return result;
65
+ };
66
+ })();
67
+ Object.defineProperty(exports, "__esModule", { value: true });
68
+ exports.VALID_ORDER_TYPES = exports.VALID_ORDER_STATES = void 0;
69
+ exports.validateOrder = validateOrder;
70
+ exports.validateGridForPersistence = validateGridForPersistence;
71
+ exports.calculateRequiredFunds = calculateRequiredFunds;
72
+ exports.validateWorkingGridFunds = validateWorkingGridFunds;
73
+ exports.checkFundDrift = checkFundDrift;
74
+ exports.reconcileGrid = reconcileGrid;
75
+ exports.optimizeRebalanceActions = optimizeRebalanceActions;
76
+ exports.summarizeActions = summarizeActions;
77
+ exports.hasExecutableActions = hasExecutableActions;
78
+ exports.validateCreateTargetSlots = validateCreateTargetSlots;
79
+ exports.hasActionForOrder = hasActionForOrder;
80
+ exports.removeActionsForOrder = removeActionsForOrder;
81
+ exports.projectTargetToWorkingGrid = projectTargetToWorkingGrid;
82
+ exports.buildStateUpdates = buildStateUpdates;
83
+ exports.buildAbortedResult = buildAbortedResult;
84
+ exports.buildSuccessResult = buildSuccessResult;
85
+ exports.evaluateCommit = evaluateCommit;
34
86
  // ===============================================================================
35
87
  // SECTION 1: EXTERNAL DEPENDENCIES
36
88
  // ===============================================================================
37
- const { ORDER_STATES, ORDER_TYPES, COW_ACTIONS, GRID_LIMITS } = require('../../constants');
38
- const { floatToBlockchainInt, blockchainToFloat, getPrecisionSlack, getDoubleDustThreshold } = require('./math');
39
- const { isOrderOnChain, isPhantomOrder, convertToSpreadPlaceholder } = require('./order');
40
- const Format = require('../format');
89
+ const Format = __importStar(require("../format"));
90
+ const constants_1 = require("../../constants");
91
+ const math_1 = require("./math");
92
+ const order_1 = require("./order");
41
93
  const { isValidNumber, toFiniteNumber } = Format;
42
- const { deepFreeze, cloneMap } = require('./system');
43
94
  // Pre-computed valid sets
44
- const VALID_ORDER_STATES = new Set(Object.values(ORDER_STATES));
45
- const VALID_ORDER_TYPES = new Set(Object.values(ORDER_TYPES));
95
+ const VALID_ORDER_STATES = new Set(Object.values(constants_1.ORDER_STATES));
96
+ exports.VALID_ORDER_STATES = VALID_ORDER_STATES;
97
+ const VALID_ORDER_TYPES = new Set(Object.values(constants_1.ORDER_TYPES));
98
+ exports.VALID_ORDER_TYPES = VALID_ORDER_TYPES;
46
99
  // ===============================================================================
47
100
  // SECTION 2: VALIDATION
48
101
  // ===============================================================================
@@ -61,10 +114,10 @@ function validateOrder(order, oldOrder = null, context = 'validate') {
61
114
  errors.push({ code: 'MISSING_ID', message: 'Refusing to update order: missing ID' });
62
115
  return { isValid: false, errors, warnings, normalizedOrder: null };
63
116
  }
64
- if (!normalizedOrder.type && normalizedOrder.state === ORDER_STATES.VIRTUAL) {
117
+ if (!normalizedOrder.type && normalizedOrder.state === constants_1.ORDER_STATES.VIRTUAL) {
65
118
  const placeholderSize = toFiniteNumber(normalizedOrder.size);
66
119
  if (placeholderSize === 0) {
67
- normalizedOrder.type = ORDER_TYPES.SPREAD;
120
+ normalizedOrder.type = constants_1.ORDER_TYPES.SPREAD;
68
121
  }
69
122
  }
70
123
  if (!VALID_ORDER_STATES.has(normalizedOrder.state)) {
@@ -79,47 +132,47 @@ function validateOrder(order, oldOrder = null, context = 'validate') {
79
132
  message: `Refusing to update order ${order.id}: invalid type '${normalizedOrder.type}' (context: ${context})`
80
133
  });
81
134
  }
82
- if (normalizedOrder.type === ORDER_TYPES.SPREAD && toFiniteNumber(normalizedOrder.size) !== 0) {
135
+ if (normalizedOrder.type === constants_1.ORDER_TYPES.SPREAD && toFiniteNumber(normalizedOrder.size) !== 0) {
83
136
  warnings.push({
84
137
  code: 'SPREAD_SIZE_NORMALIZED',
85
138
  message: `[INVARIANT] Normalizing SPREAD order ${order.id} size ${normalizedOrder.size} -> 0 (context: ${context})`
86
139
  });
87
140
  normalizedOrder.size = 0;
88
141
  }
89
- const isOnChainState = (normalizedOrder.state === ORDER_STATES.ACTIVE ||
90
- normalizedOrder.state === ORDER_STATES.PARTIAL);
91
- if (normalizedOrder.type === ORDER_TYPES.SPREAD && isOnChainState) {
142
+ const isOnChainState = (normalizedOrder.state === constants_1.ORDER_STATES.ACTIVE ||
143
+ normalizedOrder.state === constants_1.ORDER_STATES.PARTIAL);
144
+ if (normalizedOrder.type === constants_1.ORDER_TYPES.SPREAD && isOnChainState) {
92
145
  errors.push({
93
146
  code: 'ILLEGAL_SPREAD_STATE',
94
147
  message: `ILLEGAL STATE: Refusing to move SPREAD order ${order.id} to ${normalizedOrder.state}. SPREAD orders must remain VIRTUAL.`,
95
148
  isFatal: true
96
149
  });
97
150
  }
98
- if (isPhantomOrder(normalizedOrder)) {
151
+ if ((0, order_1.isPhantomOrder)(normalizedOrder)) {
99
152
  errors.push({
100
153
  code: 'PHANTOM_ORDER',
101
154
  message: `ILLEGAL STATE: Refusing to set order ${order.id} to ${normalizedOrder.state} without orderId. Context: ${context}. This would create a phantom order that doubles fund tracking.`,
102
155
  autoCorrect: {
103
- state: ORDER_STATES.VIRTUAL,
156
+ state: constants_1.ORDER_STATES.VIRTUAL,
104
157
  orderId: null,
105
158
  rawOnChain: null,
106
159
  size: 0
107
160
  }
108
161
  });
109
162
  }
110
- if (normalizedOrder.type === ORDER_TYPES.BUY || normalizedOrder.type === ORDER_TYPES.SELL) {
163
+ if (normalizedOrder.type === constants_1.ORDER_TYPES.BUY || normalizedOrder.type === constants_1.ORDER_TYPES.SELL) {
111
164
  normalizedOrder.committedSide = normalizedOrder.type;
112
165
  }
113
166
  else if (!normalizedOrder.committedSide && oldOrder) {
114
167
  if (oldOrder.committedSide) {
115
168
  normalizedOrder.committedSide = oldOrder.committedSide;
116
169
  }
117
- else if (oldOrder.type === ORDER_TYPES.BUY || oldOrder.type === ORDER_TYPES.SELL) {
170
+ else if (oldOrder.type === constants_1.ORDER_TYPES.BUY || oldOrder.type === constants_1.ORDER_TYPES.SELL) {
118
171
  normalizedOrder.committedSide = oldOrder.type;
119
172
  }
120
173
  }
121
174
  return {
122
- isValid: errors.length === 0 || !errors.some(e => e.isFatal),
175
+ isValid: errors.length === 0 || !errors.some((e) => e.isFatal),
123
176
  errors,
124
177
  warnings,
125
178
  normalizedOrder
@@ -133,7 +186,7 @@ function validateOrder(order, oldOrder = null, context = 'validate') {
133
186
  */
134
187
  function validateGridForPersistence(orders, accountTotals) {
135
188
  for (const order of orders.values()) {
136
- if (isPhantomOrder(order)) {
189
+ if ((0, order_1.isPhantomOrder)(order)) {
137
190
  return {
138
191
  isValid: false,
139
192
  reason: `Phantom order detected: order ${order.id} is ${order.state} but has no orderId`
@@ -162,21 +215,21 @@ function calculateRequiredFunds(grid, precisions = {}) {
162
215
  for (const order of grid.values()) {
163
216
  const size = toFiniteNumber(order.size ?? order.amount);
164
217
  const state = order.state;
165
- const isActive = state === ORDER_STATES.ACTIVE || state === ORDER_STATES.PARTIAL;
166
- if (isActive && isOrderOnChain(order)) {
167
- if (order.type === ORDER_TYPES.BUY) {
168
- buyRequiredInt += floatToBlockchainInt(size, buyPrecision);
218
+ const isActive = state === constants_1.ORDER_STATES.ACTIVE || state === constants_1.ORDER_STATES.PARTIAL;
219
+ if (isActive && (0, order_1.isOrderOnChain)(order)) {
220
+ if (order.type === constants_1.ORDER_TYPES.BUY) {
221
+ buyRequiredInt += (0, math_1.floatToBlockchainInt)(size, buyPrecision);
169
222
  }
170
- else if (order.type === ORDER_TYPES.SELL) {
171
- sellRequiredInt += floatToBlockchainInt(size, sellPrecision);
223
+ else if (order.type === constants_1.ORDER_TYPES.SELL) {
224
+ sellRequiredInt += (0, math_1.floatToBlockchainInt)(size, sellPrecision);
172
225
  }
173
226
  }
174
227
  }
175
228
  return {
176
229
  buyInt: buyRequiredInt,
177
230
  sellInt: sellRequiredInt,
178
- buy: blockchainToFloat(buyRequiredInt, buyPrecision),
179
- sell: blockchainToFloat(sellRequiredInt, sellPrecision)
231
+ buy: (0, math_1.blockchainToFloat)(buyRequiredInt, buyPrecision),
232
+ sell: (0, math_1.blockchainToFloat)(sellRequiredInt, sellPrecision)
180
233
  };
181
234
  }
182
235
  /**
@@ -202,26 +255,26 @@ function validateWorkingGridFunds(workingGrid, projectedFunds, precisions = {},
202
255
  ? Number(projectedFunds.chainTotalSell)
203
256
  : toFiniteNumber(projectedFunds?.freeSell ?? projectedFunds?.chainFreeSell);
204
257
  const shortfalls = [];
205
- const availableBuyInt = floatToBlockchainInt(availableBuy, buyPrecision);
206
- const availableSellInt = floatToBlockchainInt(availableSell, sellPrecision);
258
+ const availableBuyInt = (0, math_1.floatToBlockchainInt)(availableBuy, buyPrecision);
259
+ const availableSellInt = (0, math_1.floatToBlockchainInt)(availableSell, sellPrecision);
207
260
  if (required.buyInt > availableBuyInt) {
208
- const requiredBuyFloat = blockchainToFloat(required.buyInt, buyPrecision);
209
- const availableBuyFloat = blockchainToFloat(availableBuyInt, buyPrecision);
261
+ const requiredBuyFloat = (0, math_1.blockchainToFloat)(required.buyInt, buyPrecision);
262
+ const availableBuyFloat = (0, math_1.blockchainToFloat)(availableBuyInt, buyPrecision);
210
263
  shortfalls.push({
211
264
  asset: assets?.assetB?.symbol || 'buyAsset',
212
265
  required: requiredBuyFloat,
213
266
  available: availableBuyFloat,
214
- deficit: blockchainToFloat(required.buyInt - availableBuyInt, buyPrecision)
267
+ deficit: (0, math_1.blockchainToFloat)(required.buyInt - availableBuyInt, buyPrecision)
215
268
  });
216
269
  }
217
270
  if (required.sellInt > availableSellInt) {
218
- const requiredSellFloat = blockchainToFloat(required.sellInt, sellPrecision);
219
- const availableSellFloat = blockchainToFloat(availableSellInt, sellPrecision);
271
+ const requiredSellFloat = (0, math_1.blockchainToFloat)(required.sellInt, sellPrecision);
272
+ const availableSellFloat = (0, math_1.blockchainToFloat)(availableSellInt, sellPrecision);
220
273
  shortfalls.push({
221
274
  asset: assets?.assetA?.symbol || 'sellAsset',
222
275
  required: requiredSellFloat,
223
276
  available: availableSellFloat,
224
- deficit: blockchainToFloat(required.sellInt - availableSellInt, sellPrecision)
277
+ deficit: (0, math_1.blockchainToFloat)(required.sellInt - availableSellInt, sellPrecision)
225
278
  });
226
279
  }
227
280
  return {
@@ -243,11 +296,11 @@ function checkFundDrift(orders, accountTotals, assets = null, gridLimits = null)
243
296
  let gridBuy = 0, gridSell = 0;
244
297
  for (const order of Array.from(orders.values())) {
245
298
  const size = toFiniteNumber(order.size);
246
- if (size <= 0 || !isOrderOnChain(order))
299
+ if (size <= 0 || !(0, order_1.isOrderOnChain)(order))
247
300
  continue;
248
- if (order.type === ORDER_TYPES.BUY)
301
+ if (order.type === constants_1.ORDER_TYPES.BUY)
249
302
  gridBuy += size;
250
- else if (order.type === ORDER_TYPES.SELL)
303
+ else if (order.type === constants_1.ORDER_TYPES.SELL)
251
304
  gridSell += size;
252
305
  }
253
306
  const chainFreeBuy = accountTotals?.buyFree || 0;
@@ -263,9 +316,9 @@ function checkFundDrift(orders, accountTotals, assets = null, gridLimits = null)
263
316
  if (!isValidNumber(buyPrecision) || !isValidNumber(sellPrecision)) {
264
317
  return { isValid: true, reason: 'Skipped: precision not available', driftBuy, driftSell };
265
318
  }
266
- const precisionSlackBuy = getPrecisionSlack(buyPrecision);
267
- const precisionSlackSell = getPrecisionSlack(sellPrecision);
268
- const fundInvariantTolerance = gridLimits?.FUND_INVARIANT_PERCENT_TOLERANCE ?? GRID_LIMITS.FUND_INVARIANT_PERCENT_TOLERANCE;
319
+ const precisionSlackBuy = (0, math_1.getPrecisionSlack)(buyPrecision);
320
+ const precisionSlackSell = (0, math_1.getPrecisionSlack)(sellPrecision);
321
+ const fundInvariantTolerance = gridLimits?.FUND_INVARIANT_PERCENT_TOLERANCE ?? constants_1.GRID_LIMITS.FUND_INVARIANT_PERCENT_TOLERANCE;
269
322
  const percentTolerance = fundInvariantTolerance / 100;
270
323
  const allowedDriftBuy = Math.max(precisionSlackBuy, actualBuy * percentTolerance);
271
324
  const allowedDriftSell = Math.max(precisionSlackSell, actualSell * percentTolerance);
@@ -308,7 +361,7 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
308
361
  const idealSize = toFiniteNumber(order.idealSize || order.size);
309
362
  if (idealSize <= 0)
310
363
  return true;
311
- const minHealthy = getDoubleDustThreshold(idealSize, dustThresholdPercent);
364
+ const minHealthy = (0, math_1.getDoubleDustThreshold)(idealSize, dustThresholdPercent);
312
365
  if (order.size < minHealthy) {
313
366
  if (logger) {
314
367
  logger(`[RECONCILE] Skipping dust target order: ${order.id} ` +
@@ -332,40 +385,40 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
332
385
  }
333
386
  for (const [id, targetOrder] of targetGrid) {
334
387
  const masterOrder = masterGrid.get(id);
335
- if (!masterOrder || masterOrder.state === ORDER_STATES.VIRTUAL) {
388
+ if (!masterOrder || masterOrder.state === constants_1.ORDER_STATES.VIRTUAL) {
336
389
  // Slot is empty or virtual - check if we need to fill it
337
- if (targetOrder.size > 0 && targetOrder.state === ORDER_STATES.ACTIVE) {
390
+ if (targetOrder.size > 0 && targetOrder.state === constants_1.ORDER_STATES.ACTIVE) {
338
391
  // This is a hole that needs filling
339
- if (targetOrder.type === ORDER_TYPES.BUY) {
392
+ if (targetOrder.type === constants_1.ORDER_TYPES.BUY) {
340
393
  holesBuy.push({ id, order: targetOrder });
341
394
  }
342
- else if (targetOrder.type === ORDER_TYPES.SELL) {
395
+ else if (targetOrder.type === constants_1.ORDER_TYPES.SELL) {
343
396
  holesSell.push({ id, order: targetOrder });
344
397
  }
345
398
  }
346
399
  continue;
347
400
  }
348
401
  if (masterOrder.type !== targetOrder.type) {
349
- actions.push({ type: COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'type-mismatch' });
350
- if (targetOrder.size > 0 && targetOrder.state === ORDER_STATES.ACTIVE && isCreateHealthy(targetOrder)) {
351
- actions.push({ type: COW_ACTIONS.CREATE, id, order: targetOrder });
402
+ actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'type-mismatch' });
403
+ if (targetOrder.size > 0 && targetOrder.state === constants_1.ORDER_STATES.ACTIVE && isCreateHealthy(targetOrder)) {
404
+ actions.push({ type: constants_1.COW_ACTIONS.CREATE, id, order: targetOrder });
352
405
  }
353
406
  continue;
354
407
  }
355
408
  // If master is on-chain but target should be VIRTUAL (outside window),
356
409
  // this is a surplus candidate for rotation.
357
- if (isOrderOnChain(masterOrder) && targetOrder.state === ORDER_STATES.VIRTUAL) {
358
- if (masterOrder.type === ORDER_TYPES.BUY) {
410
+ if ((0, order_1.isOrderOnChain)(masterOrder) && targetOrder.state === constants_1.ORDER_STATES.VIRTUAL) {
411
+ if (masterOrder.type === constants_1.ORDER_TYPES.BUY) {
359
412
  surplusesBuy.push({ id, master: masterOrder, target: targetOrder });
360
413
  }
361
- else if (masterOrder.type === ORDER_TYPES.SELL) {
414
+ else if (masterOrder.type === constants_1.ORDER_TYPES.SELL) {
362
415
  surplusesSell.push({ id, master: masterOrder, target: targetOrder });
363
416
  }
364
417
  continue;
365
418
  }
366
419
  if (masterOrder.size !== targetOrder.size) {
367
420
  if (targetOrder.size === 0) {
368
- actions.push({ type: COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'target-size-zero' });
421
+ actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'target-size-zero' });
369
422
  }
370
423
  // Intentionally no in-place size UPDATE here.
371
424
  // Fill-driven COW rebalance keeps updates rotation-only (newGridId path).
@@ -376,12 +429,12 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
376
429
  const cancelSurpluses = (surpluses) => {
377
430
  for (const surplus of surpluses) {
378
431
  if (surplus.master.orderId) {
379
- actions.push({ type: COW_ACTIONS.CANCEL, id: surplus.id, orderId: surplus.master.orderId, reason: 'surplus-no-rotation-target' });
432
+ actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id: surplus.id, orderId: surplus.master.orderId, reason: 'surplus-no-rotation-target' });
380
433
  }
381
434
  }
382
435
  };
383
436
  const pairRotations = (surpluses, holes) => {
384
- const healthyHoles = holes.filter(hole => isCreateHealthy(hole.order));
437
+ const healthyHoles = holes.filter((hole) => isCreateHealthy(hole.order));
385
438
  if (healthyHoles.length === 0) {
386
439
  // No viable rotation targets — cancel all unmatched surpluses
387
440
  cancelSurpluses(surpluses);
@@ -389,11 +442,11 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
389
442
  }
390
443
  if (surpluses.length === 0) {
391
444
  for (const hole of healthyHoles) {
392
- actions.push({ type: COW_ACTIONS.CREATE, id: hole.id, order: hole.order });
445
+ actions.push({ type: constants_1.COW_ACTIONS.CREATE, id: hole.id, order: hole.order });
393
446
  }
394
447
  return;
395
448
  }
396
- const isBuy = surpluses[0]?.master?.type === ORDER_TYPES.BUY;
449
+ const isBuy = surpluses[0]?.master?.type === constants_1.ORDER_TYPES.BUY;
397
450
  healthyHoles.sort((a, b) => isBuy ? b.order.price - a.order.price : a.order.price - b.order.price);
398
451
  surpluses.sort((a, b) => isBuy ? a.master.price - b.master.price : b.master.price - a.master.price);
399
452
  const rotationCount = Math.min(surpluses.length, healthyHoles.length);
@@ -401,7 +454,7 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
401
454
  const surplus = surpluses[i];
402
455
  const hole = healthyHoles[i];
403
456
  actions.push({
404
- type: COW_ACTIONS.UPDATE,
457
+ type: constants_1.COW_ACTIONS.UPDATE,
405
458
  id: surplus.id,
406
459
  orderId: surplus.master.orderId,
407
460
  newGridId: hole.id,
@@ -412,7 +465,7 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
412
465
  });
413
466
  }
414
467
  for (let i = rotationCount; i < healthyHoles.length; i++) {
415
- actions.push({ type: COW_ACTIONS.CREATE, id: healthyHoles[i].id, order: healthyHoles[i].order });
468
+ actions.push({ type: constants_1.COW_ACTIONS.CREATE, id: healthyHoles[i].id, order: healthyHoles[i].order });
416
469
  }
417
470
  // Cancel any surpluses that couldn't be paired with a hole
418
471
  cancelSurpluses(surpluses.slice(rotationCount));
@@ -420,8 +473,8 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
420
473
  pairRotations(surplusesBuy, holesBuy);
421
474
  pairRotations(surplusesSell, holesSell);
422
475
  for (const [id, masterOrder] of masterGrid) {
423
- if (!targetGrid.has(id) && isOrderOnChain(masterOrder)) {
424
- actions.push({ type: COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'orphan-slot' });
476
+ if (!targetGrid.has(id) && (0, order_1.isOrderOnChain)(masterOrder)) {
477
+ actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'orphan-slot' });
425
478
  }
426
479
  }
427
480
  return {
@@ -447,10 +500,10 @@ function optimizeRebalanceActions(actions, masterGrid) {
447
500
  const cancels = [];
448
501
  const passthrough = [];
449
502
  for (const action of actions) {
450
- if (action?.type === COW_ACTIONS.CREATE) {
503
+ if (action?.type === constants_1.COW_ACTIONS.CREATE) {
451
504
  creates.push(action);
452
505
  }
453
- else if (action?.type === COW_ACTIONS.CANCEL) {
506
+ else if (action?.type === constants_1.COW_ACTIONS.CANCEL) {
454
507
  cancels.push(action);
455
508
  }
456
509
  else {
@@ -490,7 +543,7 @@ function optimizeRebalanceActions(actions, masterGrid) {
490
543
  }
491
544
  const createAction = remainingCreates.splice(bestIdx, 1)[0];
492
545
  optimized.push({
493
- type: COW_ACTIONS.UPDATE,
546
+ type: constants_1.COW_ACTIONS.UPDATE,
494
547
  id: cancelAction.id,
495
548
  orderId: cancelAction.orderId,
496
549
  newGridId: createAction.id,
@@ -513,9 +566,9 @@ function optimizeRebalanceActions(actions, masterGrid) {
513
566
  function summarizeActions(actions) {
514
567
  return {
515
568
  total: actions.length,
516
- creates: actions.filter(a => a.type === COW_ACTIONS.CREATE).length,
517
- cancels: actions.filter(a => a.type === COW_ACTIONS.CANCEL).length,
518
- updates: actions.filter(a => a.type === COW_ACTIONS.UPDATE).length
569
+ creates: actions.filter((a) => a.type === constants_1.COW_ACTIONS.CREATE).length,
570
+ cancels: actions.filter((a) => a.type === constants_1.COW_ACTIONS.CANCEL).length,
571
+ updates: actions.filter((a) => a.type === constants_1.COW_ACTIONS.UPDATE).length
519
572
  };
520
573
  }
521
574
  /**
@@ -541,11 +594,11 @@ function validateCreateTargetSlots(actions, orders) {
541
594
  const orderMap = orders instanceof Map ? orders : new Map();
542
595
  const releasedSlotIds = new Set();
543
596
  for (const action of safeActions) {
544
- if (action?.type === COW_ACTIONS.CANCEL && action.id) {
597
+ if (action?.type === constants_1.COW_ACTIONS.CANCEL && action.id) {
545
598
  releasedSlotIds.add(action.id);
546
599
  continue;
547
600
  }
548
- if (action?.type === COW_ACTIONS.UPDATE &&
601
+ if (action?.type === constants_1.COW_ACTIONS.UPDATE &&
549
602
  action.id &&
550
603
  action.newGridId &&
551
604
  action.newGridId !== action.id) {
@@ -554,7 +607,7 @@ function validateCreateTargetSlots(actions, orders) {
554
607
  }
555
608
  const violations = [];
556
609
  for (const action of safeActions) {
557
- if (action?.type !== COW_ACTIONS.CREATE)
610
+ if (action?.type !== constants_1.COW_ACTIONS.CREATE)
558
611
  continue;
559
612
  const targetId = action.id || action.order?.id;
560
613
  if (!targetId || releasedSlotIds.has(targetId))
@@ -562,7 +615,7 @@ function validateCreateTargetSlots(actions, orders) {
562
615
  const current = orderMap.get(targetId);
563
616
  if (!current)
564
617
  continue;
565
- if (isOrderOnChain(current)) {
618
+ if ((0, order_1.isOrderOnChain)(current)) {
566
619
  violations.push({
567
620
  targetId,
568
621
  currentOrderId: current.orderId,
@@ -603,7 +656,7 @@ function actionMatchesOrder(action, orderRef) {
603
656
  function hasActionForOrder(actions, actionType, orderRef) {
604
657
  if (!Array.isArray(actions))
605
658
  return false;
606
- return actions.some(action => {
659
+ return actions.some((action) => {
607
660
  if (actionType && action?.type !== actionType)
608
661
  return false;
609
662
  return actionMatchesOrder(action, orderRef);
@@ -644,7 +697,7 @@ function _buildUpdateSelectors(actions) {
644
697
  if (!Array.isArray(actions))
645
698
  return selectors;
646
699
  for (const action of actions) {
647
- if (action?.type !== COW_ACTIONS.UPDATE)
700
+ if (action?.type !== constants_1.COW_ACTIONS.UPDATE)
648
701
  continue;
649
702
  if (action.id)
650
703
  selectors.slotIds.add(String(action.id));
@@ -709,13 +762,13 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
709
762
  workingGrid.set(id, {
710
763
  ...targetOrder,
711
764
  size: Math.max(0, targetSize),
712
- state: ORDER_STATES.VIRTUAL,
765
+ state: constants_1.ORDER_STATES.VIRTUAL,
713
766
  orderId: null
714
767
  });
715
768
  continue;
716
769
  }
717
770
  if (targetSize > 0) {
718
- const keepOrderId = isOrderOnChain(current) && current.type === targetOrder.type;
771
+ const keepOrderId = (0, order_1.isOrderOnChain)(current) && current.type === targetOrder.type;
719
772
  const hasExplicitUpdate = _hasExplicitUpdateForOrder(updateSelectors, current, id);
720
773
  // Orders without on-chain ID remain VIRTUAL until synchronizeWithChain
721
774
  // confirms blockchain placement and triggers accounting deduction.
@@ -728,7 +781,7 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
728
781
  const preservedSize = shouldPreserveSize
729
782
  ? Math.max(0, toFiniteNumber(current.size))
730
783
  : targetSize;
731
- const resultState = keepOrderId ? current.state : ORDER_STATES.VIRTUAL;
784
+ const resultState = keepOrderId ? current.state : constants_1.ORDER_STATES.VIRTUAL;
732
785
  const resultOrderId = keepOrderId ? current.orderId : null;
733
786
  if (!_isProjectionUnchanged(current, targetOrder, preservedSize, resultState, resultOrderId)) {
734
787
  workingGrid.set(id, {
@@ -741,12 +794,12 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
741
794
  }
742
795
  }
743
796
  else {
744
- if (!_isProjectionUnchanged(current, targetOrder, 0, ORDER_STATES.VIRTUAL, null)) {
797
+ if (!_isProjectionUnchanged(current, targetOrder, 0, constants_1.ORDER_STATES.VIRTUAL, null)) {
745
798
  workingGrid.set(id, {
746
799
  ...current,
747
800
  ...targetOrder,
748
801
  size: 0,
749
- state: ORDER_STATES.VIRTUAL,
802
+ state: constants_1.ORDER_STATES.VIRTUAL,
750
803
  orderId: null
751
804
  });
752
805
  }
@@ -755,8 +808,8 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
755
808
  for (const [id, current] of workingGrid.entries()) {
756
809
  if (targetIds.has(id))
757
810
  continue;
758
- if (isOrderOnChain(current)) {
759
- workingGrid.set(id, convertToSpreadPlaceholder(current));
811
+ if ((0, order_1.isOrderOnChain)(current)) {
812
+ workingGrid.set(id, (0, order_1.convertToSpreadPlaceholder)(current));
760
813
  }
761
814
  }
762
815
  }
@@ -769,20 +822,20 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
769
822
  function buildStateUpdates(actions, masterGrid) {
770
823
  const stateUpdates = [];
771
824
  for (const action of actions) {
772
- if (action.type === COW_ACTIONS.CREATE) {
825
+ if (action.type === constants_1.COW_ACTIONS.CREATE) {
773
826
  stateUpdates.push({
774
827
  ...action.order,
775
- state: ORDER_STATES.VIRTUAL,
828
+ state: constants_1.ORDER_STATES.VIRTUAL,
776
829
  orderId: null
777
830
  });
778
831
  }
779
- else if (action.type === COW_ACTIONS.CANCEL) {
832
+ else if (action.type === constants_1.COW_ACTIONS.CANCEL) {
780
833
  const masterOrder = masterGrid.get(action.id);
781
834
  if (masterOrder) {
782
- stateUpdates.push(convertToSpreadPlaceholder(masterOrder));
835
+ stateUpdates.push((0, order_1.convertToSpreadPlaceholder)(masterOrder));
783
836
  }
784
837
  }
785
- else if (action.type === COW_ACTIONS.UPDATE) {
838
+ else if (action.type === constants_1.COW_ACTIONS.UPDATE) {
786
839
  const masterOrder = masterGrid.get(action.id);
787
840
  if (masterOrder) {
788
841
  const newSize = toFiniteNumber(action.newSize ?? action.order?.size);
@@ -819,7 +872,7 @@ function buildSuccessResult({ actions, stateUpdates, workingGrid, workingBoundar
819
872
  return {
820
873
  actions,
821
874
  stateUpdates,
822
- hadRotation: actions.some(a => a.type === COW_ACTIONS.CREATE || a.type === COW_ACTIONS.UPDATE),
875
+ hadRotation: actions.some((a) => a.type === constants_1.COW_ACTIONS.CREATE || a.type === constants_1.COW_ACTIONS.UPDATE),
823
876
  workingGrid,
824
877
  workingIndexes: workingGrid.getIndexes(),
825
878
  workingBoundary,
@@ -835,7 +888,7 @@ function buildSuccessResult({ actions, stateUpdates, workingGrid, workingBoundar
835
888
  */
836
889
  function evaluateCommit(workingGrid, options = {}) {
837
890
  const hasLock = typeof options === 'boolean' ? options : !!options?.hasLock;
838
- const currentVersion = toFiniteNumber(options?.currentVersion, null);
891
+ const currentVersion = toFiniteNumber(options?.currentVersion, undefined);
839
892
  const masterGrid = typeof options === 'object' ? options.masterGrid : null;
840
893
  if (!workingGrid) {
841
894
  return {
@@ -890,27 +943,4 @@ function evaluateCommit(workingGrid, options = {}) {
890
943
  }
891
944
  return { canCommit: true };
892
945
  }
893
- module.exports = {
894
- // Validation
895
- validateOrder,
896
- validateGridForPersistence,
897
- calculateRequiredFunds,
898
- validateWorkingGridFunds,
899
- checkFundDrift,
900
- VALID_ORDER_STATES,
901
- VALID_ORDER_TYPES,
902
- // Grid reconciliation (COW pipeline)
903
- reconcileGrid,
904
- optimizeRebalanceActions,
905
- summarizeActions,
906
- hasExecutableActions,
907
- validateCreateTargetSlots,
908
- hasActionForOrder,
909
- removeActionsForOrder,
910
- projectTargetToWorkingGrid,
911
- buildStateUpdates,
912
- buildAbortedResult,
913
- buildSuccessResult,
914
- evaluateCommit
915
- };
916
946
  //# sourceMappingURL=validate.js.map