Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
| src/binance-coinmarketcap-data/ | scripts/binance-coinmarketcap-data.user.js |
| src/binance-strategy27-events/ | scripts/binance-strategy27-events.user.js |
| src/binance-strategy29-bollinger/ | scripts/binance-strategy29-bollinger.user.js |
| src/binance-strategy31-volume-reversal/ | scripts/binance-strategy31-volume-reversal.user.js |
| src/m3u8-downloader/ | scripts/m3u8-downloader.user.js |

- Other scripts remain hand-maintained under scripts/*.user.js until migrated.
Expand All @@ -37,6 +38,7 @@
| Orderbook browser, Tampermonkey, CDP, performance, or live evidence | docs/binance-orderbook-trade-ui-automation.md |
| Strategy 27 gateway, chart, or entity contract | docs/binance-strategy27-events-development.md |
| Strategy 29 observer or cross-script chart coordination | docs/binance-strategy29-bollinger-development.md |
| Strategy 31 server signals or chart annotations | docs/binance-strategy31-volume-reversal-development.md |
| Brooks/m3u8 indexing, export state, timing, or captions | docs/brooks-media-sync-workflow.md |
| Trading-data, CoinMarketCap-data, auto-refresh, or cross-script validation | docs/userscript-validation.md |
| Behavioral tests, test lint, affected selection, or source coverage | docs/test-policy.md |
Expand All @@ -58,6 +60,7 @@
| src/binance-trading-data/**, src/binance-coinmarketcap-data/**, or src/shared/** | npm run build:binance-userscripts or the affected single-script build |
| src/binance-strategy27-events/** | npm run build:binance-strategy27-events |
| src/binance-strategy29-bollinger/** | npm run build:binance-strategy29-bollinger |
| src/binance-strategy31-volume-reversal/** | npm run build:binance-strategy31-volume-reversal |
| src/m3u8-downloader/** | npm run build:m3u8-downloader |

- Publish, ship, or merge to main only through a GitHub PR when the current
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ This repository is the source of truth and distribution point for the scripts. G
| Script | Target | Description | Source of truth | Install |
| --- | --- | --- | --- | --- |
| Binance Strategy 29 Bollinger signals | Binance Futures | Annotate native loaded candles and show cross-timeframe server summaries through the shared gateway | This repository | [Install][install-binance-strategy29-bollinger] |
| Binance Strategy 31 volume reversal | Binance Futures | Show server-confirmed red-to-green higher-volume candles as upward arrows | This repository | [Install](https://raw.githubusercontent.com/jackhai9/userscripts/main/scripts/binance-strategy31-volume-reversal.user.js) |
| Binance orderbook one-click order entry | Binance Futures | Click an orderbook price, infer the current open/close tab, fill quantity, and submit an order with a multiplier panel | This repository | [Install][install-binance-orderbook-trade] |
| Binance Futures data panel | Binance Futures | Overlay open interest, long/short ratios, funding rate, basis, and directional signals | This repository | [Install][install-binance-trading-data] |
| Binance CoinMarketCap data panel | Binance Futures | Show CoinMarketCap valuation, supply, and liquidity data for the current symbol | This repository | [Install][install-binance-coinmarketcap-data] |
| Binance CorsairQuant signal client | Binance Futures | Annotate Strategy27 events and provide the shared private gateway connection for Strategy29 | This repository | [Install][install-binance-strategy27-events] |
| Binance CorsairQuant signal client | Binance Futures | Annotate Strategy27 events and provide the shared private gateway connection for Strategy29 and Strategy31 | This repository | [Install][install-binance-strategy27-events] |
| Auto refresh | Any page | Refresh selected pages on a configurable schedule | This repository | [Install][install-auto-refresh] |
| CoinMarketCap valuation labels | CoinMarketCap | Label and highlight circulating market cap and FDV / total valuation in the Chinese UI | This repository | [Install][install-coinmarketcap-valuation-helper] |
| m3u8 downloader | Video pages | Enhanced m3u8 detection and export workflow for allowlisted video sites | This repository | [Install][install-m3u8] |
Expand Down Expand Up @@ -99,7 +100,7 @@ npm run build:binance-userscripts
## Maintenance Rules

1. Each script has exactly one source of truth.
2. `src/binance-orderbook-trade/`, `src/binance-trading-data/`, `src/binance-coinmarketcap-data/`, `src/binance-strategy27-events/`, `src/binance-strategy29-bollinger/`, and `src/m3u8-downloader/` are source directories for the corresponding generated scripts.
2. `src/binance-orderbook-trade/`, `src/binance-trading-data/`, `src/binance-coinmarketcap-data/`, `src/binance-strategy27-events/`, `src/binance-strategy29-bollinger/`, `src/binance-strategy31-volume-reversal/`, and `src/m3u8-downloader/` are source directories for the corresponding generated scripts.
3. Public install entry points remain generated files under `scripts/*.user.js`.
4. Do not copy script source into secondary repositories.
5. Bump `@version` when behavior changes.
Expand Down
5 changes: 3 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
| 脚本 | 适用场景 | 说明 | 源码真源 | 安装 |
|---|---|---|---|---|
| 【自写】Binance Strategy 29 布林带信号 | Binance Futures | 标注本地图表信号,并通过共享网关显示服务端跨周期汇总 | 本仓库 | [安装][install-binance-strategy29-bollinger] |
| Binance Strategy 31 放量信号 | Binance Futures | 在服务端确认的前红后绿、绿 K 放量形态下方画上涨箭头 | 本仓库 | [安装](https://raw.githubusercontent.com/jackhai9/userscripts/main/scripts/binance-strategy31-volume-reversal.user.js) |
| 【自写】Binance 订单簿单击下单 | Binance Futures | 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 | 本仓库 | [`点击安装`][install-binance-orderbook-trade] |
| 【自写】Binance 合约交易数据面板 | Binance Futures | 在合约交易页面叠加浮动面板,定时拉取交易数据(持仓量、多空比、资金费率等)并显示当前值 + 多空信号 | 本仓库 | [`点击安装`][install-binance-trading-data] |
| 【自写】Binance CoinMarketCap 数据面板 | Binance Futures | 在 Binance 合约页面显示当前币种的 CoinMarketCap 估值、供应量和流动性数据 | 本仓库 | [`点击安装`][install-binance-coinmarketcap-data] |
| 【自写】Binance Strategy 27 事件标注(CorsairQuant 信号客户端) | Binance Futures | 标注 Strategy27 事件,保存共享网关配置并为 Strategy29 提供只读连接 | 本仓库 | [`点击安装`][install-binance-strategy27-events] |
| 【自写】Binance Strategy 27 事件标注(CorsairQuant 信号客户端) | Binance Futures | 标注 Strategy27 事件,保存共享网关配置并为 Strategy29 和 Strategy31 提供只读连接 | 本仓库 | [`点击安装`][install-binance-strategy27-events] |
| 【自写】定时刷新指定页面 | Any page | 指定页面按设定时间自动刷新 | 本仓库 | [`点击安装`][install-auto-refresh] |
| 【自写】CoinMarketCap 估值口径命名 | CoinMarketCap | 在中文币种页面左上角统计区标注并高亮流通市值和 FDV / 总估值 | 本仓库 | [`点击安装`][install-coinmarketcap-valuation-helper] |
| 【改写】m3u8-downloader | Video pages | m3u8 下载增强脚本,仅在白名单视频站启用 | 本仓库 | [`点击安装`][install-m3u8] |
Expand Down Expand Up @@ -96,7 +97,7 @@ npm run build:binance-userscripts
## 维护规则

1. 同一脚本只允许一个真源仓库改代码。
2. `src/binance-orderbook-trade/`、`src/binance-trading-data/`、`src/binance-coinmarketcap-data/`、`src/binance-strategy27-events/`、`src/binance-strategy29-bollinger/`、`src/m3u8-downloader/` 是对应脚本的开发真源。
2. `src/binance-orderbook-trade/`、`src/binance-trading-data/`、`src/binance-coinmarketcap-data/`、`src/binance-strategy27-events/`、`src/binance-strategy29-bollinger/`、`src/binance-strategy31-volume-reversal/`、`src/m3u8-downloader/` 是对应脚本的开发真源。
3. 公开安装入口仍是生成后的 `scripts/*.user.js`;修改对应 `src/` 后运行 `npm run build:binance-userscripts` 或单脚本 build 命令。
4. 非真源仓库只放安装链接,不复制脚本源码。
5. 行为变更时递增 `@version`;纯文档变更不需要 bump,并保留 `@updateURL/@downloadURL` 指向真源 raw 地址。
Expand Down
7 changes: 4 additions & 3 deletions docs/binance-strategy27-events-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ V10 live projection. The VPS remains the only market-data and event-analysis
authority. The userscript opens no Binance market-data WebSocket, uses no
Binance API key, and does not recalculate the four force groups.

Version 0.6.5 retains this installation's private gateway configuration and
Version 0.6.6 retains this installation's private gateway configuration and
provides a shared read-only transport. Strategy29 owns its own summary panel,
lifecycle and panel position. The existing `strategy27GatewayOrigin` and
`strategy27GatewayAuthSecret` storage keys remain the single credential source;
Expand All @@ -25,7 +25,8 @@ Strategy27 ownership of the new panel. Invalid old coordinates are reported to
Strategy29 without preventing the shared provider or Strategy27 from starting.

The page-visible `jh-userscripts.signal-gateway` capability exposes only fixed
Strategy29 status and event reads. It is intentionally a public-data capability:
Strategy29 status/event reads and bounded Strategy31 event snapshots. It is
intentionally a public-data capability:
page code can request the allowed observation data, but cannot obtain the secret,
select another origin, set request headers or send a write. Future strategy
routes require an explicit allowlist extension and contract review.
Expand Down Expand Up @@ -168,7 +169,7 @@ ADR 032 in CorsairQuant owns the server-side rule and transport contract. The
browser does not reconstruct candidates from ordinary events or recalculate
market evidence. The client, lifecycle, panel, native chart layer and optional-job
controller are wired into the entrypoint and tested together. The source and
generated install artifact are version 0.6.5 with identical metadata headers.
generated install artifact are version 0.6.6 with identical metadata headers.
The generated artifact passes syntax, release-contract and isolated execution
checks, including candidate delivery, paired entities, clear and context stop.
Binance operator-page validation remains outstanding. Server/gateway rollout
Expand Down
4 changes: 2 additions & 2 deletions docs/binance-strategy29-bollinger-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ already-loaded native chart candles. The summary reads the authenticated
unified loopback gateway; it does not call Binance market-data or account APIs,
submit orders, rotate hidden charts, or add remote events as chart drawings.

Install Strategy29 0.5.5 with orderbook 2.7.199 or later, or use it alone.
Install CorsairQuant signal client 0.6.5 for the remote summary.
Install Strategy29 0.5.6 with orderbook 2.7.199 or later, or use it alone.
Install CorsairQuant signal client 0.6.6 for the remote summary.
Do not combine it with the embedded observer in orderbook 2.7.198.
After updating/disabling the old script, reload the page. An embedded observer
is an explicit conflict: Strategy29 stops and displays an upgrade/reload notice.
Expand Down
36 changes: 36 additions & 0 deletions docs/binance-strategy31-volume-reversal-development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Strategy31 volume reversal signals

Source: `src/binance-strategy31-volume-reversal/`. Installer:
`scripts/binance-strategy31-volume-reversal.user.js` (0.1.0).
Install alongside CorsairQuant signal client 0.6.6, which owns private gateway
authentication. The shared bridge explicitly advertises the `strategy31` capability.

CorsairQuant confirms consecutive closed red/green candles when green base volume
strictly exceeds red base volume. This client reads native chart candle times
only to limit rendering to loaded history; it does not detect signals locally.
It requests a bounded snapshot of up to 200 retained
events for the current canonical symbol and native timeframe every five seconds.
Hidden documents suspend requests; navigation and settings revisions invalidate
late responses. Repeated snapshots reconcile one arrow per stable event ID.
Interval changes preserve the native data-completion subscription. Unsupported
periods and non-USDT markets pause observation until a supported chart is selected.
A transient native candle snapshot inconsistency retains existing arrows and
waits for the next sample; malformed signal contracts still stop the observer.
Loading earlier
chart history makes matching retained server events eligible for rendering.

The client uses the existing native marker layer, exact interval visibility,
readback and drawing-save coordination. The green arrow anchors at the green
candle's open time and low. No exchange/account API or trading action is called.
The projection is recent retained history, not all visible chart history.

The shared capability permits only `/v1/strategy31/events` with exactly `symbol`,
`timeframe` and `limit=200`. It does not expose credentials or an arbitrary URL
proxy. Server contract uses schema 1 and `31_2_spec_v1`. Invalid event identity,
coordinates or numeric values stop this observer with a visible status.

Build with `npm run build:binance-strategy31-volume-reversal`; validate with
`npm run lint:tests`, `npm test`, `npm run check:binance-userscripts` and the
repository's browser suite. DOM integration tests use the shared native host
fixture, exercising actual marker rendering and stale-response rejection.
Fixture results do not establish current Binance rendering or installed code.
2 changes: 2 additions & 0 deletions docs/signal-gateway-architecture.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Gateway(网关)是 **CorsairQuant 服务端的只读 HTTP 数据入口**。

用户电脑通过 SSH 本地转发访问这个入口。Strategy27 脚本保存一份网关地址和认证配置,Strategy29 复用这条连接,并管理自己的汇总面板。网关不负责下单,也不需要 Binance API Key。

Strategy31 也复用这份连接,读取 `/v1/strategy31/events`,并在当前币种、周期的绿 K 下方画上涨箭头。它只展示服务端确认的前红后绿放量形态,不在浏览器采集成交量。每次读取最多 200 条近期信号,仅对图表已加载的 K 线绘制。服务端启用状态以部署配置为准。需要 CorsairQuant 信号客户端 0.6.6;详见 [Strategy31 开发说明](binance-strategy31-volume-reversal-development.md)。下文原有组件图描述 Strategy27/29 链路。

本文说明当前源码的组件关系和使用方式。图中的服务存在于代码中,不代表某台 VPS 已启动它们;服务端启用状态、浏览器安装状态和实时连通性需要分别确认。

## 哪些脚本使用它
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "module",
"scripts": {
"build:userscripts": "node scripts/build-userscript.mjs",
"build:binance-userscripts": "node scripts/build-userscript.mjs binance-orderbook-trade binance-trading-data binance-coinmarketcap-data binance-strategy27-events binance-strategy29-bollinger",
"build:binance-userscripts": "node scripts/build-userscript.mjs binance-orderbook-trade binance-trading-data binance-coinmarketcap-data binance-strategy27-events binance-strategy29-bollinger binance-strategy31-volume-reversal",
"build:binance-strategy29-bollinger": "node scripts/build-userscript.mjs binance-strategy29-bollinger",
"check:binance-strategy29-bollinger": "node --check scripts/binance-strategy29-bollinger.user.js",
"inspect:binance-strategy29-bollinger": "node scripts/userscript-release-contract.mjs scripts/binance-strategy29-bollinger.user.js",
Expand All @@ -21,7 +21,7 @@
"verify:binance-orderbook-stage3": "node scripts/binance-stage3-evidence.mjs",
"assemble:binance-orderbook-live": "node scripts/binance-live-capture.mjs",
"summarize:binance-orderbook-live": "node scripts/binance-live-performance.mjs",
"check:binance-userscripts": "node --check scripts/binance-orderbook-trade.user.js && node --check scripts/binance-trading-data.user.js && node --check scripts/binance-coinmarketcap-data.user.js && node --check scripts/binance-strategy27-events.user.js && node --check scripts/binance-strategy29-bollinger.user.js",
"check:binance-userscripts": "node --check scripts/binance-orderbook-trade.user.js && node --check scripts/binance-trading-data.user.js && node --check scripts/binance-coinmarketcap-data.user.js && node --check scripts/binance-strategy27-events.user.js && node --check scripts/binance-strategy29-bollinger.user.js && node --check scripts/binance-strategy31-volume-reversal.user.js",
"check:binance-orderbook-trade": "node --check scripts/binance-orderbook-trade.user.js",
"check:m3u8-downloader": "node --check scripts/m3u8-downloader.user.js",
"test": "node --test 'test/unit/**/*.test.js' 'test/dom/**/*.test.js'",
Expand All @@ -35,7 +35,9 @@
"test:binance-strategy27-events": "node --test test/unit/binance-strategy27-events/*.test.js test/dom/binance-strategy27-events/*.test.js test/unit/userscript-metadata-icons.test.js test/unit/userscript-release-contract.test.js",
"test:ui": "playwright test",
"test:ui:headed": "playwright test --headed",
"test:ui:debug": "playwright test --debug"
"test:ui:debug": "playwright test --debug",
"build:binance-strategy31-volume-reversal": "node scripts/build-userscript.mjs binance-strategy31-volume-reversal",
"check:binance-strategy31-volume-reversal": "node --check scripts/binance-strategy31-volume-reversal.user.js"
},
"devDependencies": {
"@bcoe/v8-coverage": "1.0.2",
Expand Down
Loading
Loading