dexbot 1.6.13 → 1.6.15

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 (114) hide show
  1. package/CHANGELOG.md +66 -4
  2. package/README.md +2 -2
  3. package/analysis/README.md +6 -6
  4. package/analysis/tradingview/README.md +2 -1
  5. package/claw/README.md +7 -7
  6. package/claw/docs/AI_BOT_LIBRARY_API.md +1 -1
  7. package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
  8. package/claw/modules/claw_catalog.ts +8 -4
  9. package/claw/modules/dexbot_profiles.ts +59 -15
  10. package/claw/modules/types.ts +2 -1
  11. package/claw/package.json +1 -1
  12. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  13. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  14. package/claw/skills/margin-trading/SKILL.md +1 -1
  15. package/claw/skills/margin-trading/references/position-management.md +1 -1
  16. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +105 -31
  17. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +36 -2
  18. package/dist/dexbot.js +23 -3
  19. package/dist/market_adapter/core/strategies/dynamic_weight_series.js +26 -11
  20. package/dist/modules/account_bots.d.ts +10 -6
  21. package/dist/modules/account_bots.js +13 -10
  22. package/dist/modules/account_orders.d.ts +36 -4
  23. package/dist/modules/account_orders.js +76 -5
  24. package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
  25. package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
  26. package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
  27. package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
  28. package/dist/modules/bitshares-native/subscriptions.js +1 -1
  29. package/dist/modules/bot_defaults.d.ts +29 -4
  30. package/dist/modules/bot_defaults.js +65 -10
  31. package/dist/modules/bot_settings.d.ts +4 -0
  32. package/dist/modules/bot_settings.js +58 -21
  33. package/dist/modules/config.js +6 -1
  34. package/dist/modules/constants.d.ts +13 -5
  35. package/dist/modules/constants.js +36 -5
  36. package/dist/modules/credit_runtime.d.ts +35 -5
  37. package/dist/modules/credit_runtime.js +219 -38
  38. package/dist/modules/dexbot_class.d.ts +23 -0
  39. package/dist/modules/dexbot_class.js +60 -17
  40. package/dist/modules/dexbot_cow_runtime.d.ts +62 -174
  41. package/dist/modules/dexbot_cow_runtime.js +350 -64
  42. package/dist/modules/dexbot_credential_client.d.ts +1 -16
  43. package/dist/modules/dexbot_credential_client.js +1 -1
  44. package/dist/modules/dexbot_fill_runtime.d.ts +2 -2
  45. package/dist/modules/dexbot_fill_runtime.js +16 -8
  46. package/dist/modules/dexbot_maintenance_runtime.d.ts +24 -81
  47. package/dist/modules/dexbot_maintenance_runtime.js +104 -70
  48. package/dist/modules/dexbot_startup_runtime.js +15 -2
  49. package/dist/modules/dexbot_state_recovery.js +17 -1
  50. package/dist/modules/key_store.d.ts +0 -5
  51. package/dist/modules/key_store.js +1 -1
  52. package/dist/modules/order/accounting.js +11 -11
  53. package/dist/modules/order/export.js +4 -4
  54. package/dist/modules/order/format.d.ts +15 -1
  55. package/dist/modules/order/format.js +19 -1
  56. package/dist/modules/order/genesis_policy.d.ts +1 -1
  57. package/dist/modules/order/genesis_policy.js +1 -1
  58. package/dist/modules/order/grid.d.ts +141 -12
  59. package/dist/modules/order/grid.js +666 -92
  60. package/dist/modules/order/grid_reconcile.d.ts +1 -1
  61. package/dist/modules/order/grid_reconcile.js +9 -8
  62. package/dist/modules/order/grid_reconcile_internal.js +61 -58
  63. package/dist/modules/order/index.d.ts +37 -9
  64. package/dist/modules/order/logger.js +2 -2
  65. package/dist/modules/order/manager.d.ts +10 -2
  66. package/dist/modules/order/manager.js +56 -31
  67. package/dist/modules/order/strategy.d.ts +2 -2
  68. package/dist/modules/order/strategy.js +51 -21
  69. package/dist/modules/order/sync_engine.js +22 -9
  70. package/dist/modules/order/utils/math.d.ts +101 -29
  71. package/dist/modules/order/utils/math.js +215 -84
  72. package/dist/modules/order/utils/order.d.ts +58 -58
  73. package/dist/modules/order/utils/order.js +135 -106
  74. package/dist/modules/order/utils/system.d.ts +193 -6
  75. package/dist/modules/order/utils/system.js +394 -31
  76. package/dist/modules/order/utils/validate.d.ts +1 -1
  77. package/dist/modules/order/utils/validate.js +71 -59
  78. package/dist/modules/runtime_settings.d.ts +1 -1
  79. package/dist/modules/runtime_settings.js +3 -3
  80. package/dist/modules/types.d.ts +55 -4
  81. package/dist/scripts/analyze-credit.js +44 -27
  82. package/dist/scripts/analyze-orders.d.ts +1 -1
  83. package/dist/scripts/analyze-orders.js +4 -4
  84. package/dist/scripts/diagnose-pool-history.js +35 -30
  85. package/dist/scripts/divergence-calc.js +6 -6
  86. package/dist/scripts/pnl.js +1 -1
  87. package/dist/scripts/rich_list.d.ts +18 -0
  88. package/dist/scripts/rich_list.js +461 -0
  89. package/dist/scripts/run-tests.js +80 -4
  90. package/dist/scripts/validate_bots.d.ts +1 -1
  91. package/dist/scripts/validate_bots.js +3 -3
  92. package/dist/unlock.d.ts +2 -1
  93. package/dist/unlock.js +11 -5
  94. package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -2
  95. package/docs/COW_INVARIANTS.md +12 -6
  96. package/docs/DEXBOT_COMPARISON.md +7 -7
  97. package/docs/EVOLUTION.md +10 -8
  98. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
  99. package/docs/GRID_PRICE_INVARIANT.md +3 -3
  100. package/docs/GRID_RECALCULATION.md +4 -1
  101. package/docs/GRID_RECONCILE.md +4 -4
  102. package/docs/LIFECYCLE.md +11 -11
  103. package/docs/LOGGING.md +30 -1
  104. package/docs/MPA_CREDIT_USAGE.md +11 -6
  105. package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +170 -12
  106. package/docs/README.md +3 -3
  107. package/docs/WORKFLOW.md +1 -0
  108. package/docs/architecture.md +62 -8
  109. package/docs/developer_guide.md +12 -3
  110. package/market_adapter/README.md +4 -4
  111. package/modules/README.md +1 -1
  112. package/package.json +2 -1
  113. package/scripts/README.md +59 -32
  114. package/tests/README.md +12 -3
