// Public library API for `openbroker`. // // External packages — notably `openbroker-plugin` — import from here to // drive the CLI's functionality in-process (no `child_process` dispatch). // // Stability: every symbol re-exported here is a public API. Renames or // removals are breaking changes and require a major version bump. export { HyperliquidClient, getClient, } from './core/client.js'; // ── Live WebSocket user-event stream (own fills + order lifecycle) ── // Event-driven consumers (e.g. a market maker's hedge loop) subscribe here instead of // REST-polling. `userFill` / `orderUpdate` are emitted per own-order event; see WsEventMap. export { WebSocketManager, getWebSocket, resetWebSocket, } from './core/ws.js'; export type { WsEventMap, WsEventType, WsEventHandler } from './core/ws.js'; export { loadConfig, isConfigured, getNetwork, isMainnet, ensureConfigDir, getConfigPath, GLOBAL_CONFIG_DIR, GLOBAL_ENV_PATH, OPEN_BROKER_BUILDER_ADDRESS, } from './core/config.js'; export { roundPrice, roundSize, sleep, normalizeCoin, formatUsd, formatPercent, annualizeFundingRate, parseArgs, getSlippagePrice, getTimestampMs, generateCloid, orderToWire, checkBuilderFeeApproval, MIN_ORDER_NOTIONAL_USD, parseOrderStatus, } from './core/utils.js'; export type { ParsedOrderStatus } from './core/utils.js'; export type * from './core/types.js'; // ── Operations (in-process callable) ──────────────────────────────── export { runBracket } from './operations/bracket.js'; export type { BracketOptions, BracketResult } from './operations/bracket.js'; export { runChase } from './operations/chase.js'; export type { ChaseOptions, ChaseResult } from './operations/chase.js'; export { runScale, calculateLevels } from './operations/scale.js'; export type { ScaleOptions, ScaleResult, OrderLevel } from './operations/scale.js'; // ── Automation runtime ────────────────────────────────────────────── export { startAutomation, getRunningAutomations, getAutomation, getRegisteredAutomations, } from './auto/runtime.js'; export type { RuntimeOptions } from './auto/runtime.js'; export { resolveScriptPath, resolveExamplePath, listAutomations, listExamples, loadExampleConfigs, ensureAutomationsDir, loadAutomation, } from './auto/loader.js'; export { GuardrailViolation, CLIENT_WRITE_METHODS, canonicalMarket, validateAutomationGuardrails, resolveAutomationGuardrails, createGuardrailedClient, } from './auto/guardrails.js'; export type { GuardrailedClientOptions } from './auto/guardrails.js'; export { registerAutomation, unregisterAutomation, cleanRegistry, getAutomationsToRestart, markAutomationError, } from './auto/registry.js'; export type * from './auto/types.js'; // ── Guardian (read-only position risk monitoring) ─────────────────── export { startGuardian, Guardian } from './guardian/engine.js'; export type { GuardianOptions, GuardianHandle, GuardianStats, GuardianTelegramChannel, GuardianAgentHookChannel, } from './guardian/engine.js'; export { GuardianRiskEngine } from './guardian/rules.js'; export type { GuardianAlertHandler } from './guardian/rules.js'; export { sendTelegramMessage, getTelegramBotInfo, formatTelegramAlert, loadTelegramSettings, waitForTelegramLink, generateLinkCode, saveEnvVar, } from './guardian/telegram.js'; export type { TelegramSettings } from './guardian/telegram.js'; export { GUARDIAN_RULE_IDS, GUARDIAN_RULE_LABELS, GUARDIAN_SEVERITY_RANK, DEFAULT_GUARDIAN_THRESHOLDS, } from './guardian/types.js'; export type * from './guardian/types.js';