@drakkar.software/octobot-client 0.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 (306) hide show
  1. package/README.md +140 -0
  2. package/dist/client/adapters/accounts.d.ts +66 -0
  3. package/dist/client/adapters/accounts.d.ts.map +1 -0
  4. package/dist/client/adapters/accounts.js +214 -0
  5. package/dist/client/adapters/accounts.js.map +1 -0
  6. package/dist/client/adapters/actionHandle.d.ts +29 -0
  7. package/dist/client/adapters/actionHandle.d.ts.map +1 -0
  8. package/dist/client/adapters/actionHandle.js +34 -0
  9. package/dist/client/adapters/actionHandle.js.map +1 -0
  10. package/dist/client/adapters/automations.d.ts +31 -0
  11. package/dist/client/adapters/automations.d.ts.map +1 -0
  12. package/dist/client/adapters/automations.js +79 -0
  13. package/dist/client/adapters/automations.js.map +1 -0
  14. package/dist/client/adapters/documents.d.ts +55 -0
  15. package/dist/client/adapters/documents.d.ts.map +1 -0
  16. package/dist/client/adapters/documents.js +66 -0
  17. package/dist/client/adapters/documents.js.map +1 -0
  18. package/dist/client/adapters/nodeApi.d.ts +25 -0
  19. package/dist/client/adapters/nodeApi.d.ts.map +1 -0
  20. package/dist/client/adapters/nodeApi.js +81 -0
  21. package/dist/client/adapters/nodeApi.js.map +1 -0
  22. package/dist/client/adapters/settings.d.ts +16 -0
  23. package/dist/client/adapters/settings.d.ts.map +1 -0
  24. package/dist/client/adapters/settings.js +43 -0
  25. package/dist/client/adapters/settings.js.map +1 -0
  26. package/dist/client/adapters/strategies.d.ts +17 -0
  27. package/dist/client/adapters/strategies.d.ts.map +1 -0
  28. package/dist/client/adapters/strategies.js +75 -0
  29. package/dist/client/adapters/strategies.js.map +1 -0
  30. package/dist/client/connect/connect.d.ts +40 -0
  31. package/dist/client/connect/connect.d.ts.map +1 -0
  32. package/dist/client/connect/connect.js +133 -0
  33. package/dist/client/connect/connect.js.map +1 -0
  34. package/dist/client/connect/readOnly.d.ts +97 -0
  35. package/dist/client/connect/readOnly.d.ts.map +1 -0
  36. package/dist/client/connect/readOnly.js +167 -0
  37. package/dist/client/connect/readOnly.js.map +1 -0
  38. package/dist/client/core/errors.d.ts +80 -0
  39. package/dist/client/core/errors.d.ts.map +1 -0
  40. package/dist/client/core/errors.js +154 -0
  41. package/dist/client/core/errors.js.map +1 -0
  42. package/dist/client/core/options.d.ts +44 -0
  43. package/dist/client/core/options.d.ts.map +1 -0
  44. package/dist/client/core/options.js +2 -0
  45. package/dist/client/core/options.js.map +1 -0
  46. package/dist/client/core/session.d.ts +90 -0
  47. package/dist/client/core/session.d.ts.map +1 -0
  48. package/dist/client/core/session.js +72 -0
  49. package/dist/client/core/session.js.map +1 -0
  50. package/dist/client/core/views.d.ts +40 -0
  51. package/dist/client/core/views.d.ts.map +1 -0
  52. package/dist/client/core/views.js +32 -0
  53. package/dist/client/core/views.js.map +1 -0
  54. package/dist/client/index.d.ts +16 -0
  55. package/dist/client/index.d.ts.map +1 -0
  56. package/dist/client/index.js +9 -0
  57. package/dist/client/index.js.map +1 -0
  58. package/dist/client/mirror/collections.d.ts +125 -0
  59. package/dist/client/mirror/collections.d.ts.map +1 -0
  60. package/dist/client/mirror/collections.js +118 -0
  61. package/dist/client/mirror/collections.js.map +1 -0
  62. package/dist/client/mirror/index.d.ts +4 -0
  63. package/dist/client/mirror/index.d.ts.map +1 -0
  64. package/dist/client/mirror/index.js +4 -0
  65. package/dist/client/mirror/index.js.map +1 -0
  66. package/dist/client/mirror/writer.d.ts +39 -0
  67. package/dist/client/mirror/writer.d.ts.map +1 -0
  68. package/dist/client/mirror/writer.js +50 -0
  69. package/dist/client/mirror/writer.js.map +1 -0
  70. package/dist/client/pairing/mirrorGrant.d.ts +91 -0
  71. package/dist/client/pairing/mirrorGrant.d.ts.map +1 -0
  72. package/dist/client/pairing/mirrorGrant.js +99 -0
  73. package/dist/client/pairing/mirrorGrant.js.map +1 -0
  74. package/dist/client/pairing/mirrorReader.d.ts +99 -0
  75. package/dist/client/pairing/mirrorReader.d.ts.map +1 -0
  76. package/dist/client/pairing/mirrorReader.js +117 -0
  77. package/dist/client/pairing/mirrorReader.js.map +1 -0
  78. package/dist/client/pairing/pairingGrantExchange.d.ts +135 -0
  79. package/dist/client/pairing/pairingGrantExchange.d.ts.map +1 -0
  80. package/dist/client/pairing/pairingGrantExchange.js +186 -0
  81. package/dist/client/pairing/pairingGrantExchange.js.map +1 -0
  82. package/dist/client/pairing/pairingRequest.d.ts +82 -0
  83. package/dist/client/pairing/pairingRequest.d.ts.map +1 -0
  84. package/dist/client/pairing/pairingRequest.js +120 -0
  85. package/dist/client/pairing/pairingRequest.js.map +1 -0
  86. package/dist/client/strategy.d.ts +36 -0
  87. package/dist/client/strategy.d.ts.map +1 -0
  88. package/dist/client/strategy.js +26 -0
  89. package/dist/client/strategy.js.map +1 -0
  90. package/dist/collections/index.d.ts +3 -0
  91. package/dist/collections/index.d.ts.map +1 -0
  92. package/dist/collections/index.js +3 -0
  93. package/dist/collections/index.js.map +1 -0
  94. package/dist/collections/nodeCollections.d.ts +57 -0
  95. package/dist/collections/nodeCollections.d.ts.map +1 -0
  96. package/dist/collections/nodeCollections.js +40 -0
  97. package/dist/collections/nodeCollections.js.map +1 -0
  98. package/dist/collections/paths.d.ts +7 -0
  99. package/dist/collections/paths.d.ts.map +1 -0
  100. package/dist/collections/paths.js +13 -0
  101. package/dist/collections/paths.js.map +1 -0
  102. package/dist/crypto/collectionKeys.d.ts +28 -0
  103. package/dist/crypto/collectionKeys.d.ts.map +1 -0
  104. package/dist/crypto/collectionKeys.js +53 -0
  105. package/dist/crypto/collectionKeys.js.map +1 -0
  106. package/dist/crypto/hkdf.d.ts +14 -0
  107. package/dist/crypto/hkdf.d.ts.map +1 -0
  108. package/dist/crypto/hkdf.js +19 -0
  109. package/dist/crypto/hkdf.js.map +1 -0
  110. package/dist/crypto/index.d.ts +5 -0
  111. package/dist/crypto/index.d.ts.map +1 -0
  112. package/dist/crypto/index.js +5 -0
  113. package/dist/crypto/index.js.map +1 -0
  114. package/dist/crypto/secretEncryptor.d.ts +20 -0
  115. package/dist/crypto/secretEncryptor.d.ts.map +1 -0
  116. package/dist/crypto/secretEncryptor.js +82 -0
  117. package/dist/crypto/secretEncryptor.js.map +1 -0
  118. package/dist/crypto/wireConstants.d.ts +14 -0
  119. package/dist/crypto/wireConstants.d.ts.map +1 -0
  120. package/dist/crypto/wireConstants.js +17 -0
  121. package/dist/crypto/wireConstants.js.map +1 -0
  122. package/dist/identity/address.d.ts +3 -0
  123. package/dist/identity/address.d.ts.map +1 -0
  124. package/dist/identity/address.js +17 -0
  125. package/dist/identity/address.js.map +1 -0
  126. package/dist/identity/bip39-wordlist.d.ts +2 -0
  127. package/dist/identity/bip39-wordlist.d.ts.map +1 -0
  128. package/dist/identity/bip39-wordlist.js +2051 -0
  129. package/dist/identity/bip39-wordlist.js.map +1 -0
  130. package/dist/identity/capProvider.d.ts +45 -0
  131. package/dist/identity/capProvider.d.ts.map +1 -0
  132. package/dist/identity/capProvider.js +80 -0
  133. package/dist/identity/capProvider.js.map +1 -0
  134. package/dist/identity/derivationSchemes.d.ts +25 -0
  135. package/dist/identity/derivationSchemes.d.ts.map +1 -0
  136. package/dist/identity/derivationSchemes.js +34 -0
  137. package/dist/identity/derivationSchemes.js.map +1 -0
  138. package/dist/identity/evm.d.ts +8 -0
  139. package/dist/identity/evm.d.ts.map +1 -0
  140. package/dist/identity/evm.js +78 -0
  141. package/dist/identity/evm.js.map +1 -0
  142. package/dist/identity/index.d.ts +10 -0
  143. package/dist/identity/index.d.ts.map +1 -0
  144. package/dist/identity/index.js +10 -0
  145. package/dist/identity/index.js.map +1 -0
  146. package/dist/identity/keys.d.ts +17 -0
  147. package/dist/identity/keys.d.ts.map +1 -0
  148. package/dist/identity/keys.js +36 -0
  149. package/dist/identity/keys.js.map +1 -0
  150. package/dist/identity/mnemonic.d.ts +4 -0
  151. package/dist/identity/mnemonic.d.ts.map +1 -0
  152. package/dist/identity/mnemonic.js +93 -0
  153. package/dist/identity/mnemonic.js.map +1 -0
  154. package/dist/identity/pairing.d.ts +45 -0
  155. package/dist/identity/pairing.d.ts.map +1 -0
  156. package/dist/identity/pairing.js +91 -0
  157. package/dist/identity/pairing.js.map +1 -0
  158. package/dist/identity/pairingRequest.d.ts +99 -0
  159. package/dist/identity/pairingRequest.d.ts.map +1 -0
  160. package/dist/identity/pairingRequest.js +217 -0
  161. package/dist/identity/pairingRequest.js.map +1 -0
  162. package/dist/identity/secret.d.ts +32 -0
  163. package/dist/identity/secret.d.ts.map +1 -0
  164. package/dist/identity/secret.js +54 -0
  165. package/dist/identity/secret.js.map +1 -0
  166. package/dist/index.d.ts +9 -0
  167. package/dist/index.d.ts.map +1 -0
  168. package/dist/index.js +18 -0
  169. package/dist/index.js.map +1 -0
  170. package/dist/internal/bytes.d.ts +11 -0
  171. package/dist/internal/bytes.d.ts.map +1 -0
  172. package/dist/internal/bytes.js +38 -0
  173. package/dist/internal/bytes.js.map +1 -0
  174. package/dist/node-api/dexPair.d.ts +24 -0
  175. package/dist/node-api/dexPair.d.ts.map +1 -0
  176. package/dist/node-api/dexPair.js +39 -0
  177. package/dist/node-api/dexPair.js.map +1 -0
  178. package/dist/node-api/dsl.d.ts +10 -0
  179. package/dist/node-api/dsl.d.ts.map +1 -0
  180. package/dist/node-api/dsl.js +7 -0
  181. package/dist/node-api/dsl.js.map +1 -0
  182. package/dist/node-api/exchanges.d.ts +49 -0
  183. package/dist/node-api/exchanges.d.ts.map +1 -0
  184. package/dist/node-api/exchanges.js +32 -0
  185. package/dist/node-api/exchanges.js.map +1 -0
  186. package/dist/node-api/index.d.ts +12 -0
  187. package/dist/node-api/index.d.ts.map +1 -0
  188. package/dist/node-api/index.js +12 -0
  189. package/dist/node-api/index.js.map +1 -0
  190. package/dist/node-api/marketMaking.d.ts +39 -0
  191. package/dist/node-api/marketMaking.d.ts.map +1 -0
  192. package/dist/node-api/marketMaking.js +44 -0
  193. package/dist/node-api/marketMaking.js.map +1 -0
  194. package/dist/node-api/octobots.d.ts +14 -0
  195. package/dist/node-api/octobots.d.ts.map +1 -0
  196. package/dist/node-api/octobots.js +16 -0
  197. package/dist/node-api/octobots.js.map +1 -0
  198. package/dist/node-api/orderBookPreview.d.ts +11 -0
  199. package/dist/node-api/orderBookPreview.d.ts.map +1 -0
  200. package/dist/node-api/orderBookPreview.js +7 -0
  201. package/dist/node-api/orderBookPreview.js.map +1 -0
  202. package/dist/node-api/pairing.d.ts +39 -0
  203. package/dist/node-api/pairing.d.ts.map +1 -0
  204. package/dist/node-api/pairing.js +61 -0
  205. package/dist/node-api/pairing.js.map +1 -0
  206. package/dist/node-api/pairs.d.ts +32 -0
  207. package/dist/node-api/pairs.d.ts.map +1 -0
  208. package/dist/node-api/pairs.js +72 -0
  209. package/dist/node-api/pairs.js.map +1 -0
  210. package/dist/node-api/requiredFunds.d.ts +11 -0
  211. package/dist/node-api/requiredFunds.d.ts.map +1 -0
  212. package/dist/node-api/requiredFunds.js +7 -0
  213. package/dist/node-api/requiredFunds.js.map +1 -0
  214. package/dist/node-api/setup.d.ts +25 -0
  215. package/dist/node-api/setup.d.ts.map +1 -0
  216. package/dist/node-api/setup.js +13 -0
  217. package/dist/node-api/setup.js.map +1 -0
  218. package/dist/node-api/wallet.d.ts +55 -0
  219. package/dist/node-api/wallet.d.ts.map +1 -0
  220. package/dist/node-api/wallet.js +87 -0
  221. package/dist/node-api/wallet.js.map +1 -0
  222. package/dist/protocol/actions.d.ts +40 -0
  223. package/dist/protocol/actions.d.ts.map +1 -0
  224. package/dist/protocol/actions.js +118 -0
  225. package/dist/protocol/actions.js.map +1 -0
  226. package/dist/protocol/documents.d.ts +25 -0
  227. package/dist/protocol/documents.d.ts.map +1 -0
  228. package/dist/protocol/documents.js +2 -0
  229. package/dist/protocol/documents.js.map +1 -0
  230. package/dist/protocol/index.d.ts +10 -0
  231. package/dist/protocol/index.d.ts.map +1 -0
  232. package/dist/protocol/index.js +12 -0
  233. package/dist/protocol/index.js.map +1 -0
  234. package/dist/protocol/orchestration/createAutomation.d.ts +61 -0
  235. package/dist/protocol/orchestration/createAutomation.d.ts.map +1 -0
  236. package/dist/protocol/orchestration/createAutomation.js +71 -0
  237. package/dist/protocol/orchestration/createAutomation.js.map +1 -0
  238. package/dist/protocol/poll.d.ts +4 -0
  239. package/dist/protocol/poll.d.ts.map +1 -0
  240. package/dist/protocol/poll.js +4 -0
  241. package/dist/protocol/poll.js.map +1 -0
  242. package/dist/protocol/proposal.d.ts +36 -0
  243. package/dist/protocol/proposal.d.ts.map +1 -0
  244. package/dist/protocol/proposal.js +39 -0
  245. package/dist/protocol/proposal.js.map +1 -0
  246. package/dist/protocol/state.d.ts +87 -0
  247. package/dist/protocol/state.d.ts.map +1 -0
  248. package/dist/protocol/state.js +303 -0
  249. package/dist/protocol/state.js.map +1 -0
  250. package/dist/protocol/strategy/build.d.ts +44 -0
  251. package/dist/protocol/strategy/build.d.ts.map +1 -0
  252. package/dist/protocol/strategy/build.js +50 -0
  253. package/dist/protocol/strategy/build.js.map +1 -0
  254. package/dist/protocol/strategy/builders.d.ts +252 -0
  255. package/dist/protocol/strategy/builders.d.ts.map +1 -0
  256. package/dist/protocol/strategy/builders.js +382 -0
  257. package/dist/protocol/strategy/builders.js.map +1 -0
  258. package/dist/protocol/strategy/index.d.ts +5 -0
  259. package/dist/protocol/strategy/index.d.ts.map +1 -0
  260. package/dist/protocol/strategy/index.js +4 -0
  261. package/dist/protocol/strategy/index.js.map +1 -0
  262. package/dist/protocol/strategy/kinds.d.ts +2 -0
  263. package/dist/protocol/strategy/kinds.d.ts.map +1 -0
  264. package/dist/protocol/strategy/kinds.js +2 -0
  265. package/dist/protocol/strategy/kinds.js.map +1 -0
  266. package/dist/protocol/strategy/patch.d.ts +59 -0
  267. package/dist/protocol/strategy/patch.d.ts.map +1 -0
  268. package/dist/protocol/strategy/patch.js +253 -0
  269. package/dist/protocol/strategy/patch.js.map +1 -0
  270. package/dist/protocol/symbols.d.ts +8 -0
  271. package/dist/protocol/symbols.d.ts.map +1 -0
  272. package/dist/protocol/symbols.js +11 -0
  273. package/dist/protocol/symbols.js.map +1 -0
  274. package/dist/transport/constants.d.ts +8 -0
  275. package/dist/transport/constants.d.ts.map +1 -0
  276. package/dist/transport/constants.js +8 -0
  277. package/dist/transport/constants.js.map +1 -0
  278. package/dist/transport/documents.d.ts +27 -0
  279. package/dist/transport/documents.d.ts.map +1 -0
  280. package/dist/transport/documents.js +34 -0
  281. package/dist/transport/documents.js.map +1 -0
  282. package/dist/transport/index.d.ts +8 -0
  283. package/dist/transport/index.d.ts.map +1 -0
  284. package/dist/transport/index.js +8 -0
  285. package/dist/transport/index.js.map +1 -0
  286. package/dist/transport/probe.d.ts +44 -0
  287. package/dist/transport/probe.d.ts.map +1 -0
  288. package/dist/transport/probe.js +121 -0
  289. package/dist/transport/probe.js.map +1 -0
  290. package/dist/transport/rendezvous.d.ts +116 -0
  291. package/dist/transport/rendezvous.d.ts.map +1 -0
  292. package/dist/transport/rendezvous.js +139 -0
  293. package/dist/transport/rendezvous.js.map +1 -0
  294. package/dist/transport/rest.d.ts +35 -0
  295. package/dist/transport/rest.d.ts.map +1 -0
  296. package/dist/transport/rest.js +58 -0
  297. package/dist/transport/rest.js.map +1 -0
  298. package/dist/transport/syncClient.d.ts +14 -0
  299. package/dist/transport/syncClient.d.ts.map +1 -0
  300. package/dist/transport/syncClient.js +30 -0
  301. package/dist/transport/syncClient.js.map +1 -0
  302. package/dist/transport/urls.d.ts +35 -0
  303. package/dist/transport/urls.d.ts.map +1 -0
  304. package/dist/transport/urls.js +126 -0
  305. package/dist/transport/urls.js.map +1 -0
  306. package/package.json +55 -0