@@ -60,13 +60,13 @@
60
60
  * - getOrderSize(order) - Extract order size with fallback
61
61
  *
62
62
  * SECTION 10: STRATEGY CALCULATIONS (7 functions)
63
- * - resolveReserveCount(config, side) - Clamped per-side reserve count (>=0 int, 0 disables)
64
- * - resolveReserveOrders(config) - Total reserves buy+sell (fee/count totals)
65
- * - resolveLiveReserveEdgeAnchorPrice(manager, side) - Live-grid edge anchor (genesis ladder extreme; null when no usable ladder)
66
- * - resolveReserveEdgeAnchorPrice(config, side) - Config-bound anchor fallback (buy→minPrice, sell→maxPrice; null when unresolvable)
67
- * - compareReserveEdge(a, b, edge, anchorPrice) - Shared anchored edge comparator (single ordering source)
68
- * - reserveEdgeIdSet(allSlots, config, orderType, anchorPrice?, excludeIds?) - Edge reserve id set (config count; shares the picker ordering; excludeIds carries the window exclusion)
69
- * - selectReserveEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice?) - Shared position picker (both edges anchor toward their bound)
63
+ * - resolveEdgeCount(config, side) - Clamped per-side edge count (>=0 int, 0 disables)
64
+ * - resolveEdgeOrders(config) - Total edge orders buy+sell (fee/count totals)
65
+ * - resolveLiveEdgeAnchorPrice(manager, side) - Live-grid edge anchor (genesis ladder extreme; null when no usable ladder)
66
+ * - resolveEdgeAnchorPrice(config, side) - Config-bound anchor fallback (buy→minPrice, sell→maxPrice; null when unresolvable)
67
+ * - compareEdge(a, b, edge, anchorPrice) - Shared anchored edge comparator (single ordering source)
68
+ * - edgeOrderIdSet(allSlots, config, orderType, anchorPrice?, excludeIds?) - Edge order id set (config count; shares the picker ordering; excludeIds carries the window exclusion)
69
+ * - selectEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice?) - Shared position picker (both edges anchor toward their bound)
70
70
  *
