dexbot 1.6.12 → 1.6.13
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.
- package/CHANGELOG.md +33 -1
- package/analysis/README.md +9 -11
- package/analysis/ama_fitting/README.md +5 -3
- package/claw/README.md +1 -0
- package/claw/docs/AI_BOT_LIBRARY_API.md +2 -0
- package/claw/modules/claw_bridge.ts +0 -3
- package/claw/modules/claw_skill_md.ts +1 -0
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/tsconfig.json +2 -2
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +1 -14
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +51 -41
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -24
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +36 -18
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +18 -66
- package/dist/analysis/analyze_args.d.ts +12 -0
- package/dist/analysis/analyze_args.js +20 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +1 -16
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +20 -101
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +26 -92
- package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
- package/dist/analysis/bot_fitting/shared_utils.d.ts +71 -3
- package/dist/analysis/bot_fitting/shared_utils.js +124 -8
- package/dist/analysis/chart_ui.d.ts +30 -1
- package/dist/analysis/chart_ui.js +37 -1
- package/dist/analysis/fills_cache.d.ts +3 -23
- package/dist/analysis/fills_cache.js +3 -84
- package/dist/analysis/fills_source.d.ts +31 -1
- package/dist/analysis/fills_source.js +69 -1
- package/dist/analysis/grid_correction_check.d.ts +1 -23
- package/dist/analysis/grid_correction_check.js +15 -58
- package/dist/analysis/math_utils.d.ts +85 -1
- package/dist/analysis/math_utils.js +116 -1
- package/dist/analysis/price_sources.d.ts +22 -1
- package/dist/analysis/price_sources.js +23 -0
- package/dist/analysis/resolve_source.js +31 -10
- package/dist/analysis/trade_profitability.d.ts +6 -0
- package/dist/analysis/trade_profitability.js +23 -97
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +1 -17
- package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +2 -15
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +22 -80
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +11 -37
- package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
- package/dist/analysis/worker_pool.d.ts +38 -0
- package/dist/analysis/worker_pool.js +67 -0
- package/dist/dexbot.js +67 -48
- package/dist/market_adapter/ama_signal_runner.js +21 -54
- package/dist/market_adapter/candle_utils.d.ts +7 -1
- package/dist/market_adapter/candle_utils.js +11 -1
- package/dist/market_adapter/cli_args.d.ts +22 -0
- package/dist/market_adapter/cli_args.js +30 -0
- package/dist/market_adapter/core/config_normalizers.js +11 -6
- package/dist/market_adapter/core/kibana_candles.d.ts +3 -1
- package/dist/market_adapter/core/kibana_candles.js +3 -2
- package/dist/market_adapter/core/market_adapter_service.d.ts +85 -85
- package/dist/market_adapter/core/market_adapter_service.js +93 -158
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
- package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
- package/dist/market_adapter/inputs/fetch_book_data.js +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +63 -107
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +8 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +25 -7
- package/dist/market_adapter/inputs/kibana_feed_source.js +4 -26
- package/dist/market_adapter/inputs/window_cache.d.ts +4 -72
- package/dist/market_adapter/inputs/window_cache.js +52 -177
- package/dist/market_adapter/interval_utils.d.ts +11 -1
- package/dist/market_adapter/interval_utils.js +16 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +3 -0
- package/dist/market_adapter/lp_chart_runner.js +37 -19
- package/dist/market_adapter/market_adapter.js +27 -72
- package/dist/market_adapter/utils/data_discovery.d.ts +45 -1
- package/dist/market_adapter/utils/data_discovery.js +220 -27
- package/dist/market_adapter/utils/month_shards.d.ts +84 -0
- package/dist/market_adapter/utils/month_shards.js +237 -0
- package/dist/modules/account_bots.d.ts +1 -0
- package/dist/modules/account_bots.js +102 -121
- package/dist/modules/account_orders.d.ts +13 -0
- package/dist/modules/account_orders.js +38 -44
- package/dist/modules/bitshares-native/chain_client.d.ts +1 -1
- package/dist/modules/bitshares-native/chain_client.js +14 -13
- package/dist/modules/bitshares-native/resolvers.js +22 -25
- package/dist/modules/bitshares-native/serial/types.js +22 -50
- package/dist/modules/bitshares-native/signing_client.d.ts +1 -1
- package/dist/modules/bot_defaults.d.ts +2 -1
- package/dist/modules/bot_settings.d.ts +1 -1
- package/dist/modules/broadcast_failure.d.ts +2 -1
- package/dist/modules/chain_orders.d.ts +1 -1
- package/dist/modules/chain_orders.js +51 -96
- package/dist/modules/cli_start_onboarding.d.ts +2 -1
- package/dist/modules/constants.d.ts +7 -1
- package/dist/modules/constants.js +20 -1
- package/dist/modules/cr_planner.d.ts +1 -1
- package/dist/modules/cr_planner.js +1 -5
- package/dist/modules/credit_pricing.d.ts +2 -1
- package/dist/modules/credit_pricing.js +36 -40
- package/dist/modules/credit_runtime.d.ts +7 -0
- package/dist/modules/credit_runtime.js +45 -73
- package/dist/modules/daemon_node_health.d.ts +4 -3
- package/dist/modules/dexbot_class.d.ts +28 -17
- package/dist/modules/dexbot_class.js +105 -58
- package/dist/modules/dexbot_cow_runtime.d.ts +0 -7
- package/dist/modules/dexbot_cow_runtime.js +54 -28
- package/dist/modules/dexbot_credential_client.d.ts +0 -7
- package/dist/modules/dexbot_credential_client.js +1 -2
- package/dist/modules/dexbot_fill_runtime.d.ts +1 -2
- package/dist/modules/dexbot_fill_runtime.js +5 -6
- package/dist/modules/dexbot_maintenance_runtime.d.ts +20 -3
- package/dist/modules/dexbot_maintenance_runtime.js +84 -69
- package/dist/modules/dexbot_startup_runtime.d.ts +0 -1
- package/dist/modules/dexbot_startup_runtime.js +13 -14
- package/dist/modules/general_settings.d.ts +1 -1
- package/dist/modules/graceful_shutdown.js +17 -11
- package/dist/modules/key_store.js +0 -1
- package/dist/modules/lazy_shim.d.ts +11 -0
- package/dist/modules/lazy_shim.js +16 -0
- package/dist/modules/node_connect_policy.d.ts +3 -2
- package/dist/modules/node_failure_ledger.d.ts +6 -5
- package/dist/modules/order/format.d.ts +12 -3
- package/dist/modules/order/format.js +15 -3
- package/dist/modules/order/genesis_policy.d.ts +3 -3
- package/dist/modules/order/genesis_policy.js +5 -2
- package/dist/modules/order/grid.d.ts +4 -2
- package/dist/modules/order/grid.js +91 -35
- package/dist/modules/order/index.d.ts +1 -0
- package/dist/modules/order/logger.d.ts +1 -8
- package/dist/modules/order/logger.js +0 -9
- package/dist/modules/order/manager.d.ts +9 -13
- package/dist/modules/order/manager.js +33 -50
- package/dist/modules/order/utils/order.js +39 -35
- package/dist/modules/order/utils/system.d.ts +9 -29
- package/dist/modules/order/utils/system.js +17 -2
- package/dist/modules/order/utils/validate.js +2 -2
- package/dist/modules/order/utils/withPoolRef.d.ts +2 -1
- package/dist/modules/paths.js +32 -34
- package/dist/modules/runtime_settings.d.ts +2 -4
- package/dist/modules/settings_merge.d.ts +2 -2
- package/dist/modules/socket_json_client.d.ts +2 -1
- package/dist/modules/types.d.ts +42 -27
- package/dist/modules/utils/errors.js +1 -3
- package/dist/modules/version_notice.d.ts +11 -10
- package/dist/pm2.d.ts +0 -1
- package/dist/pm2.js +56 -35
- package/dist/scripts/analyze-git.js +2 -15
- package/dist/scripts/chart_command.js +2 -2
- package/dist/scripts/check_any.d.ts +4 -0
- package/dist/scripts/check_any.js +53 -21
- package/dist/scripts/diagnose-pool-history.js +1 -6
- package/dist/scripts/run-tests.js +0 -1
- package/dist/scripts/sync-version.js +0 -10
- package/docs/BITSHARES_ONBOARDING.md +8 -12
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -1
- package/docs/DEXBOT_COMPARISON.md +6 -6
- package/docs/EVOLUTION.md +9 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/README.md +1 -1
- package/docs/WORKFLOW.md +1 -0
- package/docs/architecture.md +19 -10
- package/market_adapter/README.md +6 -4
- package/package.json +6 -9
- package/scripts/README.md +43 -38
- package/tests/README.md +25 -10
- package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
- package/dist/scripts/diagnose-kibana-candles.js +0 -82
- package/scripts/git-viewer.sh +0 -489
- package/scripts/postinstall.js +0 -16
|
@@ -41,6 +41,24 @@ function sortOperation(array, st_operation) {
|
|
|
41
41
|
return strCmp(String(fa), String(fb));
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Build a SerType for a bounded integer. `read`/`write` are the codec hooks;
|
|
46
|
+
* `min`/`max` drive requireRange in every direction. Shared by the
|
|
47
|
+
* uint8/uint16/uint32/varint32 definitions, which differ only by codec+range.
|
|
48
|
+
*/
|
|
49
|
+
function makeIntType(name, min, max, read, write) {
|
|
50
|
+
return {
|
|
51
|
+
fromByteBuffer(b) { return read(b); },
|
|
52
|
+
appendByteBuffer(b, v) { requireRange(min, max, v, name); write(b, v); },
|
|
53
|
+
fromObject(v) { requireRange(min, max, v, name); return v; },
|
|
54
|
+
toObject(v, debug) {
|
|
55
|
+
if (debug && debug.use_default && v === undefined)
|
|
56
|
+
return 0;
|
|
57
|
+
requireRange(min, max, v, name);
|
|
58
|
+
return parseInt(String(v), 10);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
44
62
|
const void_type = {
|
|
45
63
|
fromByteBuffer() { return undefined; },
|
|
46
64
|
appendByteBuffer() { },
|
|
@@ -51,56 +69,10 @@ const void_type = {
|
|
|
51
69
|
return undefined;
|
|
52
70
|
},
|
|
53
71
|
};
|
|
54
|
-
const uint8 =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
toObject(v, debug) {
|
|
59
|
-
if (debug && debug.use_default && v === undefined)
|
|
60
|
-
return 0;
|
|
61
|
-
requireRange(0, 0xFF, v, 'uint8');
|
|
62
|
-
return parseInt(String(v), 10);
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
const uint16 = {
|
|
66
|
-
fromByteBuffer(b) { return b.readUint16(); },
|
|
67
|
-
appendByteBuffer(b, v) { requireRange(0, 0xFFFF, v, 'uint16'); b.writeUint16(v); },
|
|
68
|
-
fromObject(v) { requireRange(0, 0xFFFF, v, 'uint16'); return v; },
|
|
69
|
-
toObject(v, debug) {
|
|
70
|
-
if (debug && debug.use_default && v === undefined)
|
|
71
|
-
return 0;
|
|
72
|
-
requireRange(0, 0xFFFF, v, 'uint16');
|
|
73
|
-
return parseInt(String(v), 10);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
const uint32 = {
|
|
77
|
-
fromByteBuffer(b) { return b.readUint32(); },
|
|
78
|
-
appendByteBuffer(b, v) { requireRange(0, 0xFFFFFFFF, v, 'uint32'); b.writeUint32(v); },
|
|
79
|
-
fromObject(v) { requireRange(0, 0xFFFFFFFF, v, 'uint32'); return v; },
|
|
80
|
-
toObject(v, debug) {
|
|
81
|
-
if (debug && debug.use_default && v === undefined)
|
|
82
|
-
return 0;
|
|
83
|
-
requireRange(0, 0xFFFFFFFF, v, 'uint32');
|
|
84
|
-
return parseInt(String(v), 10);
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
const varint32 = {
|
|
88
|
-
fromByteBuffer(b) { return b.readVarint32(); },
|
|
89
|
-
appendByteBuffer(b, v) {
|
|
90
|
-
requireRange(-2147483648, 2147483647, v, 'varint32');
|
|
91
|
-
b.writeVarint32(v);
|
|
92
|
-
},
|
|
93
|
-
fromObject(v) {
|
|
94
|
-
requireRange(-2147483648, 2147483647, v, 'varint32');
|
|
95
|
-
return v;
|
|
96
|
-
},
|
|
97
|
-
toObject(v, debug) {
|
|
98
|
-
if (debug && debug.use_default && v === undefined)
|
|
99
|
-
return 0;
|
|
100
|
-
requireRange(-2147483648, 2147483647, v, 'varint32');
|
|
101
|
-
return parseInt(String(v), 10);
|
|
102
|
-
},
|
|
103
|
-
};
|
|
72
|
+
const uint8 = makeIntType('uint8', 0, 0xFF, (b) => b.readUint8(), (b, v) => b.writeUint8(v));
|
|
73
|
+
const uint16 = makeIntType('uint16', 0, 0xFFFF, (b) => b.readUint16(), (b, v) => b.writeUint16(v));
|
|
74
|
+
const uint32 = makeIntType('uint32', 0, 0xFFFFFFFF, (b) => b.readUint32(), (b, v) => b.writeUint32(v));
|
|
75
|
+
const varint32 = makeIntType('varint32', -2147483648, 2147483647, (b) => b.readVarint32(), (b, v) => b.writeVarint32(v));
|
|
104
76
|
const int64 = {
|
|
105
77
|
fromByteBuffer(b) { return b.readInt64(); },
|
|
106
78
|
appendByteBuffer(b, v) {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* tests/test_bot_defaults_parity.ts — update them together with this file.
|
|
20
20
|
*/
|
|
21
21
|
import type { UnknownRecord } from './types.js';
|
|
22
|
-
|
|
22
|
+
interface SeedOptions {
|
|
23
23
|
/** Defaults source; omit to use the merged DEFAULT_CONFIG. */
|
|
24
24
|
defaults?: UnknownRecord;
|
|
25
25
|
}
|
|
@@ -86,4 +86,5 @@ export declare function seedBotEntry<T extends UnknownRecord>(entry: T, options?
|
|
|
86
86
|
* (the historical shallow spread aliased every nested default object).
|
|
87
87
|
*/
|
|
88
88
|
export declare function seedBotRuntimeConfig(config?: UnknownRecord, options?: SeedOptions): UnknownRecord;
|
|
89
|
+
export {};
|
|
89
90
|
//# sourceMappingURL=bot_defaults.d.ts.map
|
|
@@ -6,7 +6,7 @@ export interface BotLendingEntry extends UnknownRecord {
|
|
|
6
6
|
type?: unknown;
|
|
7
7
|
}
|
|
8
8
|
/** `debtPolicy` block of a bot entry. */
|
|
9
|
-
|
|
9
|
+
interface BotDebtPolicy extends UnknownRecord {
|
|
10
10
|
lending?: BotLendingEntry[];
|
|
11
11
|
maxCollateralAmount?: unknown;
|
|
12
12
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Mirrors the failure modes produced by modules/bitshares-native/transport.ts
|
|
12
12
|
* call() and the signing client (modules/bitshares-native/signing_client.ts).
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
type BroadcastFailureClass = 'retryable' | 'uncertain' | 'definite';
|
|
15
15
|
/**
|
|
16
16
|
* Classify a broadcast-phase failure.
|
|
17
17
|
*
|
|
@@ -30,4 +30,5 @@ export type BroadcastFailureClass = 'retryable' | 'uncertain' | 'definite';
|
|
|
30
30
|
* @returns {BroadcastFailureClass}
|
|
31
31
|
*/
|
|
32
32
|
export declare function classifyBroadcastFailure(err: unknown): BroadcastFailureClass;
|
|
33
|
+
export {};
|
|
33
34
|
//# sourceMappingURL=broadcast_failure.d.ts.map
|
|
@@ -493,7 +493,7 @@ declare function findOverReducingUpdateOpError(operations: unknown): Promise<Err
|
|
|
493
493
|
* @param {string} accountName - Account paying fees (usually the bot account)
|
|
494
494
|
* @param {string|Object} privateKey - Private key for signing (or daemon signing token)
|
|
495
495
|
* @param {Array} operations - Array of operation objects { op_name, op_data } returned by build helpers
|
|
496
|
-
* @param {Object} [extraOptions] - Optional parameters (
|
|
496
|
+
* @param {Object} [extraOptions] - Optional parameters (nodeUrl, onNodeFailed, etc.)
|
|
497
497
|
* @returns {Promise<Object>} Transaction result
|
|
498
498
|
*/
|
|
499
499
|
declare function executeBatch(accountName: string | null | undefined, privateKey: unknown, operations: OperationLike[], extraOptions?: Record<string, unknown>): Promise<import("./key_store.js").SigningResult | {
|
|
@@ -229,33 +229,38 @@ async function getPreferredAccount() {
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Resolve an account
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
232
|
+
* Resolve an account reference against the shared name<->id cache under the
|
|
233
|
+
* resolution lock. `direction` picks which field is looked up and returned:
|
|
234
|
+
* 'to-name' resolves an id to a name, 'to-id' a name to an id. A reference
|
|
235
|
+
* already shaped as the target (id for 'to-name', non-id for 'to-id') is
|
|
236
|
+
* returned untouched, and the reverse mapping is cached alongside the result.
|
|
237
|
+
* @param {string} accountRef - Account id or name
|
|
238
|
+
* @param {'to-name'|'to-id'} direction - Direction of resolution
|
|
239
|
+
* @returns {Promise<string|null>} Resolved value or null if not found
|
|
236
240
|
*/
|
|
237
|
-
async function
|
|
241
|
+
async function resolveAccount(accountRef, direction) {
|
|
238
242
|
if (!accountRef)
|
|
239
243
|
return null;
|
|
240
244
|
if (typeof accountRef !== 'string')
|
|
241
245
|
return null;
|
|
242
|
-
if (!/^1\.2\./.test(accountRef))
|
|
246
|
+
if (direction === 'to-name' ? !/^1\.2\./.test(accountRef) : /^1\.2\.\d+$/.test(accountRef))
|
|
243
247
|
return accountRef;
|
|
244
248
|
return await _resolutionLock.acquire(async () => {
|
|
245
249
|
// Check cache first
|
|
246
|
-
const cacheKey =
|
|
250
|
+
const cacheKey = `${direction === 'to-name' ? 'id->' : 'name->'}${accountRef}`;
|
|
247
251
|
if (_accountResolutionCache.has(cacheKey)) {
|
|
248
252
|
return _accountResolutionCache.get(cacheKey) ?? null;
|
|
249
253
|
}
|
|
250
254
|
try {
|
|
251
255
|
await waitForConnected();
|
|
252
256
|
const full = await BitShares.db.get_full_accounts([accountRef], false);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
257
|
+
const account = full && full[0] && full[0][1] && full[0][1].account;
|
|
258
|
+
const result = direction === 'to-name' ? account?.name : account?.id;
|
|
259
|
+
if (result) {
|
|
260
|
+
_accountResolutionCache.set(cacheKey, result);
|
|
256
261
|
// Also cache reverse mapping
|
|
257
|
-
_accountResolutionCache.set(
|
|
258
|
-
return
|
|
262
|
+
_accountResolutionCache.set(`${direction === 'to-name' ? 'name' : 'id'}->${result}`, accountRef);
|
|
263
|
+
return result;
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
266
|
catch (err) {
|
|
@@ -264,6 +269,15 @@ async function resolveAccountName(accountRef) {
|
|
|
264
269
|
return null;
|
|
265
270
|
});
|
|
266
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Resolve an account ID to its human-readable name via chain lookup.
|
|
274
|
+
* Results are cached to prevent repeated lookups (fixes Issue #4).
|
|
275
|
+
* @param {string} accountRef - Account ID (e.g., '1.2.12345') or name
|
|
276
|
+
* @returns {Promise<string|null>} Account name or null if not found
|
|
277
|
+
*/
|
|
278
|
+
async function resolveAccountName(accountRef) {
|
|
279
|
+
return resolveAccount(accountRef, 'to-name');
|
|
280
|
+
}
|
|
267
281
|
/**
|
|
268
282
|
* Resolve an account name to its ID via chain lookup.
|
|
269
283
|
* Results are cached to prevent repeated lookups (fixes Issue #4).
|
|
@@ -271,36 +285,7 @@ async function resolveAccountName(accountRef) {
|
|
|
271
285
|
* @returns {Promise<string|null>} Account ID or null if not found
|
|
272
286
|
*/
|
|
273
287
|
async function resolveAccountId(accountName) {
|
|
274
|
-
|
|
275
|
-
return null;
|
|
276
|
-
if (typeof accountName !== 'string')
|
|
277
|
-
return null;
|
|
278
|
-
// If already in ID format, return as-is
|
|
279
|
-
if (/^1\.2\.\d+$/.test(accountName))
|
|
280
|
-
return accountName;
|
|
281
|
-
return await _resolutionLock.acquire(async () => {
|
|
282
|
-
// Check cache first
|
|
283
|
-
const cacheKey = `name->${accountName}`;
|
|
284
|
-
if (_accountResolutionCache.has(cacheKey)) {
|
|
285
|
-
return _accountResolutionCache.get(cacheKey) ?? null;
|
|
286
|
-
}
|
|
287
|
-
try {
|
|
288
|
-
await waitForConnected();
|
|
289
|
-
const full = await BitShares.db.get_full_accounts([accountName], false);
|
|
290
|
-
// full[0][0] is the account name (key), full[0][1] contains account data
|
|
291
|
-
if (full && full[0] && full[0][1] && full[0][1].account && full[0][1].account.id) {
|
|
292
|
-
const id = full[0][1].account.id;
|
|
293
|
-
_accountResolutionCache.set(cacheKey, id);
|
|
294
|
-
// Also cache reverse mapping
|
|
295
|
-
_accountResolutionCache.set(`id->${id}`, accountName);
|
|
296
|
-
return id;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
catch (err) {
|
|
300
|
-
// ignore resolution failures
|
|
301
|
-
}
|
|
302
|
-
return null;
|
|
303
|
-
});
|
|
288
|
+
return resolveAccount(accountName, 'to-id');
|
|
304
289
|
}
|
|
305
290
|
// Track active account subscriptions so we avoid duplicate listeners per account
|
|
306
291
|
// Map accountName -> { userCallbacks: Set<Function>, bsCallback: Function }
|
|
@@ -439,11 +424,9 @@ function isDaemonSigningToken(value) {
|
|
|
439
424
|
async function executeViaDaemonToken(accountName, signingToken, operations, extraOptions = {}) {
|
|
440
425
|
const nodeManager = getNodeManager();
|
|
441
426
|
const healthyNodes = nodeManager?.getHealthyNodes() ?? [];
|
|
442
|
-
const fallbackNodes = healthyNodes.length > 1 ? healthyNodes.slice(1) : undefined;
|
|
443
427
|
const opts = extraOptions;
|
|
444
|
-
if (healthyNodes.length > 0 && nodeManager && !opts.
|
|
428
|
+
if (healthyNodes.length > 0 && nodeManager && !opts.nodeUrl) {
|
|
445
429
|
opts.nodeUrl = healthyNodes[0];
|
|
446
|
-
opts.fallbackNodes = fallbackNodes;
|
|
447
430
|
opts.onNodeFailed = (nodeUrl) => nodeManager.reportNodeFailure(nodeUrl, DAEMON_CODES.BROADCAST_DEADLINE, 'broadcast');
|
|
448
431
|
}
|
|
449
432
|
return getKeyStore().executeOperations(accountName, operations, signingToken, opts);
|
|
@@ -737,6 +720,25 @@ async function listenForFills(accountRef, callback) {
|
|
|
737
720
|
}
|
|
738
721
|
};
|
|
739
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* Receive amount for a limit_order_update. Policy:
|
|
725
|
+
* - minToReceive provided: absolute override.
|
|
726
|
+
* - newPrice provided: `sellFloat` scaled by the price (multiply for a sell,
|
|
727
|
+
* divide for a buy).
|
|
728
|
+
* - otherwise: keep the existing on-chain price ratio (`sellInt * quote/base`).
|
|
729
|
+
* Shared by the pre- and post-delta computations so both agree.
|
|
730
|
+
*/
|
|
731
|
+
function computeOrderReceiveInt(newParams, receivePrecision, sellInt, sellFloat, priceRatioBase, priceRatioQuote) {
|
|
732
|
+
if (newParams.minToReceive !== undefined && newParams.minToReceive !== null) {
|
|
733
|
+
return floatToBlockchainInt(newParams.minToReceive, receivePrecision);
|
|
734
|
+
}
|
|
735
|
+
if (newParams.newPrice !== undefined && newParams.newPrice !== null) {
|
|
736
|
+
const price = toFiniteNumber(newParams.newPrice);
|
|
737
|
+
const receiveFloat = newParams.orderType === 'sell' ? sellFloat * price : sellFloat / price;
|
|
738
|
+
return floatToBlockchainInt(receiveFloat, receivePrecision);
|
|
739
|
+
}
|
|
740
|
+
return Math.round((sellInt * priceRatioQuote) / priceRatioBase);
|
|
741
|
+
}
|
|
740
742
|
/**
|
|
741
743
|
* Build a limit_order_update operation.
|
|
742
744
|
* @param {string} accountName - The name of the account.
|
|
@@ -784,7 +786,6 @@ async function buildUpdateOrderOp(accountName, orderId, newParams, cachedOrder =
|
|
|
784
786
|
const sellPrecision = await _getAssetPrecision(sellAssetId);
|
|
785
787
|
const receivePrecision = await _getAssetPrecision(receiveAssetId);
|
|
786
788
|
const currentSellInt = toFiniteNumber(order.for_sale);
|
|
787
|
-
const currentSellFloat = blockchainToFloat(currentSellInt, sellPrecision);
|
|
788
789
|
const priceRatioBase = toFiniteNumber(order.sell_price.base.amount);
|
|
789
790
|
const priceRatioQuote = toFiniteNumber(order.sell_price.quote.amount);
|
|
790
791
|
const currentReceiveInt = Math.round((currentSellInt * priceRatioQuote) / priceRatioBase);
|
|
@@ -803,25 +804,7 @@ async function buildUpdateOrderOp(accountName, orderId, newParams, cachedOrder =
|
|
|
803
804
|
newSellFloat = blockchainToFloat(currentSellInt, sellPrecision);
|
|
804
805
|
}
|
|
805
806
|
// Determine an initial receive amount for price-change detection.
|
|
806
|
-
|
|
807
|
-
// - If minToReceive is provided: use it as an absolute override.
|
|
808
|
-
// - Else if newPrice is provided: compute receive from the (new or current) sell amount.
|
|
809
|
-
// - Else: keep the existing on-chain price by scaling receive with sell.
|
|
810
|
-
let candidateReceiveInt;
|
|
811
|
-
if (newParams.minToReceive !== undefined && newParams.minToReceive !== null) {
|
|
812
|
-
candidateReceiveInt = floatToBlockchainInt(newParams.minToReceive, receivePrecision);
|
|
813
|
-
}
|
|
814
|
-
else if (newParams.newPrice !== undefined && newParams.newPrice !== null) {
|
|
815
|
-
const price = toFiniteNumber(newParams.newPrice);
|
|
816
|
-
const sellFloat = (newParams.amountToSell !== undefined && newParams.amountToSell !== null) ? newParams.amountToSell : currentSellFloat;
|
|
817
|
-
const receiveFloat = (newParams.orderType === 'sell')
|
|
818
|
-
? (sellFloat * price)
|
|
819
|
-
: (sellFloat / price);
|
|
820
|
-
candidateReceiveInt = floatToBlockchainInt(receiveFloat, receivePrecision);
|
|
821
|
-
}
|
|
822
|
-
else {
|
|
823
|
-
candidateReceiveInt = Math.round((newSellInt * priceRatioQuote) / priceRatioBase);
|
|
824
|
-
}
|
|
807
|
+
const candidateReceiveInt = computeOrderReceiveInt(newParams, receivePrecision, newSellInt, newSellFloat, priceRatioBase, priceRatioQuote);
|
|
825
808
|
// Validate amounts before converting to blockchain integers / computing deltas
|
|
826
809
|
const candidateReceiveFloat = blockchainToFloat(candidateReceiveInt, receivePrecision);
|
|
827
810
|
if (!validateOrderAmountsWithinLimits(newSellFloat, candidateReceiveFloat, sellPrecision, receivePrecision)) {
|
|
@@ -848,21 +831,7 @@ async function buildUpdateOrderOp(accountName, orderId, newParams, cachedOrder =
|
|
|
848
831
|
}
|
|
849
832
|
}
|
|
850
833
|
// First, compute the receive amount with the current delta (not adjusted yet)
|
|
851
|
-
let newReceiveInt;
|
|
852
|
-
if (newParams.minToReceive !== undefined && newParams.minToReceive !== null) {
|
|
853
|
-
newReceiveInt = floatToBlockchainInt(newParams.minToReceive, receivePrecision);
|
|
854
|
-
}
|
|
855
|
-
else if (newParams.newPrice !== undefined && newParams.newPrice !== null) {
|
|
856
|
-
const price = toFiniteNumber(newParams.newPrice);
|
|
857
|
-
const receiveFloat = (newParams.orderType === 'sell')
|
|
858
|
-
? (newSellFloat * price)
|
|
859
|
-
: (newSellFloat / price);
|
|
860
|
-
newReceiveInt = floatToBlockchainInt(receiveFloat, receivePrecision);
|
|
861
|
-
}
|
|
862
|
-
else {
|
|
863
|
-
// Keep existing on-chain price ratio.
|
|
864
|
-
newReceiveInt = Math.round((newSellInt * priceRatioQuote) / priceRatioBase);
|
|
865
|
-
}
|
|
834
|
+
let newReceiveInt = computeOrderReceiveInt(newParams, receivePrecision, newSellInt, newSellFloat, priceRatioBase, priceRatioQuote);
|
|
866
835
|
// Check if price or amount is actually changing
|
|
867
836
|
const priceChanged = newReceiveInt !== currentReceiveInt;
|
|
868
837
|
const amountChanged = deltaSellInt !== 0;
|
|
@@ -876,21 +845,7 @@ async function buildUpdateOrderOp(accountName, orderId, newParams, cachedOrder =
|
|
|
876
845
|
// Adjust newSellInt to strict logic: current + delta
|
|
877
846
|
const adjustedSellInt = currentSellInt + deltaSellInt;
|
|
878
847
|
// Recompute the final receive amount with the adjusted sell amount
|
|
879
|
-
|
|
880
|
-
newReceiveInt = floatToBlockchainInt(newParams.minToReceive, receivePrecision);
|
|
881
|
-
}
|
|
882
|
-
else if (newParams.newPrice !== undefined && newParams.newPrice !== null) {
|
|
883
|
-
const price = toFiniteNumber(newParams.newPrice);
|
|
884
|
-
const adjustedSellFloat = blockchainToFloat(adjustedSellInt, sellPrecision);
|
|
885
|
-
const receiveFloat = (newParams.orderType === 'sell')
|
|
886
|
-
? (adjustedSellFloat * price)
|
|
887
|
-
: (adjustedSellFloat / price);
|
|
888
|
-
newReceiveInt = floatToBlockchainInt(receiveFloat, receivePrecision);
|
|
889
|
-
}
|
|
890
|
-
else {
|
|
891
|
-
// Keep existing on-chain price ratio.
|
|
892
|
-
newReceiveInt = Math.round((adjustedSellInt * priceRatioQuote) / priceRatioBase);
|
|
893
|
-
}
|
|
848
|
+
newReceiveInt = computeOrderReceiveInt(newParams, receivePrecision, adjustedSellInt, blockchainToFloat(adjustedSellInt, sellPrecision), priceRatioBase, priceRatioQuote);
|
|
894
849
|
const adjustedSellFloat = blockchainToFloat(adjustedSellInt, sellPrecision);
|
|
895
850
|
const finalReceiveFloat = blockchainToFloat(newReceiveInt, receivePrecision);
|
|
896
851
|
if (!validateOrderAmountsWithinLimits(adjustedSellFloat, finalReceiveFloat, sellPrecision, receivePrecision)) {
|
|
@@ -1246,7 +1201,7 @@ async function findOverReducingUpdateOpError(operations) {
|
|
|
1246
1201
|
* @param {string} accountName - Account paying fees (usually the bot account)
|
|
1247
1202
|
* @param {string|Object} privateKey - Private key for signing (or daemon signing token)
|
|
1248
1203
|
* @param {Array} operations - Array of operation objects { op_name, op_data } returned by build helpers
|
|
1249
|
-
* @param {Object} [extraOptions] - Optional parameters (
|
|
1204
|
+
* @param {Object} [extraOptions] - Optional parameters (nodeUrl, onNodeFailed, etc.)
|
|
1250
1205
|
* @returns {Promise<Object>} Transaction result
|
|
1251
1206
|
*/
|
|
1252
1207
|
async function executeBatch(accountName, privateKey, operations, extraOptions = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type StartOnboardingCommand = 'key' | 'bot' | null;
|
|
2
2
|
/**
|
|
3
3
|
* Select the setup editor that should handle an otherwise-normal start
|
|
4
4
|
* command (`start` or its `unlock` alias).
|
|
@@ -7,4 +7,5 @@ export type StartOnboardingCommand = 'key' | 'bot' | null;
|
|
|
7
7
|
* definitions proceeds to the bot editor.
|
|
8
8
|
*/
|
|
9
9
|
export declare function selectStartOnboardingCommand(hasKeySetup: boolean, botCount: number): StartOnboardingCommand;
|
|
10
|
+
export {};
|
|
10
11
|
//# sourceMappingURL=cli_start_onboarding.d.ts.map
|
|
@@ -149,6 +149,10 @@ declare const COW_ACTIONS: Readonly<{
|
|
|
149
149
|
CANCEL: "cancel";
|
|
150
150
|
UPDATE: "update";
|
|
151
151
|
}>;
|
|
152
|
+
declare const COW_ORIGINS: Readonly<{
|
|
153
|
+
SPREAD_CORRECTION: "spread-correction";
|
|
154
|
+
GAP_EVACUATION: "gap-evacuation";
|
|
155
|
+
}>;
|
|
152
156
|
declare let DEFAULT_CONFIG: {
|
|
153
157
|
startPrice: string;
|
|
154
158
|
minPrice: string;
|
|
@@ -208,6 +212,7 @@ declare let TIMING: {
|
|
|
208
212
|
RETRY_BACKOFF_CAP_MS: number;
|
|
209
213
|
DAEMON_PING_TIMEOUT_MS: number;
|
|
210
214
|
CREDENTIAL_DAEMON_WATCHDOG_MS: number;
|
|
215
|
+
CREDENTIAL_DAEMON_WATCHDOG_FAILURE_THRESHOLD: number;
|
|
211
216
|
RUN_LOOP_DEFAULT_MS: number;
|
|
212
217
|
OPEN_ORDERS_SYNC_LOOP_ENABLED: boolean;
|
|
213
218
|
CHECK_INTERVAL_MS: number;
|
|
@@ -746,6 +751,7 @@ declare function buildDefaultGeneralSettings(): {
|
|
|
746
751
|
RETRY_BACKOFF_CAP_MS: number;
|
|
747
752
|
DAEMON_PING_TIMEOUT_MS: number;
|
|
748
753
|
CREDENTIAL_DAEMON_WATCHDOG_MS: number;
|
|
754
|
+
CREDENTIAL_DAEMON_WATCHDOG_FAILURE_THRESHOLD: number;
|
|
749
755
|
RUN_LOOP_DEFAULT_MS: number;
|
|
750
756
|
OPEN_ORDERS_SYNC_LOOP_ENABLED: boolean;
|
|
751
757
|
CHECK_INTERVAL_MS: number;
|
|
@@ -1222,5 +1228,5 @@ declare function buildDefaultGeneralSettings(): {
|
|
|
1222
1228
|
};
|
|
1223
1229
|
NODES: import("./settings_merge.js").NodesView;
|
|
1224
1230
|
};
|
|
1225
|
-
export { ORDER_TYPES, ORDER_STATES, REBALANCE_STATES, COW_ACTIONS, DEFAULT_CONFIG, TIMING, RANGE_QUALITY, GRID_LIMITS, LOG_LEVEL, LOGGING_CONFIG, INCREMENT_BOUNDS, FEE_PARAMETERS, CR_ZONES, DEFAULT_TARGET_CR, API_LIMITS, FILL_PROCESSING, MAINTENANCE, NODE_MANAGEMENT, PIPELINE_TIMING, UPDATER, LAUNCHER, COW_PERFORMANCE, NATIVE_CLIENT, MARKET_ADAPTER, BUILD_DIR, BTS_PRECISION, DAEMON_ERRORS, DAEMON_CODES, CREDENTIAL_PROMPTS, buildDefaultGeneralSettings };
|
|
1231
|
+
export { ORDER_TYPES, ORDER_STATES, REBALANCE_STATES, COW_ACTIONS, COW_ORIGINS, DEFAULT_CONFIG, TIMING, RANGE_QUALITY, GRID_LIMITS, LOG_LEVEL, LOGGING_CONFIG, INCREMENT_BOUNDS, FEE_PARAMETERS, CR_ZONES, DEFAULT_TARGET_CR, API_LIMITS, FILL_PROCESSING, MAINTENANCE, NODE_MANAGEMENT, PIPELINE_TIMING, UPDATER, LAUNCHER, COW_PERFORMANCE, NATIVE_CLIENT, MARKET_ADAPTER, BUILD_DIR, BTS_PRECISION, DAEMON_ERRORS, DAEMON_CODES, CREDENTIAL_PROMPTS, buildDefaultGeneralSettings };
|
|
1226
1232
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -158,6 +158,19 @@ const COW_ACTIONS = Object.freeze({
|
|
|
158
158
|
CANCEL: 'cancel',
|
|
159
159
|
UPDATE: 'update'
|
|
160
160
|
});
|
|
161
|
+
// Canonical plan/action ORIGIN labels. A plan stamps `origin` so the execution
|
|
162
|
+
// guard can scope a bypass to one producer (never to the whole batch by
|
|
163
|
+
// accident). Kept here so the planner that writes the tag and the guard that
|
|
164
|
+
// reads it can never drift on the spelling.
|
|
165
|
+
// - SPREAD_CORRECTION: gap-repair creates (may close the spread on the
|
|
166
|
+
// market side); LAST-FILL-GUARD bypasses these CREATEs per-action.
|
|
167
|
+
// - GAP_EVACUATION: in-band rotation UPDATEs proven violation-reducing at
|
|
168
|
+
// plan-build (B-stamp) or re-proven live; LAST-FILL-GUARD bypasses only
|
|
169
|
+
// stamped/validated ones.
|
|
170
|
+
const COW_ORIGINS = Object.freeze({
|
|
171
|
+
SPREAD_CORRECTION: 'spread-correction',
|
|
172
|
+
GAP_EVACUATION: 'gap-evacuation'
|
|
173
|
+
});
|
|
161
174
|
// Defaults applied when instantiating an OrderManager with minimal configuration.
|
|
162
175
|
// These values are used when a parameter is not explicitly provided in the bot config.
|
|
163
176
|
let DEFAULT_CONFIG = {
|
|
@@ -256,6 +269,11 @@ let TIMING = {
|
|
|
256
269
|
RETRY_BACKOFF_CAP_MS: 30000, // 30 seconds - Max exponential backoff delay for connection retries
|
|
257
270
|
DAEMON_PING_TIMEOUT_MS: 5000, // 5 seconds - Private key daemon ping/healthcheck timeout
|
|
258
271
|
CREDENTIAL_DAEMON_WATCHDOG_MS: 60000, // 60 seconds - Credential daemon watchdog polling interval
|
|
272
|
+
// Consecutive failed watchdog probes before the daemon is declared down and
|
|
273
|
+
// grid persistence is suspended. 2 tolerates a single transient timeout
|
|
274
|
+
// (daemon busy signing a large batch) without pausing writes; a genuinely
|
|
275
|
+
// dead daemon still trips on the very next probe (~60s later).
|
|
276
|
+
CREDENTIAL_DAEMON_WATCHDOG_FAILURE_THRESHOLD: 2,
|
|
259
277
|
// Main loop and polling defaults
|
|
260
278
|
RUN_LOOP_DEFAULT_MS: 300000, // 5 minutes - default open-orders sync cycle delay (env override: OPEN_ORDERS_SYNC_LOOP_MS)
|
|
261
279
|
OPEN_ORDERS_SYNC_LOOP_ENABLED: false, // Preferred flag: continuous open-order watchdog sync loop (default false — react to fills only)
|
|
@@ -1971,6 +1989,7 @@ Object.freeze(ORDER_TYPES);
|
|
|
1971
1989
|
Object.freeze(ORDER_STATES);
|
|
1972
1990
|
Object.freeze(REBALANCE_STATES);
|
|
1973
1991
|
Object.freeze(COW_ACTIONS);
|
|
1992
|
+
Object.freeze(COW_ORIGINS);
|
|
1974
1993
|
Object.freeze(TIMING);
|
|
1975
1994
|
Object.freeze(GRID_LIMITS);
|
|
1976
1995
|
Object.freeze(GRID_LIMITS.GRID_COMPARISON);
|
|
@@ -2005,5 +2024,5 @@ Object.freeze(MARKET_ADAPTER.AMAS.AMA4);
|
|
|
2005
2024
|
Object.freeze(MARKET_ADAPTER.AMAS);
|
|
2006
2025
|
Object.freeze(MARKET_ADAPTER);
|
|
2007
2026
|
Object.freeze(CREDENTIAL_PROMPTS);
|
|
2008
|
-
export { ORDER_TYPES, ORDER_STATES, REBALANCE_STATES, COW_ACTIONS, DEFAULT_CONFIG, TIMING, RANGE_QUALITY, GRID_LIMITS, LOG_LEVEL, LOGGING_CONFIG, INCREMENT_BOUNDS, FEE_PARAMETERS, CR_ZONES, DEFAULT_TARGET_CR, API_LIMITS, FILL_PROCESSING, MAINTENANCE, NODE_MANAGEMENT, PIPELINE_TIMING, UPDATER, LAUNCHER, COW_PERFORMANCE, NATIVE_CLIENT, MARKET_ADAPTER, BUILD_DIR, BTS_PRECISION, DAEMON_ERRORS, DAEMON_CODES, CREDENTIAL_PROMPTS, buildDefaultGeneralSettings };
|
|
2027
|
+
export { ORDER_TYPES, ORDER_STATES, REBALANCE_STATES, COW_ACTIONS, COW_ORIGINS, DEFAULT_CONFIG, TIMING, RANGE_QUALITY, GRID_LIMITS, LOG_LEVEL, LOGGING_CONFIG, INCREMENT_BOUNDS, FEE_PARAMETERS, CR_ZONES, DEFAULT_TARGET_CR, API_LIMITS, FILL_PROCESSING, MAINTENANCE, NODE_MANAGEMENT, PIPELINE_TIMING, UPDATER, LAUNCHER, COW_PERFORMANCE, NATIVE_CLIENT, MARKET_ADAPTER, BUILD_DIR, BTS_PRECISION, DAEMON_ERRORS, DAEMON_CODES, CREDENTIAL_PROMPTS, buildDefaultGeneralSettings };
|
|
2009
2028
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { positiveOrNull } from './order/format.js';
|
|
1
2
|
interface CrPolicy {
|
|
2
3
|
minCollateralRatio?: number;
|
|
3
4
|
maxCollateralRatio?: number;
|
|
@@ -25,7 +26,6 @@ interface CollateralFallbackPlanOptions {
|
|
|
25
26
|
maxCollateralAmount?: number | string;
|
|
26
27
|
collateralLimitReferenceAmount?: number;
|
|
27
28
|
}
|
|
28
|
-
declare function positiveOrNull(value: unknown): number | null;
|
|
29
29
|
declare function resolveMinCollateralIncreaseThreshold(value: unknown, referenceAmount?: unknown): number | null;
|
|
30
30
|
declare function resolveTargetCollateralRatio(policy?: CrPolicy): number | null;
|
|
31
31
|
declare function buildDebtFirstCrPlan({ currentCollateralAmount, currentDebtAmount, feedPrice, minCollateralRatio, maxCollateralRatio, targetCollateralRatio, maxBorrowAmount, maxBorrowAmountPerOperation, maxCollateralAmount, collateralLimitReferenceAmount, minCollateralIncreaseThreshold, debtOnly, }?: DebtFirstCrPlanOptions): {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import {
|
|
2
|
+
import { positiveOrNull } from './order/format.js';
|
|
3
3
|
import { resolveConfigValue, isPercentageString, roundToDecimals } from './order/utils/math.js';
|
|
4
|
-
function positiveOrNull(value) {
|
|
5
|
-
const num = toFiniteNumber(value, undefined);
|
|
6
|
-
return Number.isFinite(num) && num > 0 ? num : null;
|
|
7
|
-
}
|
|
8
4
|
function resolveCollateralLimit(value, referenceAmount) {
|
|
9
5
|
const resolved = resolveConfigValue(value, referenceAmount);
|
|
10
6
|
if (!Number.isFinite(resolved))
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* modules/credit_pricing.ts — Canonical credit-pricing math (single source of truth).
|
|
3
3
|
*
|
|
4
|
-
* Pure functions only: no
|
|
4
|
+
* Pure functions only: no I/O, browser-safe; imports only the dependency-free
|
|
5
|
+
* order/format number helpers. Both the live
|
|
5
6
|
* credit runtime (modules/credit_runtime.ts) and the offline analyzer
|
|
6
7
|
* (scripts/analyze-credit.ts) delegate to these helpers so offer-price
|
|
7
8
|
* orientation, conversion rates, and collateral-ratio math cannot drift
|