@@ -0,0 +1,382 @@
1
+ /** Constant per-pair-setting fields for GridTradingMode (StaggeredOrders subclass). */
2
+ const GRID_PAIR_SETTING_DEFAULTS = {
3
+ sell_funds: 0,
4
+ buy_funds: 0,
5
+ starting_price: 0,
6
+ buy_volume_per_order: 0,
7
+ sell_volume_per_order: 0,
8
+ ignore_exchange_fees: true,
9
+ reinvest_profits: true,
10
+ mirror_order_delay: 0,
11
+ use_existing_orders_only: false,
12
+ allow_funds_redispatch: false,
13
+ funds_redispatch_interval: 24,
14
+ enable_trailing_down: false,
15
+ };
16
+ function gridPairSettings(pair, flatSpread, flatIncrement, buyOrdersCount, sellOrdersCount, trailing) {
17
+ return {
18
+ pair,
19
+ flat_spread: flatSpread,
20
+ flat_increment: flatIncrement,
21
+ buy_orders_count: buyOrdersCount,
22
+ sell_orders_count: sellOrdersCount,
23
+ enable_trailing_up: trailing?.enableTrailingUp ?? GRID_INPUT_DEFAULTS.enableTrailingUp,
24
+ order_by_order_trailing: trailing?.orderByOrderTrailing ?? GRID_INPUT_DEFAULTS.orderByOrderTrailing,
25
+ ...GRID_PAIR_SETTING_DEFAULTS,
26
+ };
27
+ }
28
+ /** The wizard's only DCA trigger mode — evaluator-signal triggering needs
29
+ * evaluator config the wizard has no UI for. */
30
+ export const DCA_TRIGGER_MODE_TIME_BASED = 'Time based';
31
+ export const DCA_DEFAULTS = {
32
+ buy_order_amount: '10%t',
33
+ minutes_before_next_buy: 10080,
34
+ use_market_entry_orders: false,
35
+ entry_limit_orders_price_percent: 1,
36
+ use_take_profit_exit_orders: true,
37
+ exit_limit_orders_price_percent: 3,
38
+ };
39
+ /** GridInput-side defaults (spec example values), shared with a caller's own
40
+ * draft store so both layers agree on what an untouched grid emits. */
41
+ export const GRID_INPUT_DEFAULTS = {
42
+ buyOrdersCount: 10,
43
+ sellOrdersCount: 20,
44
+ enableTrailingUp: true,
45
+ orderByOrderTrailing: true,
46
+ };
47
+ export const INDEX_DEFAULTS = {
48
+ rebalance_trigger_min_percent: 5,
49
+ };
50
+ export function formatDcaAmount(value, unit) {
51
+ return `${String(value).trim()}${unit === 'base' ? '' : unit}`;
52
+ }
53
+ /** Split a protocol buy_order_amount string into value + unit. Unknown
54
+ * suffixes ('2%', '12a%'…) stay whole in `value` with unit 'base' so a
55
+ * foreign config re-emits verbatim (formatDcaAmount round-trips it). */
56
+ export function parseDcaAmount(amount) {
57
+ const trimmed = amount.trim();
58
+ if (trimmed.endsWith('%t'))
59
+ return { value: trimmed.slice(0, -2), unit: '%t' };
60
+ if (trimmed.endsWith('q') && Number.isFinite(Number.parseFloat(trimmed.slice(0, -1)))) {
61
+ return { value: trimmed.slice(0, -1), unit: 'q' };
62
+ }
63
+ return { value: trimmed, unit: 'base' };
64
+ }
65
+ /** Float hygiene for derived quote-price deltas. */
66
+ function round8(n) {
67
+ return Math.round(n * 1e8) / 1e8;
68
+ }
69
+ function num(v) {
70
+ const n = typeof v === 'string' ? Number.parseFloat(v) : v;
71
+ return typeof n === 'number' && Number.isFinite(n) ? n : 0;
72
+ }
73
+ /** Amounts/percentages from free-text inputs: the minus sign is typable on
74
+ * web and Android numeric keyboards, and the protocol's numeric fields are
75
+ * non-negative domains ('0 means unlimited'). */
76
+ function pos(v) {
77
+ return Math.max(0, num(v));
78
+ }
79
+ /** Order counts are whole and non-negative. */
80
+ function count(v) {
81
+ return Math.max(0, Math.round(num(v)));
82
+ }
83
+ function refsToProtocol(refs, exchange, tradingPair) {
84
+ // No configured references: quote the traded pair on the bot's own venue.
85
+ if (!refs?.length)
86
+ return [{ exchange, pair: tradingPair, weight: 1 }];
87
+ return refs.map((r) => ({
88
+ // A reference quoted on another venue (or a sentinel like 'local
89
+ // exchange price') keeps it across edits — only venue-less refs (all
90
+ // wizard-created ones) default to the bot's own exchange.
91
+ exchange: r.exchange ?? exchange,
92
+ pair: r.pair,
93
+ weight: r.weight,
94
+ formula: r.formula || undefined,
95
+ time_frame: r.timeframe,
96
+ }));
97
+ }
98
+ function fundsDistribution(shape) {
99
+ if (shape === 'flat' || shape === 'linear')
100
+ return 'flat';
101
+ if (shape === 'expo')
102
+ return 'valley';
103
+ // 'custom' and 'random' both map to the protocol's 'random' distribution.
104
+ return 'random';
105
+ }
106
+ // The node requires average_price_counted_minutes >= 1 — 0/unset still falls
107
+ // back to the 60-minute default, but any typed value below 1 (e.g. '0.5') is
108
+ // floored to 1 rather than sent through unclamped.
109
+ function avgPriceMinutesOf(v) {
110
+ const raw = pos(v);
111
+ return raw > 0 ? Math.max(1, raw) : 60;
112
+ }
113
+ // Per-pair stop-conditions, real thresholds (no rule-toggle presets). 0
114
+ // (or unset) stays "not set", mirroring the protocol's own semantics.
115
+ function stopConditionsFor(sc) {
116
+ if (!sc?.enabled)
117
+ return undefined;
118
+ const conditions = {};
119
+ if (pos(sc.minBaseHolding) > 0)
120
+ conditions.min_base_holding = pos(sc.minBaseHolding);
121
+ if (pos(sc.minQuoteHolding) > 0)
122
+ conditions.min_quote_holding = pos(sc.minQuoteHolding);
123
+ if (pos(sc.maxPositivePct) > 0)
124
+ conditions.max_positive_percent_price_change = pos(sc.maxPositivePct);
125
+ if (pos(sc.maxNegativePct) > 0)
126
+ conditions.max_negative_percent_price_change = pos(sc.maxNegativePct);
127
+ conditions.average_price_counted_minutes = avgPriceMinutesOf(sc.avgPriceMinutes);
128
+ return conditions;
129
+ }
130
+ // hedging_engine_type is intentionally not user-configurable yet — no caller
131
+ // exposes anything but 'spot'.
132
+ function hedgingEngineFor(h) {
133
+ const engine = {
134
+ hedging_engine_type: 'spot',
135
+ hedging_exchange: h.exchange,
136
+ average_price_counted_minutes: avgPriceMinutesOf(h.avgPriceMinutes),
137
+ };
138
+ if (pos(h.maxLossThreshold) > 0)
139
+ engine.hedging_max_loss_threshold = pos(h.maxLossThreshold);
140
+ if (pos(h.maxNegativePct) > 0)
141
+ engine.max_negative_percent_price_change = pos(h.maxNegativePct);
142
+ if (pos(h.maxPositivePct) > 0)
143
+ engine.max_positive_percent_price_change = pos(h.maxPositivePct);
144
+ return engine;
145
+ }
146
+ export function buildMarketMakingConfig(input) {
147
+ // num()/pos()/count() everywhere so all fields share one parsing behavior —
148
+ // Number() and parseFloat disagree on partially-numeric strings like '1,000',
149
+ // and the protocol's numeric domains exclude negatives and fractional counts.
150
+ const minSpread = pos(input.spreadBp) / 100;
151
+ const baseSize = pos(input.sizeBase);
152
+ const pair_settings = input.pairs.map((pair) => {
153
+ const budget = input.budgetByPair?.[pair];
154
+ const volume = input.volumeByPair?.[pair];
155
+ const hedging = input.hedgingByPair?.[pair];
156
+ const orderBook = input.orderBookByPair?.[pair];
157
+ const stop_conditions = stopConditionsFor(input.stopsByPair?.[pair]);
158
+ return {
159
+ trading_pair: pair,
160
+ reference_price: refsToProtocol(input.refsByPair[pair], input.exchange, pair),
161
+ min_spread: orderBook ? pos(orderBook.minSpreadBp) / 100 : minSpread,
162
+ max_spread: orderBook ? pos(orderBook.maxSpreadBp) / 100 : minSpread * 2,
163
+ bids_count: orderBook ? count(orderBook.bidsCount) : count(input.perSide),
164
+ asks_count: orderBook ? count(orderBook.asksCount) : count(input.perSide),
165
+ orders_distribution: orderBook?.ordersDistribution ?? 'linear',
166
+ funds_distribution: orderBook?.fundsDistribution ?? fundsDistribution(input.shape),
167
+ ...(orderBook
168
+ ? {
169
+ order_book_depth: {
170
+ cumulated_volume_percent: pos(orderBook.cumulatedVolumePercent),
171
+ percent_daily_trading_volume: pos(orderBook.percentDailyTradingVolume),
172
+ },
173
+ }
174
+ : {}),
175
+ exchange: input.exchange,
176
+ max_base_budget: budget?.enabled ? pos(budget.maxBase) : baseSize,
177
+ ...(budget?.enabled
178
+ ? {
179
+ max_quote_budget: pos(budget.maxQuote),
180
+ min_base_budget: pos(budget.minBase),
181
+ min_quote_budget: pos(budget.minQuote),
182
+ }
183
+ : { max_quote_budget: baseSize }),
184
+ ...(volume?.enabled
185
+ ? {
186
+ scheduled_volume: {
187
+ // Free-text bounds: keep min <= max even if typed inverted.
188
+ min_amount: Math.min(pos(volume.minAmount), pos(volume.maxAmount)),
189
+ max_amount: Math.max(pos(volume.minAmount), pos(volume.maxAmount)),
190
+ min_interval_seconds: Math.min(pos(volume.minIntervalSeconds), pos(volume.maxIntervalSeconds)),
191
+ max_interval_seconds: Math.max(pos(volume.minIntervalSeconds), pos(volume.maxIntervalSeconds)),
192
+ },
193
+ }
194
+ : {}),
195
+ ...(stop_conditions ? { stop_conditions } : {}),
196
+ ...(hedging?.enabled ? { hedging_engine: hedgingEngineFor(hedging) } : {}),
197
+ };
198
+ });
199
+ return { configuration_type: 'market_making', pair_settings };
200
+ }
201
+ /** How many of a `levels`-order ladder sit on the buy side, given where the
202
+ * current price falls in the range (0 = at the lower bound, 100 = at the
203
+ * upper bound). The sell side takes the remainder, so the two always sum to
204
+ * `levels` — that is the whole contract.
205
+ *
206
+ * The index is rounded to 9 decimals before flooring so FP noise in the
207
+ * caller's division can't shift the split by a whole level (e.g.
208
+ * (0.3-0.2)/(0.4-0.2) is 0.49999999999999994, not 0.5).
209
+ *
210
+ * Exported so a caller's own preview UI shows exactly what gets submitted. */
211
+ export function gridBuyCount(positionPct, levels) {
212
+ const ratio = Math.min(1, Math.max(0, positionPct / 100));
213
+ return Math.min(levels, Math.floor(Math.round(ratio * levels * 1e9) / 1e9));
214
+ }
215
+ export function buildGridConfig(input) {
216
+ const symbol = input.pairs[0] ?? '';
217
+ const trailing = {
218
+ enableTrailingUp: input.enableTrailingUp,
219
+ orderByOrderTrailing: input.orderByOrderTrailing,
220
+ };
221
+ // Raw ladder params (advanced mode / edit rehydration) win over the range
222
+ // derivation — the only path that can express flat_spread ≠ flat_increment.
223
+ if (input.flatSpread != null && input.flatIncrement != null
224
+ && input.buyOrdersCount != null && input.sellOrdersCount != null) {
225
+ return {
226
+ configuration_type: 'trading_tentacles',
227
+ name: 'GridTradingMode',
228
+ config: {
229
+ pair_settings: [
230
+ gridPairSettings(symbol, pos(input.flatSpread), pos(input.flatIncrement), count(input.buyOrdersCount), count(input.sellOrdersCount), trailing),
231
+ ],
232
+ },
233
+ };
234
+ }
235
+ const lower = input.lower ?? null;
236
+ const upper = input.upper ?? null;
237
+ const levels = input.levels ?? null;
238
+ // `levels` counts orders, so 1 is a degenerate but representable ladder — an
239
+ // edit rehydrating a 0-buy/1-sell grid must round-trip through here. Only a
240
+ // zero-order ladder is unconfigured.
241
+ if (lower == null || upper == null || levels == null || !(upper > lower) || levels < 1) {
242
+ // Drafts that never visited the strategy step (template path) fall back to
243
+ // a zeroed pair_settings entry rather than inventing a ladder.
244
+ return {
245
+ configuration_type: 'trading_tentacles',
246
+ name: 'GridTradingMode',
247
+ config: { pair_settings: [gridPairSettings(symbol, 0, 0, 0, 0, trailing)] },
248
+ };
249
+ }
250
+ // Ladder step: consecutive same-side orders sit one step apart,
251
+ // quote-denominated. `levels` orders occupy `levels + 1` price lines across
252
+ // the range (the line the current price sits on carries no order), so the
253
+ // range divides into exactly `levels` intervals. A micro-range whose step
254
+ // rounds to zero is unconfigurable — treat as unset.
255
+ const step = round8((upper - lower) / levels);
256
+ if (!(step > 0)) {
257
+ return {
258
+ configuration_type: 'trading_tentacles',
259
+ name: 'GridTradingMode',
260
+ config: { pair_settings: [gridPairSettings(symbol, 0, 0, 0, 0, trailing)] },
261
+ };
262
+ }
263
+ const price = input.currentPrice ?? null;
264
+ // Buys below the current price, sells above — the exact split a preview
265
+ // should display. Out-of-range or missing price → symmetric split.
266
+ const positionPct = price != null && price >= lower && price <= upper
267
+ ? ((price - lower) / (upper - lower)) * 100
268
+ : 50;
269
+ const buyCount = gridBuyCount(positionPct, levels);
270
+ // Spread defaults to 2x the increment (step) — a bare spread == increment
271
+ // ladder has zero profit margin per round-trip.
272
+ return {
273
+ configuration_type: 'trading_tentacles',
274
+ name: 'GridTradingMode',
275
+ config: {
276
+ pair_settings: [
277
+ gridPairSettings(symbol, round8(step * 2), step, buyCount, levels - buyCount, trailing),
278
+ ],
279
+ },
280
+ };
281
+ }
282
+ export function buildDCAConfig(input) {
283
+ const amount = input.buyOrderAmount?.trim();
284
+ return {
285
+ configuration_type: 'trading_tentacles',
286
+ name: 'DCATradingMode',
287
+ config: {
288
+ trigger_mode: DCA_TRIGGER_MODE_TIME_BASED,
289
+ minutes_before_next_buy: Math.max(1, Math.round(num(input.minutesBeforeNextBuy) || DCA_DEFAULTS.minutes_before_next_buy)),
290
+ buy_order_amount: amount || DCA_DEFAULTS.buy_order_amount,
291
+ use_market_entry_orders: input.useMarketEntry ?? DCA_DEFAULTS.use_market_entry_orders,
292
+ entry_limit_orders_price_percent: input.entryLimitPricePercent != null
293
+ ? pos(input.entryLimitPricePercent)
294
+ : DCA_DEFAULTS.entry_limit_orders_price_percent,
295
+ use_take_profit_exit_orders: input.useTakeProfit ?? DCA_DEFAULTS.use_take_profit_exit_orders,
296
+ exit_limit_orders_price_percent: input.exitLimitPricePercent != null
297
+ ? pos(input.exitLimitPricePercent)
298
+ : DCA_DEFAULTS.exit_limit_orders_price_percent,
299
+ trading_pairs: input.pairs,
300
+ },
301
+ };
302
+ }
303
+ export function buildIndexConfig(input) {
304
+ const weights = input.basketWeights ?? {};
305
+ // index_content values are raw relative weights (70/30), not normalised
306
+ // fractions — the node computes each coin's ratio from the sum itself.
307
+ const index_content = input.pairs.map((p) => {
308
+ const symbol = p.includes('/') ? p.split('/')[0] : p;
309
+ return { name: symbol, value: weights[symbol] ?? 0 };
310
+ });
311
+ return {
312
+ configuration_type: 'trading_tentacles',
313
+ name: 'IndexTradingMode',
314
+ config: {
315
+ index_content,
316
+ rebalance_trigger_min_percent: input.rebalanceTriggerPct ?? INDEX_DEFAULTS.rebalance_trigger_min_percent,
317
+ },
318
+ };
319
+ }
320
+ export function buildCopyConfig(input) {
321
+ return { configuration_type: 'copy', strategy_id: input.sourceId ?? '' };
322
+ }
323
+ export function buildSignalConfig(input) {
324
+ const signal = {
325
+ version: 1,
326
+ webhook: { id: input.webhookId, secret: input.webhookSecret },
327
+ pair: input.pair,
328
+ side: {
329
+ mode: input.sideMode,
330
+ ...(input.sideMode === 'payload' && input.sidePayloadField
331
+ ? { payload_field: input.sidePayloadField }
332
+ : {}),
333
+ },
334
+ order: {
335
+ type: input.orderType,
336
+ ...(input.orderType === 'limit'
337
+ ? {
338
+ limit_offset_bp: num(input.limitOffsetBp),
339
+ limit_offset_direction: input.limitOffsetDir ?? 'below',
340
+ }
341
+ : {}),
342
+ },
343
+ size: { mode: input.sizeMode, value: num(input.sizeValue) },
344
+ ...(input.tpEnabled ? { take_profit_percent: num(input.tpPct) } : {}),
345
+ ...(input.slEnabled ? { stop_loss_percent: num(input.slPct) } : {}),
346
+ };
347
+ return { configuration_type: 'generic_process', profile_data: { signal } };
348
+ }
349
+ // Validates every field the inverse reads unguarded — a partial payload from
350
+ // a foreign producer or older schema must fall through to 'custom', not throw
351
+ // (or worse: round-trip an undefined webhook secret into a re-emitted config).
352
+ export function isSignalProfileData(data) {
353
+ const signal = data?.signal;
354
+ return typeof signal?.webhook?.id === 'string'
355
+ && typeof signal.webhook.secret === 'string'
356
+ && typeof signal.pair === 'string'
357
+ && typeof signal.side?.mode === 'string'
358
+ && typeof signal.order?.type === 'string'
359
+ && typeof signal.size?.mode === 'string'
360
+ && typeof signal.size.value === 'number';
361
+ }
362
+ export function signalProfileDataToInput(data) {
363
+ const s = data.signal;
364
+ return {
365
+ webhookId: s.webhook.id,
366
+ webhookSecret: s.webhook.secret,
367
+ pair: s.pair,
368
+ sideMode: s.side.mode,
369
+ ...(s.side.payload_field ? { sidePayloadField: s.side.payload_field } : {}),
370
+ orderType: s.order.type,
371
+ ...(s.order.limit_offset_bp != null ? { limitOffsetBp: s.order.limit_offset_bp } : {}),
372
+ ...(s.order.limit_offset_direction ? { limitOffsetDir: s.order.limit_offset_direction } : {}),
373
+ sizeMode: s.size.mode,
374
+ sizeValue: s.size.value,
375
+ ...(s.take_profit_percent != null ? { tpEnabled: true, tpPct: s.take_profit_percent } : {}),
376
+ ...(s.stop_loss_percent != null ? { slEnabled: true, slPct: s.stop_loss_percent } : {}),
377
+ };
378
+ }
379
+ export function buildGenericProcessConfig() {
380
+ return { configuration_type: 'generic_process', profile_data: {} };
381
+ }
382
+ //# sourceMappingURL=builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.js","sourceRoot":"","sources":["../../../src/protocol/strategy/builders.ts"],"names":[],"mappings":"AAoMA,uFAAuF;A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,EAAM,CAAC,CAAC,IAAI,CAAC,KAAK;QAC3B,GAAG,CAAC,CAAC,CAAC,mBAAmB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,GAAG,CAAC,CAAC,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxF,CAAA;AACH,CAAC;AAmBD,MAAM,UAAU,yBAAyB;IACvC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,EAA2B,EAAE,CAAA;AAC7F,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { StrategyKind } from './kinds.js';
2
+ export { buildMarketMakingConfig, buildGridConfig, gridBuyCount, buildDCAConfig, buildIndexConfig, buildCopyConfig, buildSignalConfig, buildGenericProcessConfig, isSignalProfileData, signalProfileDataToInput, formatDcaAmount, parseDcaAmount, DCA_TRIGGER_MODE_TIME_BASED, DCA_DEFAULTS, GRID_INPUT_DEFAULTS, INDEX_DEFAULTS, type MmRefInput, type MmBudgetPairInput, type MmStopsPairInput, type MmVolumePairInput, type MmHedgingPairInput, type MmOrderBookPairInput, type MmInput, type MmInputPatch, type GridLadderGeometry, type GridInput, type DcaInput, type DcaAmountUnit, type IndexInput, type CopyInput, type SignalInput, type SignalProfileData, } from './builders.js';
3
+ export { buildStrategy, referenceMarketOf, type StrategyInput, type BuildStrategyOptions, } from './build.js';
4
+ export { protocolStrategyToInput, bumpStrategyPatchVersion, type StrategyInputPatch, type GridGeometryPatch, type DcaPatch, } from './patch.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocol/strategy/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,GACd,MAAM,YAAY,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { buildMarketMakingConfig, buildGridConfig, gridBuyCount, buildDCAConfig, buildIndexConfig, buildCopyConfig, buildSignalConfig, buildGenericProcessConfig, isSignalProfileData, signalProfileDataToInput, formatDcaAmount, parseDcaAmount, DCA_TRIGGER_MODE_TIME_BASED, DCA_DEFAULTS, GRID_INPUT_DEFAULTS, INDEX_DEFAULTS, } from './builders.js';
2
+ export { buildStrategy, referenceMarketOf, } from './build.js';
3
+ export { protocolStrategyToInput, bumpStrategyPatchVersion, } from './patch.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/protocol/strategy/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,YAAY,EACZ,mBAAmB,EACnB,cAAc,GAiBf,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,iBAAiB,GAGlB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GAIzB,MAAM,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export type StrategyKind = 'dca' | 'basket' | 'grid' | 'mm' | 'copy' | 'signal' | 'custom' | 'ai-agents';
2
+ //# sourceMappingURL=kinds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../src/protocol/strategy/kinds.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=kinds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../../src/protocol/strategy/kinds.ts"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ import type { Strategy } from '@drakkar.software/octobot-protocol';
2
+ import { type MmInputPatch, type IndexInput, type CopyInput, type SignalInput, type MmRefInput } from './builders.js';
3
+ /** Grid ladder geometry recovered from a protocol config. The absolute price
4
+ * bounds are not stored in GridConfiguration — an edit UI renders this raw
5
+ * geometry directly (advanced mode) and derives display bounds from the
6
+ * live price. */
7
+ export type GridGeometryPatch = {
8
+ spread: number;
9
+ increment: number;
10
+ buyCount: number;
11
+ sellCount: number;
12
+ levels: number;
13
+ enableTrailingUp: boolean;
14
+ orderByOrderTrailing: boolean;
15
+ };
16
+ export type DcaPatch = {
17
+ /** Verbatim protocol amount string ('10%t' / '25q' / '0.1'). */
18
+ buyOrderAmount: string;
19
+ minutesBeforeNextBuy: number;
20
+ useMarketEntry: boolean;
21
+ entryLimitPricePercent: number;
22
+ useTakeProfit: boolean;
23
+ exitLimitPricePercent: number;
24
+ };
25
+ export type StrategyInputPatch = ({
26
+ kind: 'mm';
27
+ mm: MmInputPatch;
28
+ pairs: string[];
29
+ refsByPair: Record<string, MmRefInput[]>;
30
+ } | {
31
+ kind: 'grid';
32
+ pairs: string[];
33
+ grid: GridGeometryPatch | null;
34
+ } | {
35
+ kind: 'dca';
36
+ pairs: string[];
37
+ dca: DcaPatch | null;
38
+ } | {
39
+ kind: 'basket';
40
+ pairs: string[];
41
+ basket: IndexInput;
42
+ } | {
43
+ kind: 'copy';
44
+ copy: CopyInput;
45
+ } | {
46
+ kind: 'signal';
47
+ signal: SignalInput;
48
+ } | {
49
+ kind: 'custom';
50
+ });
51
+ /** Recover an editable `StrategyInputPatch` from a protocol `Strategy`. The
52
+ * inverse of `buildStrategy` in ./build.ts, tolerant of configs written by
53
+ * older or foreign clients (never throws — unrecognized shapes fall to
54
+ * `{ kind: 'custom' }`). */
55
+ export declare function protocolStrategyToInput(strategy: Strategy): StrategyInputPatch;
56
+ /** Bump a semver-ish `MAJOR.MINOR.PATCH` string's patch component by one,
57
+ * zero-filling any missing component. */
58
+ export declare function bumpStrategyPatchVersion(version: string): string;
59
+ //# sourceMappingURL=patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/protocol/strategy/patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAKL,KAAK,YAAY,EAMjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAA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