A88 · Host 68306/68308/68309/68310/68367 · 真實68059 capture再封裝 · 無重新訂閱/無改production

四流真實輸出樣本
+Server V1/V2/V3最高效能對接

結論:四份都係68059獨立live capture直接抽出嘅真實decoded rows,唔係格式示例。Production唔應開四份重複訂閱:Kline/Tick/Orderbook係同一quote session、同一個0x1843 request按bits合併;History係0x1811獨立pull。最高效能做法係數據機native capture一次,binary framing經持久TCP送去第二部Server;CSV只喺Server兼容出口產生,V2/V3直接食canonical events。

1 · 四份真實樣本

Flow內容下載Bytes / SHA-256
① Kline push
0x1843→0x1844
1 request、1 success response、2個真實NVDA-USDC 1m更新frame;含OHLC、vol、turn、exchange/receive時間。01-kline-push-0x1844-sample.json1,649 B
8d0aafe1098f79ba097ed3676ba8fc4b3b6f55379133dfa931c578a4cd888c96
② Tick bit351 request、1 success response、2個真實tick;首項NVDA 148.26×237。02-tick-bit35-sample.json1,649 B
cbff13b49bfb484ca443c8ac38af933c1b4c84f12d0dc4969133a72b283f08ad
③ Orderbook bit334 decoder rows去重後17個真snapshot;含bid1/ask1、volume、count、sums、imbalance、exchange time。03-orderbook-bit3-sample.json8,919 B
86c8386454acd76fcf7376688396ace630ff328a1c96c5afbdb90d4a609ebb79
④ History 0x18111 pull、7條真OHLC bar+response summary;summary明示1個合法metadata-only placeholder。04-history-0x1811-sample.json4,101 B
40b89e3ef4c07ce5476201b5ce1df31c6730d1be971a116978d3253cefb09d26

2 · 樣本係點抽,點證明唔係mock

3 · 回答68367:點解當時四流分開訂?Production使唔使?

68059分開跑係診斷/驗收,不係production拓撲。逐流隔離先可以證明邊個parser壞、rollback有冇污染;最後亦做過一個binary四流unified smoke。

流Production控制面要唔要另一條feed
Kline bit10001同一個0x1843 subscription set,對每個SID把bits 3/35/10001(以及需要嘅0/1)OR埋一齊;一個response確認。唔使;同一quote connection/feed
Tick bit35
Orderbook bit3
History 0x1811request/reply pull;按啟動backfill/gap repair/用戶查詢先發。同session可共用,但唔係subscription bit
所以:一個capture process+一個上游session足夠。唔好為四種payload起四個FTNN process/四套subscription;會重複socket、decode、memory copy同quota。

4 · 最高效能架構(68310新準則)

FTNN data machine
  native hook / one quote session
  ├─ combined 0x1843 push decode: Kline / Tick / OB
  ├─ 0x1811 pull-response decode: History
  └─ per-flow SPSC ring (binary, bounded, no JSON/CSV hot path)
             │
             ├─ persistent TCP/TLS lane A: Tick/OB low-latency micro-batches
             ├─ persistent TCP/TLS lane B: Kline
             └─ request/reply lane C: History
             │
Second Server machine
  receiver → CRC/sequence/gap check → append-only WAL
           → latest-state table per symbol
           → V2/V3 direct canonical-event consumers
           → V1 50-column CSV projection / downstream compatibility only

點解唔用CSV做跨機主接口

Canonical envelope

version, event_type, source_id, process_boot_id, connection_epoch,
source_sequence, symbol/sec_id/market,
exchange_time, source_receive_monotonic, source_wall_time,
server_receive_time, payload_length, payload, crc32c

Price/volume保留原precision:wire fixed-point integer+scale,或者decimal string;唔先轉binary float再轉CSV,避免兩次rounding。

5 · 每條flow點送

FlowTransport策略Backpressure
Tick低延遲micro-batch(例如≤1ms或≤64KB),symbol內有序。策略若要逐tick就不可coalesce;ring滿要明確gap/drop counter+WAL replay。
Orderbooksnapshot event;同symbol按exchange time有序。若V1只要latest,可在projection lane coalesce;raw/WAL lane仍保留完整序列。
Klinebar key=(symbol,period,bar_ts) upsert;同一bar多次更新合法。可coalesce同bar中間更新,但final/latest需保留revision。
Historycorrelation_id request/reply;response分bar rows+summary。獨立bounded queue,唔阻塞live push lane。

6 · V1/V2/V3改法

Server最高效能對接兼容
V1Receiver維護per-symbol latest snapshot;CSV writer只喺值變或節流tick輸出50欄。保留68190 exact 50-column schema;時間/source metadata留companion或加內部表,唔污染舊CSV。
V2移除「由爬蟲PY機讀CSV」熱路;直接訂canonical event bus/receiver IPC。先加adapter將canonical event投影成舊內部object,逐模組替換。
V3直接用typed payload+latest-state/WAL API;計算/策略按event type分lane。History用RPC,live用stream;統一symbol map及time semantics。

數據由此只由FTNN數據機出。爬蟲PY機唔再係source或轉發中介,減一hop、減一次parse、減一個故障域。

7 · Receiver正確性硬閘

8 · 資源最緊時嘅優先次序

  1. 單capture/單decode/binary transport,先消滅重複工作。
  2. OB latest projection可coalesce;history隔離;CSV離線/低優先級。
  3. Receiver用preallocated buffers、batch writev、WAL segment;避免每event JSON allocation。
  4. 先按1→35→200→1000 symbols replay量p50/p95/p99、RSS、queue lag、WAL throughput,再定shard。
  5. CSV consumer慢唔可以反壓live ingest;落後就追WAL。
唔應直接假設「同一feed所以零成本」。上游connection可共用,但Tick/OB event量、decode、serialization、WAL I/O仍然係真成本;高效係消除重複並按lane做coalesce/backpressure,唔係無限開symbols。

9 · 驗收順序

  1. 用今次四份sample做contract fixtures;V1/V2/V3逐一重播。
  2. 兩機loopback→真LAN persistent connection;故意斷線/重連,驗boot/epoch/gap。
  3. 35-symbol live:四流合併0x1843+history bounded backfill。
  4. 200/1000:跟已證clean subscription ceiling 1000,但按CPU/bandwidth shard,唔只睇ACK。
  5. 對比舊PY/CSV結果;數值、時序、missing semantics一致先切流。

10 · Source evidence

Independent Kline log4,373 B · 49e154aff2d7478743184bda19d04da16e638c44b7f16f7d34606ad74cbf98c6
Independent Tick log3,906 B · 2c063bd4c0ff9a83f4c2330e2fd56ca85cbafc1a1e4a1f2295cf88ba822961cc
Independent Orderbook log14,215 B · b0700e459b3c734c54ad9d99af42d25a3d6f57c60d1f6857db136780d4bb8131
Independent History log13,991 B · b01f9ed8ad682b2091f56aa8443a69261066b111c94658456449314e6d1963f5
Server V1 live CSV2,270 B · 50 columns × 17 rows · ec8fa0212ce4ec086860b85c434bb231d8d991090981a7d4d946905c9b3fe2f8

四份sample由已保存private independent logs抽取,無重新連FTNN、無新subscription、無process restart。公開檔只含行情值及非敏感capture metadata。