71
71
  * ===============================================================================
72
72
  */
@@ -875,13 +875,13 @@ interface DeltaAction {
875
875
  orderId?: string | null;
876
876
  [key: string]: unknown;
877
877
  }
878
- interface ReserveConfig {
879
- reserveOrders?: number | {
878
+ interface OrderConfigView {
879
+ edgeOrders?: number | {
880
880
  buy?: number;
881
881
  sell?: number;
882
882
  [key: string]: unknown;
883
883
  };
884
- activeOrders?: {
884
+ coreOrders?: {
885
885
  buy?: number;
886
886
  sell?: number;
887
887
  [key: string]: unknown;
@@ -1015,7 +1015,7 @@ declare function deriveTargetBoundary(fills: Array<{
1015
1015
  }> | null | undefined, currentBoundaryIdx: number | null | undefined, allSlots: ManagedOrder[], config: {
1016
1016
  startPrice?: number | string;
1017
1017
  genesisStartPrice?: number | string;
1018
- activeOrders?: {
1018
+ coreOrders?: {
1019
1019
  buy?: number;
1020
1020
  sell?: number;
1021
1021
  [key: string]: unknown;
@@ -1058,56 +1058,56 @@ export declare function consumePendingFillCrawls(manager: OrderManagerLike): {
1058
1058
  reason?: string;
1059
1059
  };
1060
1060
  /**
1061
- * Per-side reserve count (edge-pinned fat-finger insurance orders).
1062
- * Buy reserves pin at the grid floor, sell reserves at the grid ceiling.
1061
+ * Per-side edge count (edge-pinned fat-finger insurance orders).
1062
+ * Buy edges pin at the grid floor, sell edges at the grid ceiling.
1063
1063
  * Non-finite/non-integer/negative values disable (0).
1064
1064
  *
1065
- * The legacy numeric form (`reserveOrders: n`) is migrated here at read time
1065
+ * The legacy numeric form (`edgeOrders: n`) is migrated here at read time
1066
1066
  * to `{ buy: n, sell: 0 }`: the editor seeder rewrites the persisted JSON, but
1067
- * a hand-edited bots.json that bypassed the editor must not have its reserve
1067
+ * a hand-edited bots.json that bypassed the editor must not have its edge
1068
1068
  * count silently read as 0.
1069
1069
  *
1070
1070
  * @param {Object} config - Bot configuration
1071
1071
  * @param {string} side - 'buy' or 'sell'
1072
- * @returns {number} Reserve count for the side (>= 0 integer)
1072
+ * @returns {number} Edge count for the side (>= 0 integer)
1073
1073
  */
1074
- declare function resolveReserveCount(config: ReserveConfig | null | undefined, side: string): number;
1074
+ declare function resolveEdgeCount(config: OrderConfigView | null | undefined, side: string): number;
1075
1075
  /**
1076
- * Total reserve count across both sides (fee/count totals).
1076
+ * Total edge count across both sides (fee/count totals).
1077
1077
  *
1078
1078
  * @param {Object} config - Bot configuration
1079
- * @returns {number} Total reserves (buy + sell)
1079
+ * @returns {number} Total edges (buy + sell)
1080
1080
  */
1081
- declare function resolveReserveOrders(config: ReserveConfig | null | undefined): number;
1081
+ declare function resolveEdgeOrders(config: OrderConfigView | null | undefined): number;
1082
1082
  /**
1083
- * Edge-pinned reserve id set for one side, or null when disabled.
1083
+ * Edge-pinned order id set for one side, or null when disabled.
1084
1084
  * Type/price-filtered, then ordered by the SAME edge order the placement
1085
- * pickers use (compareReserveEdge via selectReserveEdgeSlots) — single source
1085
+ * pickers use (compareEdge via selectEdgeSlots) — single source
1086
1086
  * of truth, so the no-crawl classification can never drift from placement.
1087
1087
  * Anchor: explicit live-grid edge when supplied, otherwise the config-bound
1088
1088
  * fallback (unresolved -> plain rank). Shelf/manual ids (non-slot-N, e.g.
1089
- * fork-kept deep-* orders below the rail) are never reserves: they would
1089
+ * fork-kept deep-* orders below the rail) are never edge orders: they would
1090
1090
  * otherwise win the cheapest-first rank and poison the deficit check while
1091
1091
  * the shelf is live (issue #27 follow-up). No-op upstream (grids only mint
1092
1092
  * slot-N).
1093
1093
  *
1094
1094
  * @param {Array<Object>} allSlots - All grid slots (need id/price/type)
1095
- * @param {Object} config - Bot configuration (reserve count source)
1095
+ * @param {Object} config - Bot configuration (edge count source)
1096
1096
  * @param {string} orderType - ORDER_TYPES.BUY (floor) or SELL (ceiling)
1097
1097
  * @param {number|null} [anchorPrice] - Explicit edge anchor (live grid edge);
1098
1098
  * callers that picked slots must pass the SAME anchor so no-crawl
1099
1099
  * classification matches placement. NB: null/undefined falls back to the
1100
1100
  * config-bound anchor (unresolved -> plain rank) — unlike
1101
- * selectReserveEdgeSlots, where null alone means plain rank.
1101
+ * selectEdgeSlots, where null alone means plain rank.
1102
1102
  * @param {Set<string>|null} [excludeIds] - Windowed ids to skip (same set the
1103
1103
  * placement pickers exclude). Window + edge are additive in every target
1104
1104
  * (order counts, fees, hold-back), so a window that reaches the grid edge
1105
1105
  * (e.g. a keep-low window sitting on the floor) must not let the edge pick
1106
1106
  * land on window members — otherwise counting reads N/N with zero
1107
- * dedicated reserves and the deficit never fires (issue #27 follow-up).
1107
+ * dedicated edge orders and the deficit never fires (issue #27 follow-up).
1108
1108
  * @returns {Set<string>|null} Edge slot ids, or null when side disabled
1109
1109
  */
1110
- declare function reserveEdgeIdSet(allSlots: SlotLike[], config: ReserveConfig | null | undefined, orderType: OrderType, anchorPrice?: unknown, excludeIds?: Set<string> | null): Set<string> | null;
1110
+ declare function edgeOrderIdSet(allSlots: SlotLike[], config: OrderConfigView | null | undefined, orderType: OrderType, anchorPrice?: unknown, excludeIds?: Set<string> | null): Set<string> | null;
1111
1111
  /**
1112
1112
  * Window member ids for one side from the live manager (see
1113
1113
  * windowIdSetFromSlots). Delegates so the manager and explicit-geometry
@@ -1130,29 +1130,29 @@ declare function liveWindowIdSet(manager: OrderManagerLike, orderType: OrderType
1130
1130
  *
1131
1131
  * - CREATE ids of the plan (the slots a fold did not convert into an
1132
1132
  * UPDATE), minus
1133
- * - reserve-ladder ids. Reserves are static edge insurance; their fills
1133
+ * - edge-ladder ids. Edge orders are static edge insurance; their fills
1134
1134
  * never crawl (deriveTargetBoundary filters them), so a guard-skipped
1135
- * reserve must not pin geometry either. Without this exclusion a reserve
1135
+ * edge order must not pin geometry either. Without this exclusion an edge order
1136
1136
  * CREATE skipped at the wrong moment (e.g. a floor BUY above the last-fill
1137
1137
  * pivot while the market dumps below the grid) would hold the boundary for
1138
1138
  * a cycle although nothing was stranded.
1139
1139
  *
1140
- * Absent/disabled reserves or an empty action list yield the plain CREATE ids,
1141
- * so callers that never configured reserves keep the previous behavior.
1140
+ * Absent/disabled edge orders or an empty action list yield the plain CREATE ids,
1141
+ * so callers that never configured edge orders keep the previous behavior.
1142
1142
  *
1143
1143
  * @param {Array<Object>} actions - Optimized COW actions
1144
1144
  * @param {Object} [options]
1145
- * @param {Object} [options.config] - Bot configuration (reserve count source)
1146
- * @param {Iterable<Object>} [options.slots] - Master slots (reserve classification)
1145
+ * @param {Object} [options.config] - Bot configuration (edge count source)
1146
+ * @param {Iterable<Object>} [options.slots] - Master slots (edge classification)
1147
1147
  * @param {{buy?: number|null, sell?: number|null}} [options.edgeAnchors] - Live
1148
- * edge anchors (same pair the strategy classifies reserve fills against)
1148
+ * edge anchors (same pair the strategy classifies edge fills against)
1149
1149
  * @param {unknown} [options.manager] - OrderManager for the window exclusion (same
1150
1150
  * set the placement pickers exclude); omit to fall back to the previous
1151
1151
  * exclusion-free classification (fail-open)
1152
- * @returns {string[]} Refill slot ids (CREATE ids minus reserve edge ids)
1152
+ * @returns {string[]} Refill slot ids (CREATE ids minus edge ids)
1153
1153
  */
1154
1154
  declare function collectRefillSlotIds(actions: CowAction[], options?: {
1155
- config?: ReserveConfig | null;
1155
+ config?: OrderConfigView | null;
1156
1156
  slots?: unknown;
1157
1157
  edgeAnchors?: {
1158
1158
  buy?: number | null;
@@ -1161,7 +1161,7 @@ declare function collectRefillSlotIds(actions: CowAction[], options?: {
1161
1161
  manager?: OrderManagerLike | null;
1162
1162
  }): string[];
1163
1163
  /**
1164
- * Resolved bound anchor for reserve edges from CONFIG alone.
1164
+ * Resolved bound anchor for edges from CONFIG alone.
1165
1165
  * BUY floor anchors toward minPrice (dip-insurance end), SELL ceiling toward
1166
1166
  * maxPrice (spike-insurance end). Resolves numeric and "Nx" relative forms
1167
1167
  * via resolveConfiguredPriceBound (startPrice-referenced); falls back to the
@@ -1169,18 +1169,18 @@ declare function collectRefillSlotIds(actions: CowAction[], options?: {
1169
1169
  *
1170
1170
  * Known limit: this is the statically resolved config bound, not the
1171
1171
  * gridPrice/AMA-referenced live rail bound. Placement call sites should use
1172
- * resolveLiveReserveEdgeAnchorPrice(manager, side), which prefers the genesis
1172
+ * resolveLiveEdgeAnchorPrice(manager, side), which prefers the genesis
1173
1173
  * ladder extreme and returns null when there is no usable ladder. Callers that
1174
- * need a fallback (e.g. reserveEdgeIdSet) still resolve this config bound when
1174
+ * need a fallback (e.g. edgeOrderIdSet) still resolve this config bound when
1175
1175
  * the live anchor is null; the live resolver itself no longer computes it.
1176
1176
  *
1177
1177
  * @param {Object} config - Bot configuration
1178
1178
  * @param {string} side - 'buy' or 'sell'
1179
1179
  * @returns {number|null} Finite anchor price, or null
1180
1180
  */
1181
- declare function resolveReserveEdgeAnchorPrice(config: ReserveConfig | null | undefined, side: string): number | null;
1182
- /** Manager surface the live reserve-edge anchor reads (structural view). */
1183
- type ReserveEdgeAnchorManager = {
1181
+ declare function resolveEdgeAnchorPrice(config: OrderConfigView | null | undefined, side: string): number | null;
1182
+ /** Manager surface the live edge anchor reads (structural view). */
1183
+ type EdgeAnchorManager = {
1184
1184
  _genesis?: {
1185
1185
  priceLevels?: readonly unknown[];
1186
1186
  } | null;
@@ -1192,7 +1192,7 @@ type ReserveEdgeAnchorManager = {
1192
1192
  config?: unknown;
1193
1193
  };
1194
1194
  /**
1195
- * Live-grid reserve edge anchor (single source for edge placement).
1195
+ * Live-grid edge anchor (single source for edge placement).
1196
1196
  *
1197
1197
  * The anchor must come from the geometry the bot is actually trading, never
1198
1198
  * from a config value that can be a mode string ("pool"/"book"), a relative
@@ -1210,7 +1210,7 @@ type ReserveEdgeAnchorManager = {
1210
1210
  * paper over. The former tiers — the live in-rail slot extreme and the resolved
1211
1211
  * config bound — are gone with the legacy matcher they only existed to cover;
1212
1212
  * any config-bound fallback is now resolved by the individual consumer that
1213
- * wants one (see reserveEdgeIdSet), not by this live-edge resolver. The fault
1213
+ * wants one (see edgeOrderIdSet), not by this live-edge resolver. The fault
1214
1214
  * itself is reported
1215
1215
  * once per grid generation by the sync-entry gate; this resolver stays silent
1216
1216
  * because it is called from per-fill and per-placement paths.
@@ -1219,9 +1219,9 @@ type ReserveEdgeAnchorManager = {
1219
1219
  * @param {string} side - 'buy' or 'sell'
1220
1220
  * @returns {number|null} Finite anchor price, or null
1221
1221
  */
1222
- declare function resolveLiveReserveEdgeAnchorPrice(manager: ReserveEdgeAnchorManager | null | undefined, side: unknown): number | null;
1222
+ declare function resolveLiveEdgeAnchorPrice(manager: EdgeAnchorManager | null | undefined, side: unknown): number | null;
1223
1223
  /**
1224
- * Shared anchored edge comparator for reserve selection (single source).
1224
+ * Shared anchored edge comparator for edge selection (single source).
1225
1225
  * With a finite anchor: in-bound slots first, nearest the anchor first
1226
1226
  * (floor ascending, ceiling descending); stale out-of-bound slots last,
1227
1227
  * still nearest the anchor first. Without one: plain rank fallback
@@ -1233,36 +1233,36 @@ declare function resolveLiveReserveEdgeAnchorPrice(manager: ReserveEdgeAnchorMan
1233
1233
  * @param {number|null} anchorPrice - Resolved bound anchor (null = rank fallback)
1234
1234
  * @returns {number} Comparator result for Array.prototype.sort
1235
1235
  */
1236
- declare function compareReserveEdge(a: SlotLike, b: SlotLike, edge: string, anchorPrice: number | null): number;
1236
+ declare function compareEdge(a: SlotLike, b: SlotLike, edge: string, anchorPrice: number | null): number;
1237
1237
  /**
1238
- * Central edge selector: take reserve slots from a price-ascending list,
1238
+ * Central edge selector: take edge slots from a price-ascending list,
1239
1239
  * skipping already-windowed ids. Both edges anchor at the live grid's own
1240
- * edge (resolveLiveReserveEdgeAnchorPrice) when finite — floor: nearest
1240
+ * edge (resolveLiveEdgeAnchorPrice) when finite — floor: nearest
1241
1241
  * at/above the live floor first, slots below it rank last; ceiling: nearest
1242
1242
  * at/below the live ceiling first, slots above it rank last. Anchoring to the
1243
- * live edge keeps the reserve on genuine live-rail slots when the grid still
1243
+ * live edge keeps the edge order on genuine live-rail slots when the grid still
1244
1244
  * carries leftovers from an older bound or the configured bound disagrees
1245
1245
  * with the geometry being traded. Callers pre-filter rail/type and apply
1246
1246
  * their own size gates; this only picks positions. A null anchor degrades to
1247
1247
  * plain rank (floor: lowest first; ceiling: highest first).
1248
1248
  *
1249
1249
  * @param {Array<Object>} sortedAsc - Slots sorted by price ascending
1250
- * @param {number} count - Reserve count
1250
+ * @param {number} count - Edge count
1251
1251
  * @param {Set<string>|null} excludeIds - Windowed ids to skip
1252
1252
  * @param {string} edge - 'floor' or 'ceiling'
1253
1253
  * @param {number|null} [anchorPrice] - Live edge anchor for the side (null = rank-based)
1254
- * @returns {Array<Object>} Reserve slots (ascending for floor, descending for ceiling)
1254
+ * @returns {Array<Object>} Edge slots (ascending for floor, descending for ceiling)
1255
1255
  */
1256
- declare function selectReserveEdgeSlots<T extends SlotLike>(sortedAsc: T[], count: number, excludeIds: Set<string> | null, edge: string, anchorPrice?: number | null): T[];
1256
+ declare function selectEdgeSlots<T extends SlotLike>(sortedAsc: T[], count: number, excludeIds: Set<string> | null, edge: string, anchorPrice?: number | null): T[];
1257
1257
  /**
1258
1258
  * Total target order count across both sides (used for BTS fee calculation).
1259
1259
  * Single source of truth so every budget derivation sizes identically.
1260
- * Includes per-side reserves: they rest live on-chain and pay creation fees.
1260
+ * Includes per-side edge orders: they rest live on-chain and pay creation fees.
1261
1261
  *
1262
1262
  * @param {Object} config - Bot configuration
1263
1263
  * @returns {number} Total target order count
1264
1264
  */
1265
- declare function getActiveOrdersTotal(config: ReserveConfig | null | undefined): number;
1265
+ declare function getCoreOrdersTotal(config: OrderConfigView | null | undefined): number;
1266
1266
  /**
1267
1267
  * Calculate side budget after BTS fee deduction.
1268
1268
  *
@@ -1272,7 +1272,7 @@ declare function getActiveOrdersTotal(config: ReserveConfig | null | undefined):
1272
1272
  * @param {number} totalTarget - Total target order count (used for BTS fee calculation on both sides)
1273
1273
  * @returns {number} Available budget for the side
1274
1274
  */
1275
- declare function getSideBudget(side: string, funds: ManagerFundsLike | ProjectedFunds | null, config: ReserveConfig, totalTarget: number): number;
1275
+ declare function getSideBudget(side: string, funds: ManagerFundsLike | ProjectedFunds | null, config: OrderConfigView, totalTarget: number): number;
1276
1276
  /**
1277
1277
  * Calculate sizes for all slots on a side using weighted distribution.
1278
1278
  *
@@ -1358,6 +1358,6 @@ declare function collectKnownOnChainOrderIds(mgr: OrderManagerLike, placedResult
1358
1358
  createIds: string[];
1359
1359
  all: string[];
1360
1360
  };
1361
- export { parseChainOrder, applyChainSizeToGridOrder, buildFillKey, correctOrderPriceOnChain, correctAllPriceMismatches, _validatePriceCorrectionEntry, _stampCorrectionProvenance, findLiveOrderOwnerByChainId, buildCreateOrderArgs, getOrderTypeFromUpdatedFlags, resolveConfiguredPriceBound, virtualizeOrder, convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, detectGapEvacuationCandidates, updateGapEvacuationStreaks, resolveSpreadOrderSide, chainOrderMatchesSlot, chainOrderMatchesSlotWithTolerance, crossingCandidateChainId, isCrossingCheckCandidate, buildCrossingCheckCandidates, parseSlotIndex, filterOrdersByType, buildOutsideInPairGroups, extractBatchOperationResults, formatUnmatchedChainOrder, isNonBlockingUnmatchedOrder, isStrandedHoldOrder, isOrderOnChain, isOrderVirtual, hasOnChainId, isOrderPlaced, isPhantomOrder, isSlotAvailable, isEmptyGridSlot, isOrderHealthy, checkSizeThreshold, checkSizesBeforeMinimum, calculateIdealBoundary, assignGridRoles, resolveOnChainRetypeType, shouldFlagOutOfSpread, buildIndexes, validateIndexes, ordersEqual, buildDelta, deriveTargetBoundary, isShiftEligibleFill, resolveReserveCount, resolveReserveOrders, selectReserveEdgeSlots, getActiveOrdersTotal, getSideBudget, calculateBudgetedSizes, buildCreateOpFingerprint, isOrderGoneErrorMessage, recordDuplicateOrphanDetection, clearDuplicateOrphanDetection, duplicateOrphanLogInfo, chainOrderUnchangedFromCache, detectCrossedBookPlan, collectKnownOnChainOrderIds, reserveEdgeIdSet, liveWindowIdSet, checkGridPriceInvariant, reportGridPriceInvariant };
1362
- export { resolveReserveEdgeAnchorPrice, resolveLiveReserveEdgeAnchorPrice, compareReserveEdge, collectRefillSlotIds, recordOrderPlacement, isFreshlyPlacedOrder, _filterUnmatchedChainOrders };
1361
+ export { parseChainOrder, applyChainSizeToGridOrder, buildFillKey, correctOrderPriceOnChain, correctAllPriceMismatches, _validatePriceCorrectionEntry, _stampCorrectionProvenance, findLiveOrderOwnerByChainId, buildCreateOrderArgs, getOrderTypeFromUpdatedFlags, resolveConfiguredPriceBound, virtualizeOrder, convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, detectGapEvacuationCandidates, updateGapEvacuationStreaks, resolveSpreadOrderSide, chainOrderMatchesSlot, chainOrderMatchesSlotWithTolerance, crossingCandidateChainId, isCrossingCheckCandidate, buildCrossingCheckCandidates, parseSlotIndex, filterOrdersByType, buildOutsideInPairGroups, extractBatchOperationResults, formatUnmatchedChainOrder, isNonBlockingUnmatchedOrder, isStrandedHoldOrder, isOrderOnChain, isOrderVirtual, hasOnChainId, isOrderPlaced, isPhantomOrder, isSlotAvailable, isEmptyGridSlot, isOrderHealthy, checkSizeThreshold, checkSizesBeforeMinimum, calculateIdealBoundary, assignGridRoles, resolveOnChainRetypeType, shouldFlagOutOfSpread, buildIndexes, validateIndexes, ordersEqual, buildDelta, deriveTargetBoundary, isShiftEligibleFill, resolveEdgeCount, resolveEdgeOrders, selectEdgeSlots, getCoreOrdersTotal, getSideBudget, calculateBudgetedSizes, buildCreateOpFingerprint, isOrderGoneErrorMessage, recordDuplicateOrphanDetection, clearDuplicateOrphanDetection, duplicateOrphanLogInfo, chainOrderUnchangedFromCache, detectCrossedBookPlan, collectKnownOnChainOrderIds, edgeOrderIdSet, liveWindowIdSet, checkGridPriceInvariant, reportGridPriceInvariant };
1362
+ export { resolveEdgeAnchorPrice, resolveLiveEdgeAnchorPrice, compareEdge, collectRefillSlotIds, recordOrderPlacement, isFreshlyPlacedOrder, _filterUnmatchedChainOrders };
1363
1363
  //# sourceMappingURL=order.d.ts.map