openbroker 1.1.0 → 1.1.2
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/package.json
CHANGED
package/scripts/auto/runtime.ts
CHANGED
|
@@ -53,12 +53,21 @@ async function loadConventionObservers(log: AutomationLogger): Promise<Automatio
|
|
|
53
53
|
const observer = typeof exported === 'function' ? exported() : exported;
|
|
54
54
|
if (observer && typeof observer === 'object') {
|
|
55
55
|
observers.push(observer as AutomationAuditObserver);
|
|
56
|
-
log.
|
|
56
|
+
log.info(`[audit-observer] loaded: ${name}`);
|
|
57
|
+
} else {
|
|
58
|
+
// Package resolved but its factory returned null/undefined — typically
|
|
59
|
+
// because required env (e.g. OB_DASHBOARD_URL) is missing. Surface this
|
|
60
|
+
// so operators don't silently lose telemetry.
|
|
61
|
+
log.warn(
|
|
62
|
+
`[audit-observer] ${name} resolved but factory returned no observer — check the package's required env vars`
|
|
63
|
+
);
|
|
57
64
|
}
|
|
58
65
|
} catch (err) {
|
|
59
66
|
const code = (err as NodeJS.ErrnoException | undefined)?.code;
|
|
60
|
-
if (code
|
|
61
|
-
log.
|
|
67
|
+
if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') {
|
|
68
|
+
log.info(`[audit-observer] ${name} not installed — skipping (install it alongside openbroker to forward telemetry)`);
|
|
69
|
+
} else {
|
|
70
|
+
log.warn(`[audit-observer] failed to load "${name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env npx tsx
|
|
2
2
|
// Bracket Order - Entry with Take Profit and Stop Loss
|
|
3
3
|
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
4
5
|
import { getClient } from '../core/client.js';
|
|
5
6
|
import { formatUsd, parseArgs, sleep } from '../core/utils.js';
|
|
6
7
|
|
|
@@ -298,4 +299,8 @@ async function main() {
|
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
|
|
302
|
+
// Only run when invoked as a script — not when imported as a module
|
|
303
|
+
// (e.g. by `openbroker-plugin` via the lib re-export of `runBracket`).
|
|
304
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
305
|
+
main();
|
|
306
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env npx tsx
|
|
2
2
|
// Chase Order - Follow price with limit orders until filled
|
|
3
3
|
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
4
5
|
import { getClient } from '../core/client.js';
|
|
5
6
|
import { formatUsd, parseArgs, sleep } from '../core/utils.js';
|
|
6
7
|
|
|
@@ -253,4 +254,8 @@ async function main() {
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
|
|
256
|
-
|
|
257
|
+
// Only run when invoked as a script — not when imported as a module
|
|
258
|
+
// (e.g. by `openbroker-plugin` via the lib re-export of `runChase`).
|
|
259
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
260
|
+
main();
|
|
261
|
+
}
|