@reefclaw/connect 0.1.10 → 0.1.12
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/assets/bridge/gateway/event-parser.d.ts +6 -1
- package/assets/bridge/gateway/event-parser.js +19 -2
- package/assets/bridge/gateway/heartbeat-cron.d.ts +27 -0
- package/assets/bridge/gateway/heartbeat-cron.js +85 -0
- package/assets/bridge/gateway/poller.d.ts +1 -0
- package/assets/bridge/gateway/poller.js +14 -2
- package/assets/bridge/providers/gateway.d.ts +24 -2
- package/assets/bridge/providers/gateway.js +124 -25
- package/assets/bridge/setup.js +6 -51
- package/assets/shared/signals/conditions/registry.js +11 -2
- package/assets/shared/signals/strategy-adapter.js +17 -7
- package/assets/skill/SKILL.md +2 -0
- package/dist/deps.js +2 -2
- package/dist/plugin.js +35 -7
- package/package.json +1 -1
- package/assets/plugin/audit/mode-transition-audit.d.ts +0 -11
- package/assets/plugin/audit/mode-transition-audit.js +0 -29
- package/assets/plugin/balance-utils.d.ts +0 -36
- package/assets/plugin/balance-utils.js +0 -98
- package/assets/plugin/ccxt/binance-ban-gate.d.ts +0 -47
- package/assets/plugin/ccxt/binance-ban-gate.js +0 -420
- package/assets/plugin/ccxt/binance-private.d.ts +0 -346
- package/assets/plugin/ccxt/binance-private.js +0 -1525
- package/assets/plugin/ccxt/binance-public.d.ts +0 -34
- package/assets/plugin/ccxt/binance-public.js +0 -180
- package/assets/plugin/ccxt/intel-public.d.ts +0 -25
- package/assets/plugin/ccxt/intel-public.js +0 -80
- package/assets/plugin/ccxt/public-market-data-api.d.ts +0 -12
- package/assets/plugin/ccxt/public-market-data-api.js +0 -9
- package/assets/plugin/config/agent-config-client.d.ts +0 -77
- package/assets/plugin/config/agent-config-client.js +0 -188
- package/assets/plugin/config/agent-config-poller.d.ts +0 -32
- package/assets/plugin/config/agent-config-poller.js +0 -101
- package/assets/plugin/config/brackets-config.d.ts +0 -22
- package/assets/plugin/config/brackets-config.js +0 -58
- package/assets/plugin/config/entitlement-gate.d.ts +0 -51
- package/assets/plugin/config/entitlement-gate.js +0 -137
- package/assets/plugin/config/gate-store.d.ts +0 -18
- package/assets/plugin/config/gate-store.js +0 -61
- package/assets/plugin/config/plugin-config-io.d.ts +0 -215
- package/assets/plugin/config/plugin-config-io.js +0 -111
- package/assets/plugin/config/position-review-config.d.ts +0 -35
- package/assets/plugin/config/position-review-config.js +0 -105
- package/assets/plugin/config/tool-gate.d.ts +0 -53
- package/assets/plugin/config/tool-gate.js +0 -128
- package/assets/plugin/config/user-data-stream-config.d.ts +0 -89
- package/assets/plugin/config/user-data-stream-config.js +0 -239
- package/assets/plugin/connector-supervisor.d.ts +0 -36
- package/assets/plugin/connector-supervisor.js +0 -149
- package/assets/plugin/exchange-adapter.d.ts +0 -65
- package/assets/plugin/exchange-adapter.js +0 -4
- package/assets/plugin/index.d.ts +0 -30
- package/assets/plugin/index.js +0 -2678
- package/assets/plugin/ingest/pending-entry-metadata.d.ts +0 -74
- package/assets/plugin/ingest/pending-entry-metadata.js +0 -236
- package/assets/plugin/ingest/position-auto-capture.d.ts +0 -103
- package/assets/plugin/ingest/position-auto-capture.js +0 -411
- package/assets/plugin/ingest/position-decisions-client.d.ts +0 -322
- package/assets/plugin/ingest/position-decisions-client.js +0 -296
- package/assets/plugin/ingest/readiness-reporter.d.ts +0 -42
- package/assets/plugin/ingest/readiness-reporter.js +0 -163
- package/assets/plugin/ingest/reconcile-db-vs-exchange.d.ts +0 -13
- package/assets/plugin/ingest/reconcile-db-vs-exchange.js +0 -114
- package/assets/plugin/ingest/reconciler-cleanup.d.ts +0 -37
- package/assets/plugin/ingest/reconciler-cleanup.js +0 -147
- package/assets/plugin/ingest/rest-gap-filler.d.ts +0 -191
- package/assets/plugin/ingest/rest-gap-filler.js +0 -565
- package/assets/plugin/ingest/touched-symbols-store.d.ts +0 -25
- package/assets/plugin/ingest/touched-symbols-store.js +0 -96
- package/assets/plugin/ingest/trade-store-client.d.ts +0 -40
- package/assets/plugin/ingest/trade-store-client.js +0 -125
- package/assets/plugin/ingest/ws-ingest.d.ts +0 -43
- package/assets/plugin/ingest/ws-ingest.js +0 -126
- package/assets/plugin/learning/setup-family.d.ts +0 -21
- package/assets/plugin/learning/setup-family.js +0 -103
- package/assets/plugin/lifecycle/install-signal-handlers.d.ts +0 -33
- package/assets/plugin/lifecycle/install-signal-handlers.js +0 -112
- package/assets/plugin/lifecycle/shutdown-coordinator.d.ts +0 -43
- package/assets/plugin/lifecycle/shutdown-coordinator.js +0 -131
- package/assets/plugin/lifecycle/trading-operation-lock.d.ts +0 -17
- package/assets/plugin/lifecycle/trading-operation-lock.js +0 -14
- package/assets/plugin/live/bracket-id.d.ts +0 -26
- package/assets/plugin/live/bracket-id.js +0 -112
- package/assets/plugin/live/bracket-ledger.d.ts +0 -54
- package/assets/plugin/live/bracket-ledger.js +0 -267
- package/assets/plugin/live/bracket-manager.d.ts +0 -82
- package/assets/plugin/live/bracket-manager.js +0 -478
- package/assets/plugin/live/bracket-params.d.ts +0 -22
- package/assets/plugin/live/bracket-params.js +0 -124
- package/assets/plugin/live/bracket-reconciler.d.ts +0 -95
- package/assets/plugin/live/bracket-reconciler.js +0 -573
- package/assets/plugin/live/bracket-types.d.ts +0 -102
- package/assets/plugin/live/bracket-types.js +0 -8
- package/assets/plugin/live/deposit-tracker.d.ts +0 -62
- package/assets/plugin/live/deposit-tracker.js +0 -97
- package/assets/plugin/live/emergency-controls.d.ts +0 -32
- package/assets/plugin/live/emergency-controls.js +0 -226
- package/assets/plugin/live/exchange-errors.d.ts +0 -12
- package/assets/plugin/live/exchange-errors.js +0 -130
- package/assets/plugin/live/exchange-info-cache.d.ts +0 -37
- package/assets/plugin/live/exchange-info-cache.js +0 -134
- package/assets/plugin/live/fact-subscriber.d.ts +0 -78
- package/assets/plugin/live/fact-subscriber.js +0 -182
- package/assets/plugin/live/intent-journal.d.ts +0 -42
- package/assets/plugin/live/intent-journal.js +0 -122
- package/assets/plugin/live/listen-key-manager.d.ts +0 -70
- package/assets/plugin/live/listen-key-manager.js +0 -169
- package/assets/plugin/live/live-adapter.d.ts +0 -287
- package/assets/plugin/live/live-adapter.js +0 -1777
- package/assets/plugin/live/live-balance-enricher.d.ts +0 -32
- package/assets/plugin/live/live-balance-enricher.js +0 -104
- package/assets/plugin/live/live-bracket-api.d.ts +0 -13
- package/assets/plugin/live/live-bracket-api.js +0 -20
- package/assets/plugin/live/live-state-store.d.ts +0 -194
- package/assets/plugin/live/live-state-store.js +0 -450
- package/assets/plugin/live/local-signal-service.d.ts +0 -57
- package/assets/plugin/live/local-signal-service.js +0 -151
- package/assets/plugin/live/local-strategy-evaluator.d.ts +0 -62
- package/assets/plugin/live/local-strategy-evaluator.js +0 -131
- package/assets/plugin/live/microstructure-assembler.d.ts +0 -54
- package/assets/plugin/live/microstructure-assembler.js +0 -148
- package/assets/plugin/live/order-poller.d.ts +0 -29
- package/assets/plugin/live/order-poller.js +0 -125
- package/assets/plugin/live/position-state-store.d.ts +0 -83
- package/assets/plugin/live/position-state-store.js +0 -237
- package/assets/plugin/live/proposal-decision-listener.d.ts +0 -70
- package/assets/plugin/live/proposal-decision-listener.js +0 -292
- package/assets/plugin/live/proposal-manager.d.ts +0 -76
- package/assets/plugin/live/proposal-manager.js +0 -140
- package/assets/plugin/live/rate-limiter.d.ts +0 -47
- package/assets/plugin/live/rate-limiter.js +0 -159
- package/assets/plugin/live/reconciler.d.ts +0 -39
- package/assets/plugin/live/reconciler.js +0 -175
- package/assets/plugin/live/setup-buckets.d.ts +0 -7
- package/assets/plugin/live/setup-buckets.js +0 -33
- package/assets/plugin/live/slippage-tracker.d.ts +0 -45
- package/assets/plugin/live/slippage-tracker.js +0 -78
- package/assets/plugin/live/stop-watcher.d.ts +0 -60
- package/assets/plugin/live/stop-watcher.js +0 -215
- package/assets/plugin/live/user-data-active-probe.d.ts +0 -54
- package/assets/plugin/live/user-data-active-probe.js +0 -180
- package/assets/plugin/live/user-data-stream-controller.d.ts +0 -200
- package/assets/plugin/live/user-data-stream-controller.js +0 -579
- package/assets/plugin/live/user-data-stream-ws.d.ts +0 -22
- package/assets/plugin/live/user-data-stream-ws.js +0 -63
- package/assets/plugin/live/user-data-stream.d.ts +0 -243
- package/assets/plugin/live/user-data-stream.js +0 -704
- package/assets/plugin/logger.d.ts +0 -2
- package/assets/plugin/logger.js +0 -2
- package/assets/plugin/mfe.d.ts +0 -21
- package/assets/plugin/mfe.js +0 -68
- package/assets/plugin/onboarding/mode-ladder.d.ts +0 -1
- package/assets/plugin/onboarding/mode-ladder.js +0 -3
- package/assets/plugin/onboarding/runtime.d.ts +0 -84
- package/assets/plugin/onboarding/runtime.js +0 -173
- package/assets/plugin/openclaw.plugin.json +0 -92
- package/assets/plugin/paper-adapter.d.ts +0 -24
- package/assets/plugin/paper-adapter.js +0 -91
- package/assets/plugin/persistence/state-manager.d.ts +0 -66
- package/assets/plugin/persistence/state-manager.js +0 -222
- package/assets/plugin/pinned-plan.d.ts +0 -9
- package/assets/plugin/pinned-plan.js +0 -23
- package/assets/plugin/portfolio/wave9-admission.d.ts +0 -67
- package/assets/plugin/portfolio/wave9-admission.js +0 -262
- package/assets/plugin/portfolio/wave9-policy.d.ts +0 -36
- package/assets/plugin/portfolio/wave9-policy.js +0 -183
- package/assets/plugin/risk/pre-trade-check.d.ts +0 -38
- package/assets/plugin/risk/pre-trade-check.js +0 -345
- package/assets/plugin/risk/pre-trade-types.d.ts +0 -60
- package/assets/plugin/risk/pre-trade-types.js +0 -3
- package/assets/plugin/shadow/shadow-tracker.d.ts +0 -36
- package/assets/plugin/shadow/shadow-tracker.js +0 -151
- package/assets/plugin/shadow/types.d.ts +0 -42
- package/assets/plugin/shadow/types.js +0 -20
- package/assets/plugin/shared/indicators-extended.d.ts +0 -52
- package/assets/plugin/shared/indicators-extended.js +0 -291
- package/assets/plugin/shared/indicators.d.ts +0 -15
- package/assets/plugin/shared/indicators.js +0 -114
- package/assets/plugin/signals/conditions/registry.d.ts +0 -16
- package/assets/plugin/signals/conditions/registry.js +0 -1324
- package/assets/plugin/signals/conditions/types.d.ts +0 -1
- package/assets/plugin/signals/conditions/types.js +0 -4
- package/assets/plugin/signals/direction-rules.d.ts +0 -3
- package/assets/plugin/signals/direction-rules.js +0 -24
- package/assets/plugin/signals/entry-rules.d.ts +0 -6
- package/assets/plugin/signals/entry-rules.js +0 -33
- package/assets/plugin/signals/serialize-context.d.ts +0 -4
- package/assets/plugin/signals/serialize-context.js +0 -39
- package/assets/plugin/signals/stop-rules.d.ts +0 -3
- package/assets/plugin/signals/stop-rules.js +0 -48
- package/assets/plugin/signals/strategy-adapter.d.ts +0 -47
- package/assets/plugin/signals/strategy-adapter.js +0 -199
- package/assets/plugin/signals/types.d.ts +0 -1
- package/assets/plugin/signals/types.js +0 -8
- package/assets/plugin/simulator/exchange-simulator.d.ts +0 -93
- package/assets/plugin/simulator/exchange-simulator.js +0 -689
- package/assets/plugin/simulator/fill-engine.d.ts +0 -53
- package/assets/plugin/simulator/fill-engine.js +0 -280
- package/assets/plugin/simulator/paper-market-feed.d.ts +0 -26
- package/assets/plugin/simulator/paper-market-feed.js +0 -104
- package/assets/plugin/simulator/realistic-fills.d.ts +0 -59
- package/assets/plugin/simulator/realistic-fills.js +0 -175
- package/assets/plugin/simulator/types.d.ts +0 -224
- package/assets/plugin/simulator/types.js +0 -43
- package/assets/plugin/strategy/builtin-strategies.d.ts +0 -2
- package/assets/plugin/strategy/builtin-strategies.js +0 -113
- package/assets/plugin/strategy/condition-registry.d.ts +0 -3
- package/assets/plugin/strategy/condition-registry.js +0 -153
- package/assets/plugin/strategy/evaluator.d.ts +0 -70
- package/assets/plugin/strategy/evaluator.js +0 -98
- package/assets/plugin/tools/assessment-validation.d.ts +0 -120
- package/assets/plugin/tools/assessment-validation.js +0 -415
- package/assets/plugin/tools/attach-brackets.d.ts +0 -39
- package/assets/plugin/tools/attach-brackets.js +0 -399
- package/assets/plugin/tools/audit-bracket-protection.d.ts +0 -49
- package/assets/plugin/tools/audit-bracket-protection.js +0 -527
- package/assets/plugin/tools/cancel-all-orders.d.ts +0 -9
- package/assets/plugin/tools/cancel-all-orders.js +0 -8
- package/assets/plugin/tools/cancel-order.d.ts +0 -14
- package/assets/plugin/tools/cancel-order.js +0 -60
- package/assets/plugin/tools/check-position-health.d.ts +0 -46
- package/assets/plugin/tools/check-position-health.js +0 -194
- package/assets/plugin/tools/clear-exchange-credentials.d.ts +0 -24
- package/assets/plugin/tools/clear-exchange-credentials.js +0 -70
- package/assets/plugin/tools/close-position.d.ts +0 -45
- package/assets/plugin/tools/close-position.js +0 -722
- package/assets/plugin/tools/create-order.d.ts +0 -82
- package/assets/plugin/tools/create-order.js +0 -1516
- package/assets/plugin/tools/exit-gate.d.ts +0 -58
- package/assets/plugin/tools/exit-gate.js +0 -162
- package/assets/plugin/tools/fetch-balance.d.ts +0 -5
- package/assets/plugin/tools/fetch-balance.js +0 -4
- package/assets/plugin/tools/fetch-ohlcv.d.ts +0 -11
- package/assets/plugin/tools/fetch-ohlcv.js +0 -8
- package/assets/plugin/tools/fetch-open-orders.d.ts +0 -7
- package/assets/plugin/tools/fetch-open-orders.js +0 -4
- package/assets/plugin/tools/fetch-positions.d.ts +0 -7
- package/assets/plugin/tools/fetch-positions.js +0 -4
- package/assets/plugin/tools/fetch-ticker.d.ts +0 -11
- package/assets/plugin/tools/fetch-ticker.js +0 -5
- package/assets/plugin/tools/get-agent-profile.d.ts +0 -4
- package/assets/plugin/tools/get-agent-profile.js +0 -6
- package/assets/plugin/tools/get-analytics.d.ts +0 -6
- package/assets/plugin/tools/get-analytics.js +0 -7
- package/assets/plugin/tools/get-backtest.d.ts +0 -12
- package/assets/plugin/tools/get-backtest.js +0 -91
- package/assets/plugin/tools/get-basis.d.ts +0 -7
- package/assets/plugin/tools/get-basis.js +0 -7
- package/assets/plugin/tools/get-bracket-config.d.ts +0 -11
- package/assets/plugin/tools/get-bracket-config.js +0 -24
- package/assets/plugin/tools/get-cascade-risk.d.ts +0 -7
- package/assets/plugin/tools/get-cascade-risk.js +0 -8
- package/assets/plugin/tools/get-crypto-metrics.d.ts +0 -18
- package/assets/plugin/tools/get-crypto-metrics.js +0 -62
- package/assets/plugin/tools/get-cvd.d.ts +0 -6
- package/assets/plugin/tools/get-cvd.js +0 -6
- package/assets/plugin/tools/get-divergences.d.ts +0 -6
- package/assets/plugin/tools/get-divergences.js +0 -6
- package/assets/plugin/tools/get-funding-context.d.ts +0 -6
- package/assets/plugin/tools/get-funding-context.js +0 -16
- package/assets/plugin/tools/get-liquidation-levels.d.ts +0 -7
- package/assets/plugin/tools/get-liquidation-levels.js +0 -7
- package/assets/plugin/tools/get-liquidation-pulse.d.ts +0 -9
- package/assets/plugin/tools/get-liquidation-pulse.js +0 -22
- package/assets/plugin/tools/get-market-breadth.d.ts +0 -6
- package/assets/plugin/tools/get-market-breadth.js +0 -8
- package/assets/plugin/tools/get-market-intel.d.ts +0 -19
- package/assets/plugin/tools/get-market-intel.js +0 -116
- package/assets/plugin/tools/get-market-structure.d.ts +0 -47
- package/assets/plugin/tools/get-market-structure.js +0 -198
- package/assets/plugin/tools/get-my-mined-patterns.d.ts +0 -20
- package/assets/plugin/tools/get-my-mined-patterns.js +0 -61
- package/assets/plugin/tools/get-my-proposed-learnings.d.ts +0 -20
- package/assets/plugin/tools/get-my-proposed-learnings.js +0 -55
- package/assets/plugin/tools/get-my-recent-reviews.d.ts +0 -22
- package/assets/plugin/tools/get-my-recent-reviews.js +0 -66
- package/assets/plugin/tools/get-orderbook.d.ts +0 -21
- package/assets/plugin/tools/get-orderbook.js +0 -32
- package/assets/plugin/tools/get-pattern-scan.d.ts +0 -7
- package/assets/plugin/tools/get-pattern-scan.js +0 -8
- package/assets/plugin/tools/get-regime.d.ts +0 -6
- package/assets/plugin/tools/get-regime.js +0 -7
- package/assets/plugin/tools/get-relevant-learnings.d.ts +0 -21
- package/assets/plugin/tools/get-relevant-learnings.js +0 -65
- package/assets/plugin/tools/get-resting-liquidity.d.ts +0 -6
- package/assets/plugin/tools/get-resting-liquidity.js +0 -11
- package/assets/plugin/tools/get-risk-scenario.d.ts +0 -29
- package/assets/plugin/tools/get-risk-scenario.js +0 -47
- package/assets/plugin/tools/get-risk-summary.d.ts +0 -51
- package/assets/plugin/tools/get-risk-summary.js +0 -118
- package/assets/plugin/tools/get-sentiment.d.ts +0 -4
- package/assets/plugin/tools/get-sentiment.js +0 -6
- package/assets/plugin/tools/get-session-review.d.ts +0 -7
- package/assets/plugin/tools/get-session-review.js +0 -8
- package/assets/plugin/tools/get-setup-detail.d.ts +0 -7
- package/assets/plugin/tools/get-setup-detail.js +0 -311
- package/assets/plugin/tools/get-signals.d.ts +0 -15
- package/assets/plugin/tools/get-signals.js +0 -54
- package/assets/plugin/tools/get-sizing.d.ts +0 -6
- package/assets/plugin/tools/get-sizing.js +0 -6
- package/assets/plugin/tools/get-trade-feedback.d.ts +0 -7
- package/assets/plugin/tools/get-trade-feedback.js +0 -8
- package/assets/plugin/tools/get-trade-flow.d.ts +0 -7
- package/assets/plugin/tools/get-trade-flow.js +0 -7
- package/assets/plugin/tools/get-volume-analysis.d.ts +0 -21
- package/assets/plugin/tools/get-volume-analysis.js +0 -74
- package/assets/plugin/tools/get-volume-profile.d.ts +0 -7
- package/assets/plugin/tools/get-volume-profile.js +0 -7
- package/assets/plugin/tools/get-wave9-status.d.ts +0 -127
- package/assets/plugin/tools/get-wave9-status.js +0 -796
- package/assets/plugin/tools/helpers.d.ts +0 -26
- package/assets/plugin/tools/helpers.js +0 -39
- package/assets/plugin/tools/intel-api.d.ts +0 -34
- package/assets/plugin/tools/intel-api.js +0 -119
- package/assets/plugin/tools/intel-cache.d.ts +0 -25
- package/assets/plugin/tools/intel-cache.js +0 -148
- package/assets/plugin/tools/list-strategies.d.ts +0 -17
- package/assets/plugin/tools/list-strategies.js +0 -23
- package/assets/plugin/tools/modify-stop.d.ts +0 -21
- package/assets/plugin/tools/modify-stop.js +0 -120
- package/assets/plugin/tools/modify-target.d.ts +0 -21
- package/assets/plugin/tools/modify-target.js +0 -110
- package/assets/plugin/tools/propose-learning.d.ts +0 -22
- package/assets/plugin/tools/propose-learning.js +0 -65
- package/assets/plugin/tools/query-review-outcomes.d.ts +0 -30
- package/assets/plugin/tools/query-review-outcomes.js +0 -64
- package/assets/plugin/tools/query-trades.d.ts +0 -21
- package/assets/plugin/tools/query-trades.js +0 -37
- package/assets/plugin/tools/record-position-reviews.d.ts +0 -38
- package/assets/plugin/tools/record-position-reviews.js +0 -147
- package/assets/plugin/tools/save-strategy.d.ts +0 -16
- package/assets/plugin/tools/save-strategy.js +0 -46
- package/assets/plugin/tools/scan-pairs.d.ts +0 -18
- package/assets/plugin/tools/scan-pairs.js +0 -231
- package/assets/plugin/tools/score-setup.d.ts +0 -31
- package/assets/plugin/tools/score-setup.js +0 -268
- package/assets/plugin/tools/set-bracket-requirement.d.ts +0 -18
- package/assets/plugin/tools/set-bracket-requirement.js +0 -81
- package/assets/plugin/tools/set-exchange-credentials.d.ts +0 -25
- package/assets/plugin/tools/set-exchange-credentials.js +0 -80
- package/assets/plugin/tools/set-trading-mode.d.ts +0 -26
- package/assets/plugin/tools/set-trading-mode.js +0 -135
- package/assets/plugin/tools/test-exchange-credentials.d.ts +0 -16
- package/assets/plugin/tools/test-exchange-credentials.js +0 -100
- package/assets/plugin/tools/toggle-strategy.d.ts +0 -8
- package/assets/plugin/tools/toggle-strategy.js +0 -15
- package/assets/plugin/trading-params-cache.d.ts +0 -26
- package/assets/plugin/trading-params-cache.js +0 -52
- package/assets/plugin/types.d.ts +0 -134
- package/assets/plugin/types.js +0 -7
- package/assets/plugin/util/plugin-paths.d.ts +0 -3
- package/assets/plugin/util/plugin-paths.js +0 -15
- package/assets/plugin/venues/hyperliquid/hl-balance.d.ts +0 -116
- package/assets/plugin/venues/hyperliquid/hl-balance.js +0 -145
- package/assets/plugin/venues/hyperliquid/hl-brackets.d.ts +0 -102
- package/assets/plugin/venues/hyperliquid/hl-brackets.js +0 -172
- package/assets/plugin/venues/hyperliquid/hl-cloid.d.ts +0 -22
- package/assets/plugin/venues/hyperliquid/hl-cloid.js +0 -82
- package/assets/plugin/venues/hyperliquid/hl-info-cache.d.ts +0 -46
- package/assets/plugin/venues/hyperliquid/hl-info-cache.js +0 -125
- package/assets/plugin/venues/hyperliquid/hl-live-adapter.d.ts +0 -88
- package/assets/plugin/venues/hyperliquid/hl-live-adapter.js +0 -353
- package/assets/plugin/venues/hyperliquid/hl-precision.d.ts +0 -61
- package/assets/plugin/venues/hyperliquid/hl-precision.js +0 -176
- package/assets/plugin/venues/hyperliquid/hl-private.d.ts +0 -88
- package/assets/plugin/venues/hyperliquid/hl-private.js +0 -357
- package/assets/plugin/venues/hyperliquid/hl-public.d.ts +0 -79
- package/assets/plugin/venues/hyperliquid/hl-public.js +0 -429
- package/assets/plugin/venues/hyperliquid/hl-rate-gate.d.ts +0 -57
- package/assets/plugin/venues/hyperliquid/hl-rate-gate.js +0 -220
- package/assets/plugin/venues/hyperliquid/hl-user-stream.d.ts +0 -90
- package/assets/plugin/venues/hyperliquid/hl-user-stream.js +0 -220
- package/assets/plugin/venues/registry.d.ts +0 -38
- package/assets/plugin/venues/registry.js +0 -46
- package/assets/plugin/venues/symbols.d.ts +0 -43
- package/assets/plugin/venues/symbols.js +0 -107
- package/assets/plugin/wave9/live-account-capture.d.ts +0 -67
- package/assets/plugin/wave9/live-account-capture.js +0 -435
- package/assets/plugin/wave9/live-autonomous-protection.d.ts +0 -39
- package/assets/plugin/wave9/live-autonomous-protection.js +0 -112
- package/assets/plugin/wave9/live-durable-reconciliation-scheduler.d.ts +0 -33
- package/assets/plugin/wave9/live-durable-reconciliation-scheduler.js +0 -115
- package/assets/plugin/wave9/live-execution-ledger.d.ts +0 -107
- package/assets/plugin/wave9/live-execution-ledger.js +0 -498
- package/assets/plugin/wave9/live-position-confirmation.d.ts +0 -18
- package/assets/plugin/wave9/live-position-confirmation.js +0 -111
- package/assets/plugin/wave9/live-residual-protection.d.ts +0 -18
- package/assets/plugin/wave9/live-residual-protection.js +0 -250
- package/assets/plugin/wave9/live-startup-reconciliation.d.ts +0 -38
- package/assets/plugin/wave9/live-startup-reconciliation.js +0 -454
- package/assets/plugin/wave9/live-symbol-ownership.d.ts +0 -20
- package/assets/plugin/wave9/live-symbol-ownership.js +0 -132
- package/assets/plugin/wave9/paper-admission-guard.d.ts +0 -199
- package/assets/plugin/wave9/paper-admission-guard.js +0 -650
- package/assets/plugin/wave9/usdm-evidence-provider.d.ts +0 -42
- package/assets/plugin/wave9/usdm-evidence-provider.js +0 -133
|
@@ -165,15 +165,25 @@ export function adaptStrategy(config, gateNamespace) {
|
|
|
165
165
|
const { conditions: pass1, condCtx } = evaluateConditions(config.conditions, ectx, null);
|
|
166
166
|
// Determine direction
|
|
167
167
|
const direction = resolveDirection(config.directionRule, ectx, condCtx);
|
|
168
|
-
// Pass 2:
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
// Pass 2: once the direction is known, re-evaluate the FULL condition
|
|
169
|
+
// array with it. Many registry conditions branch on `direction`
|
|
170
|
+
// (orderbook_imbalance, funding_contrarian, macd_crossover,
|
|
171
|
+
// bollinger_breakout, vwap_position, stoch_rsi_extreme, ichimoku_cloud,
|
|
172
|
+
// supertrend_direction, …) and their pass-1 result was computed against
|
|
173
|
+
// direction=null — typically the permissive either-side branch. A
|
|
174
|
+
// hand-curated allowlist here (the pre-fix 5-type set) silently drifted
|
|
175
|
+
// out of sync with the registry, so non-listed direction-dependent
|
|
176
|
+
// conditions kept their permissive pass-1 result forever (e.g. a
|
|
177
|
+
// fixed_long strategy's macd_crossover accepted a BEARISH crossover).
|
|
178
|
+
// Pass 2 always evaluated the whole array anyway — use it wholesale.
|
|
179
|
+
// Direction-insensitive conditions are pure functions of (ctx, params)
|
|
180
|
+
// and return identical results in both passes; entry/stop computation
|
|
181
|
+
// below deliberately keeps pass 1's condCtx (setter values don't depend
|
|
182
|
+
// on direction).
|
|
172
183
|
let finalConditions = pass1;
|
|
173
|
-
if (direction
|
|
184
|
+
if (direction) {
|
|
174
185
|
const { conditions: pass2 } = evaluateConditions(config.conditions, ectx, direction);
|
|
175
|
-
|
|
176
|
-
finalConditions = pass1.map((c, i) => directionSensitive.has(config.conditions[i].type) ? pass2[i] : c);
|
|
186
|
+
finalConditions = pass2;
|
|
177
187
|
}
|
|
178
188
|
const allMet = finalConditions.every(c => c.met);
|
|
179
189
|
let trade;
|
package/assets/skill/SKILL.md
CHANGED
|
@@ -80,6 +80,8 @@ OpenClaw can install the ReefClaw plugin through its own owner chat command —
|
|
|
80
80
|
2. Tell the user to type `/restart` in this chat.
|
|
81
81
|
3. Then the user types: `/plugins install clawhub:@reefclaw/openclaw-plugin` — the install restarts OpenClaw automatically; the bundled connector starts by itself and the dashboard flips to Connected.
|
|
82
82
|
|
|
83
|
+
If that install is **cancelled asking for a ClawHub risk acknowledgement** (OpenClaw 2026.7+ does this; older versions never ask and reject the flag), rerun the identical command with the acknowledgement appended: `/plugins install clawhub:@reefclaw/openclaw-plugin --acknowledge-clawhub-risk`. If it is still refused, use the `npx @reefclaw/connect` fallback — it does not go through ClawHub.
|
|
84
|
+
|
|
83
85
|
Only fall back to `npx @reefclaw/connect` (below) when the chat install is unavailable.
|
|
84
86
|
|
|
85
87
|
## If you cannot run the installer (elevated exec disabled)
|
package/dist/deps.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { writeFileSync, cpSync, mkdirSync, existsSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { run } from './exec.js';
|
|
8
|
-
export function writePackageJson(dir, name, deps, extra = {}) {
|
|
8
|
+
export function writePackageJson(dir, name, deps, extra = {}, version = '0.1.0') {
|
|
9
9
|
const pkg = {
|
|
10
10
|
name,
|
|
11
|
-
version
|
|
11
|
+
version,
|
|
12
12
|
private: true,
|
|
13
13
|
type: 'module',
|
|
14
14
|
main: 'index.js',
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Install + register the ReefClaw trading plugin (reefclaw-paper-trading) into
|
|
2
2
|
// the user's OpenClaw. Mirrors deploy-full.py: place dist, install deps, vendor
|
|
3
3
|
// shared, then `openclaw plugins install --link`.
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
4
5
|
import { join } from 'node:path';
|
|
5
6
|
import { PLUGIN_DIR, assetsDir, ASSET_PLUGIN, ASSET_SHARED } from './paths.js';
|
|
6
7
|
import { copyAsset, writePackageJson, npmInstall, vendorShared } from './deps.js';
|
|
@@ -8,6 +9,21 @@ import { run, which } from './exec.js';
|
|
|
8
9
|
import { step, ok, info, warn, fail } from './ui.js';
|
|
9
10
|
// Plugin runtime deps (mirror plugin/package.json). ws + ccxt; ccxt is large.
|
|
10
11
|
const PLUGIN_DEPS = { ccxt: '^4.4.0', ws: '^8.18.0' };
|
|
12
|
+
/** Version for the placed package.json — read from the bundled manifest (which
|
|
13
|
+
* bundle-assets stamps from the published plugin version). Falls back to the
|
|
14
|
+
* historical 0.1.0 placeholder so a missing/old manifest can't break installs. */
|
|
15
|
+
function readBundledManifestVersion(pluginDir) {
|
|
16
|
+
try {
|
|
17
|
+
const manifest = JSON.parse(readFileSync(join(pluginDir, 'openclaw.plugin.json'), 'utf-8'));
|
|
18
|
+
if (typeof manifest.version === 'string' && manifest.version.length > 0) {
|
|
19
|
+
return manifest.version;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
/* fall through to placeholder */
|
|
24
|
+
}
|
|
25
|
+
return '0.1.0';
|
|
26
|
+
}
|
|
11
27
|
export function installPlugin() {
|
|
12
28
|
step('Installing the ReefClaw trading plugin');
|
|
13
29
|
const assets = assetsDir();
|
|
@@ -17,9 +33,10 @@ export function installPlugin() {
|
|
|
17
33
|
// (2026.6+ hard-fails without it). The placed dir holds the built dist at top
|
|
18
34
|
// level, so the entry is ./index.js — NOT ./src/index.ts like the repo's
|
|
19
35
|
// plugin/package.json (see CLAUDE.md "dist/package.json's openclaw entry").
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
// Version comes from the bundled manifest (stamped at bundle time from the
|
|
37
|
+
// published plugin version) so package.json and openclaw.plugin.json agree —
|
|
38
|
+
// the same package/manifest coherence ClawHub validates on the npm channel.
|
|
39
|
+
writePackageJson(PLUGIN_DIR, 'reefclaw-paper-trading', PLUGIN_DEPS, { openclaw: { extensions: ['./index.js'] } }, readBundledManifestVersion(PLUGIN_DIR));
|
|
23
40
|
info('installing plugin dependencies (this can take a minute — ccxt is large)…');
|
|
24
41
|
if (!npmInstall(PLUGIN_DIR)) {
|
|
25
42
|
warn('npm install reported a problem; the plugin may still work if deps resolved.');
|
|
@@ -31,16 +48,27 @@ export function installPlugin() {
|
|
|
31
48
|
const cli = which('openclaw');
|
|
32
49
|
if (!cli) {
|
|
33
50
|
fail('the `openclaw` CLI is not on your PATH — cannot register the plugin.');
|
|
34
|
-
info(`Once OpenClaw is on PATH, run: openclaw plugins install --link ${PLUGIN_DIR}`);
|
|
51
|
+
info(`Once OpenClaw is on PATH, run: openclaw plugins install --force --link ${PLUGIN_DIR}`);
|
|
35
52
|
return { registered: false };
|
|
36
53
|
}
|
|
54
|
+
// --force is REQUIRED on openclaw >= 2026.7.2 (issue #216): non-ClawHub
|
|
55
|
+
// sources (incl. local paths) need an acknowledgement, and in a non-TTY
|
|
56
|
+
// context the install is cancelled with "rerun with --force" instead of
|
|
57
|
+
// prompting. Acknowledging is correct here — the "source" is our own bundled
|
|
58
|
+
// plugin the user explicitly chose to install by running this installer.
|
|
59
|
+
// On <= 2026.7.1, --force only means overwrite-an-existing-install, which
|
|
60
|
+
// also makes installer re-runs idempotent instead of failing on the exists
|
|
61
|
+
// check. Verified against both dists' plugins-install command + the beta's
|
|
62
|
+
// confirmNonClawHubInstall (install cancelled when !TTY && !force).
|
|
37
63
|
info('registering the plugin with OpenClaw…');
|
|
38
|
-
const r = run('openclaw', ['plugins', 'install', '--link', PLUGIN_DIR], {
|
|
64
|
+
const r = run('openclaw', ['plugins', 'install', '--force', '--link', PLUGIN_DIR], {
|
|
65
|
+
timeoutMs: 300_000,
|
|
66
|
+
});
|
|
39
67
|
if (!r.ok) {
|
|
40
|
-
warn('`openclaw plugins install --link` returned non-zero:');
|
|
68
|
+
warn('`openclaw plugins install --force --link` returned non-zero:');
|
|
41
69
|
if (r.stderr.trim())
|
|
42
70
|
info(r.stderr.trim().split('\n').slice(-3).join('\n'));
|
|
43
|
-
info(`Retry manually: openclaw plugins install --link ${PLUGIN_DIR}`);
|
|
71
|
+
info(`Retry manually: openclaw plugins install --force --link ${PLUGIN_DIR}`);
|
|
44
72
|
return { registered: false };
|
|
45
73
|
}
|
|
46
74
|
ok('plugin registered with OpenClaw');
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TradingMode } from '../types.js';
|
|
2
|
-
export interface ModeTransitionAuditEntry {
|
|
3
|
-
ts: string;
|
|
4
|
-
previousMode: TradingMode;
|
|
5
|
-
targetMode: TradingMode;
|
|
6
|
-
acknowledged: boolean;
|
|
7
|
-
ok: boolean;
|
|
8
|
-
reason?: string;
|
|
9
|
-
testnet?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function recordModeTransition(entry: Omit<ModeTransitionAuditEntry, 'ts'>, pluginId?: string): void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Mode-transition audit — append-only JSONL record of every set_trading_mode call.
|
|
2
|
-
//
|
|
3
|
-
// Written BEFORE the adapter swap (so even a crashed transition leaves a trail)
|
|
4
|
-
// and updated with the outcome. Intended for post-incident review and regulatory
|
|
5
|
-
// defence ("the operator acknowledged the LIVE transition at 2026-04-20T14:32:11Z").
|
|
6
|
-
//
|
|
7
|
-
// Path: ~/.openclaw/plugins/<pluginId>/mode-transitions.jsonl
|
|
8
|
-
// Append-only; never truncated. One JSON object per line.
|
|
9
|
-
import { appendFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
10
|
-
import { join } from 'node:path';
|
|
11
|
-
import { logger, formatError } from '../logger.js';
|
|
12
|
-
import { resolvePluginsBaseDir } from '../util/plugin-paths.js';
|
|
13
|
-
const TAG = 'mode-audit';
|
|
14
|
-
function resolvePath(pluginId) {
|
|
15
|
-
const dir = join(resolvePluginsBaseDir(), pluginId ?? 'reefclaw-paper-trading');
|
|
16
|
-
if (!existsSync(dir))
|
|
17
|
-
mkdirSync(dir, { recursive: true });
|
|
18
|
-
return join(dir, 'mode-transitions.jsonl');
|
|
19
|
-
}
|
|
20
|
-
export function recordModeTransition(entry, pluginId) {
|
|
21
|
-
const full = { ts: new Date().toISOString(), ...entry };
|
|
22
|
-
try {
|
|
23
|
-
appendFileSync(resolvePath(pluginId), JSON.stringify(full) + '\n', 'utf8');
|
|
24
|
-
logger.info(TAG, `${full.previousMode} → ${full.targetMode} ok=${full.ok} ack=${full.acknowledged}`);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
logger.error(TAG, `Failed to write audit entry: ${formatError(err)}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { CcxtBalance } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Read the total quote-currency balance from a CCXT balance map.
|
|
4
|
-
*
|
|
5
|
-
* Uses the PRIMARY funded currency only — whichever of USDT/USDC has
|
|
6
|
-
* the larger balance. Summing both was incorrect because Binance
|
|
7
|
-
* cross-margin accounting reports position margin/value as a phantom
|
|
8
|
-
* balance in the settlement currency (e.g., opening an ATOM/USDT
|
|
9
|
-
* position with a USDC-funded account creates a USDT "balance" entry
|
|
10
|
-
* equal to the position's notional, inflating getQuoteBalance by the
|
|
11
|
-
* position value and causing the KPI to double-count).
|
|
12
|
-
*
|
|
13
|
-
* For wallet/equity/NAV reads on Binance Futures, prefer
|
|
14
|
-
* `getQuoteWalletBalance(balance)` — it handles BNFCR.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getQuoteBalance(balanceMap: Record<string, number> | undefined): number;
|
|
17
|
-
/**
|
|
18
|
-
* Read the effective wallet-equivalent quote balance from a Binance Futures
|
|
19
|
-
* fetchBalance response, including the BNFCR realized-PnL accumulator.
|
|
20
|
-
*
|
|
21
|
-
* Why this exists: Binance multi-asset accounts settle realized PnL into
|
|
22
|
-
* BNFCR (negative when net-loss, positive when net-gain). CCXT's `total`
|
|
23
|
-
* map carries `marginBalance` (= walletBalance + uPnl), so the BNFCR line
|
|
24
|
-
* mixes uPnl into the total, which double-counts when the caller adds
|
|
25
|
-
* position uPnl on top. This helper reads `info.assets[i].walletBalance`
|
|
26
|
-
* directly, which excludes uPnl by construction.
|
|
27
|
-
*
|
|
28
|
-
* Returns max(USDT_wallet, USDC_wallet) + BNFCR_wallet. BNFCR is added
|
|
29
|
-
* (not max'd) because it is independent of the funded stablecoin — a
|
|
30
|
-
* USDC-funded account with cumulative losses shows USDC unchanged plus
|
|
31
|
-
* BNFCR negative; the user's true wallet is the sum.
|
|
32
|
-
*
|
|
33
|
-
* Falls back to `getQuoteBalance(balance.total)` when `info.assets` is
|
|
34
|
-
* absent (mock balances in unit tests, non-Binance exchanges).
|
|
35
|
-
*/
|
|
36
|
-
export declare function getQuoteWalletBalance(balance: CcxtBalance | null | undefined): number;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// Utility for reading quote-currency balance from CCXT balance objects.
|
|
2
|
-
// Binance USDⓈ-M Futures settles in USDT or USDC — accounts may hold either or both.
|
|
3
|
-
// On multi-asset accounts a third asset, BNFCR, accumulates realized PnL as a
|
|
4
|
-
// signed wallet line (negative = cumulative loss, positive = cumulative gain).
|
|
5
|
-
/**
|
|
6
|
-
* Read the total quote-currency balance from a CCXT balance map.
|
|
7
|
-
*
|
|
8
|
-
* Uses the PRIMARY funded currency only — whichever of USDT/USDC has
|
|
9
|
-
* the larger balance. Summing both was incorrect because Binance
|
|
10
|
-
* cross-margin accounting reports position margin/value as a phantom
|
|
11
|
-
* balance in the settlement currency (e.g., opening an ATOM/USDT
|
|
12
|
-
* position with a USDC-funded account creates a USDT "balance" entry
|
|
13
|
-
* equal to the position's notional, inflating getQuoteBalance by the
|
|
14
|
-
* position value and causing the KPI to double-count).
|
|
15
|
-
*
|
|
16
|
-
* For wallet/equity/NAV reads on Binance Futures, prefer
|
|
17
|
-
* `getQuoteWalletBalance(balance)` — it handles BNFCR.
|
|
18
|
-
*/
|
|
19
|
-
export function getQuoteBalance(balanceMap) {
|
|
20
|
-
if (!balanceMap)
|
|
21
|
-
return 0;
|
|
22
|
-
const usdt = balanceMap.USDT ?? 0;
|
|
23
|
-
const usdc = balanceMap.USDC ?? 0;
|
|
24
|
-
// Use whichever currency has the larger wallet balance (the funded one).
|
|
25
|
-
// If both are zero, return 0. If both are funded, use the larger.
|
|
26
|
-
return Math.max(usdt, usdc);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Read the effective wallet-equivalent quote balance from a Binance Futures
|
|
30
|
-
* fetchBalance response, including the BNFCR realized-PnL accumulator.
|
|
31
|
-
*
|
|
32
|
-
* Why this exists: Binance multi-asset accounts settle realized PnL into
|
|
33
|
-
* BNFCR (negative when net-loss, positive when net-gain). CCXT's `total`
|
|
34
|
-
* map carries `marginBalance` (= walletBalance + uPnl), so the BNFCR line
|
|
35
|
-
* mixes uPnl into the total, which double-counts when the caller adds
|
|
36
|
-
* position uPnl on top. This helper reads `info.assets[i].walletBalance`
|
|
37
|
-
* directly, which excludes uPnl by construction.
|
|
38
|
-
*
|
|
39
|
-
* Returns max(USDT_wallet, USDC_wallet) + BNFCR_wallet. BNFCR is added
|
|
40
|
-
* (not max'd) because it is independent of the funded stablecoin — a
|
|
41
|
-
* USDC-funded account with cumulative losses shows USDC unchanged plus
|
|
42
|
-
* BNFCR negative; the user's true wallet is the sum.
|
|
43
|
-
*
|
|
44
|
-
* Falls back to `getQuoteBalance(balance.total)` when `info.assets` is
|
|
45
|
-
* absent (mock balances in unit tests, non-Binance exchanges).
|
|
46
|
-
*/
|
|
47
|
-
export function getQuoteWalletBalance(balance) {
|
|
48
|
-
if (!balance)
|
|
49
|
-
return 0;
|
|
50
|
-
// Prefer Binance's own account-level wallet aggregate when present.
|
|
51
|
-
// `/fapi/v3/account` (CCXT passes it through verbatim at `info`) returns
|
|
52
|
-
// `totalWalletBalance` — in Multi-Assets Mode this is the USD-denominated
|
|
53
|
-
// sum across all margin assets, with each non-USD collateral valued at
|
|
54
|
-
// Binance's live index price (verified against developers.binance.com →
|
|
55
|
-
// Account Information V3, 2026-05-16). It also excludes uPnL by
|
|
56
|
-
// construction (marginBalance = walletBalance + uPnL), matching this
|
|
57
|
-
// function's "wallet, uPnL added by caller" contract.
|
|
58
|
-
//
|
|
59
|
-
// Why this beats the per-asset reconstruction below: summing
|
|
60
|
-
// `max(USDT,USDC) + BNFCR` values USDC at FACE 1.0000, but Binance values
|
|
61
|
-
// USDC collateral at the live USDC/USD index (~0.9998). That made the
|
|
62
|
-
// dashboard wallet permanently ~$0.2 high vs the Binance app on this
|
|
63
|
-
// account (always-on, same-sign, slowly varying with the USDC peg —
|
|
64
|
-
// 2026-05-16 "figures slightly off always"). totalWalletBalance is the
|
|
65
|
-
// exact number the app's Futures "Wallet Balance" shows. The read path is
|
|
66
|
-
// already REST (`LiveAdapter.getBalance` → `fetchBalance()` every poll),
|
|
67
|
-
// so this is zero freshness regression — same cadence, correct value.
|
|
68
|
-
const info = balance?.info;
|
|
69
|
-
if (info && info.totalWalletBalance != null) {
|
|
70
|
-
const twb = parseFloat(String(info.totalWalletBalance));
|
|
71
|
-
if (Number.isFinite(twb))
|
|
72
|
-
return twb;
|
|
73
|
-
}
|
|
74
|
-
// Fallback (no Binance aggregate — non-Binance exchange, mock balances in
|
|
75
|
-
// unit tests, or a WS-store-derived balance object): the legacy
|
|
76
|
-
// face-value per-asset reconstruction. Carries the documented ~USDC-index
|
|
77
|
-
// drift but is the best available when the aggregate is absent.
|
|
78
|
-
const assets = balance?.info?.assets;
|
|
79
|
-
if (!Array.isArray(assets))
|
|
80
|
-
return getQuoteBalance(balance.total);
|
|
81
|
-
let usdt = 0;
|
|
82
|
-
let usdc = 0;
|
|
83
|
-
let bnfcr = 0;
|
|
84
|
-
for (const a of assets) {
|
|
85
|
-
if (!a || typeof a.asset !== 'string')
|
|
86
|
-
continue;
|
|
87
|
-
const wb = parseFloat(String(a.walletBalance ?? 0));
|
|
88
|
-
if (!Number.isFinite(wb))
|
|
89
|
-
continue;
|
|
90
|
-
if (a.asset === 'USDT')
|
|
91
|
-
usdt = wb;
|
|
92
|
-
else if (a.asset === 'USDC')
|
|
93
|
-
usdc = wb;
|
|
94
|
-
else if (a.asset === 'BNFCR')
|
|
95
|
-
bnfcr = wb;
|
|
96
|
-
}
|
|
97
|
-
return Math.max(usdt, usdc) + bnfcr;
|
|
98
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/** Thrown by `assertNotBanned` while the gate is closed. Carries the
|
|
2
|
-
* remaining cooldown so callers/telemetry can reason about it. Methods
|
|
3
|
-
* catch this in their existing catch block — it is NOT meant to escape
|
|
4
|
-
* the API layer with special handling; it degrades to the method's normal
|
|
5
|
-
* failure contract. */
|
|
6
|
-
export declare class BinanceBannedError extends Error {
|
|
7
|
-
readonly retryAfterMs: number;
|
|
8
|
-
constructor(retryAfterMs: number, context: string);
|
|
9
|
-
}
|
|
10
|
-
/** Thrown by the proactive weight pacer. Subclass of BinanceBannedError so
|
|
11
|
-
* every `instanceof BinanceBannedError` check and every method's existing
|
|
12
|
-
* catch keep working unchanged — it degrades to the same null/[]/throw
|
|
13
|
-
* contract (treated exactly like a transient fetch failure). The distinct
|
|
14
|
-
* name lets journal/telemetry tell prevention apart from a real IP ban. */
|
|
15
|
-
export declare class BinanceWeightPacedError extends BinanceBannedError {
|
|
16
|
-
constructor(retryAfterMs: number, context: string);
|
|
17
|
-
}
|
|
18
|
-
/** Fast pre-flight check. Call as the first line inside a Binance call's
|
|
19
|
-
* try-block. Throws `BinanceBannedError` (no network) while the gate is
|
|
20
|
-
* open. */
|
|
21
|
-
export declare function assertNotBanned(context: string): void;
|
|
22
|
-
/** Inspect a failed call's error and arm/extend the gate on a Binance
|
|
23
|
-
* rate-limit signal. Non-rate-limit errors are ignored (normal transient
|
|
24
|
-
* handling stays in the caller). Safe to call with any error shape. */
|
|
25
|
-
export declare function noteBinanceError(err: unknown): void;
|
|
26
|
-
/** Relax the soft-429 ladder after a clean call. (A hard 418 window is NOT
|
|
27
|
-
* shortened by this — only Binance's stated expiry clears it.) */
|
|
28
|
-
export declare function noteSuccess(): void;
|
|
29
|
-
/** Reconcile the local weight estimate against Binance truth from a response
|
|
30
|
-
* header (`x-mbx-used-weight-1m`). Best-effort: callers pass whatever header
|
|
31
|
-
* bag they have; absent/garbage values are ignored. The local estimate
|
|
32
|
-
* leads (counts in-flight calls Binance hasn't tallied yet), so we take the
|
|
33
|
-
* MAX within the window — never let a lagging header lower our guard. A
|
|
34
|
-
* header far BELOW the estimate means Binance's minute rolled; re-anchor the
|
|
35
|
-
* window to Binance's clock so we don't shed for a stale local total. */
|
|
36
|
-
export declare function noteResponseWeight(headers: Record<string, string> | undefined | null): void;
|
|
37
|
-
/** Test/diagnostic helper — current gate state. */
|
|
38
|
-
export declare function getBanGateState(): {
|
|
39
|
-
banUntilMs: number;
|
|
40
|
-
remainingMs: number;
|
|
41
|
-
rateLimitStep: number;
|
|
42
|
-
weightUsed: number;
|
|
43
|
-
weightCeiling: number;
|
|
44
|
-
cosmeticCeiling: number;
|
|
45
|
-
};
|
|
46
|
-
/** Test-only reset. Not used in production code paths. */
|
|
47
|
-
export declare function __resetBanGateForTests(): void;
|