A88 · Host seq 67995 · Futu API Doc v10.12 · read-only manual crosswalk+controlled Rev-10 live test

OpenD 參數 ↔ FTNN 內部協定
0x1811 backfill 實測成功

全程無安裝、無啟動 OpenD;只讀三份 pinned HTML,再用既有 FTNN/Rev-10 做可回復測試。

7 + 1
OHLC bars+placeholder
3.907s
0x1811 response RTT
result=0
sid/ktype/exright match
ROLLBACK
r5 restored exactly

先講清楚:係功能對照,唔係 wire ID 相等

外部工程師
Python/C#/JS API
→ OpenD facade
subscribe()
request_history_kline()
→ OpenD protocol
3001 / 3103
→ FTNN internal
0x1843 / 0x1811
→ quote server
0x1844 pushes / KlineRsp

OpenD 文件參數名係 app↔OpenD contract;0x1843/0x1811 係 FTNN process↔quote backend。語義可對,數字、payload 同 cache 行為不可直接當同一層。

1. subscribe() 對 0x1843

OpenD v10.12內部對應精確判定
code_list每個 code 先 resolve 做 security_id+NN_CSMktType;SID 入 SubscribeSetReq field1,market 入2-byte ext header。唔係直接傳 code string。
subtype_list翻譯成每個 SID 嘅 BitInfo list。見下一表;enum value 同 bit value唔同。
is_first_push=TrueOpenD 成功訂閱後,立即把本地 cached data推畀 script;重連重訂亦可先推斷線前最後值。同我哋「訂閱後先見 snapshot/burst」語義一致,但唔係0x1843 wire field;今次根本無 OpenD,故不能把 initial 0x1844 burst 歸因於呢個 flag。
subscribe_push=TrueOpenD↔script callback registration。False 仍可令 OpenD 向 server 收數並由 get API讀 cache;唔等於取消0x1843 server subscription。
文件原文重點:is_first_push=successful subscription 後 immediate cached push;subscribe_push=係咪向 script push。OpenD proto 3001 對應 isFirstPush field6;FTNN 0x1843 SubscribeSetReq 並無同名欄。

2. SubType 對 bit

OpenD SubTypeOpenD enumFTNN internal額外 payload
ORDER_BOOK2bit 3可帶 prob;權限決定深度/detail。
TICKER4bit 35prob=1;TickItem逐筆成交。
K_1M11bit 10001prob2=KlineSubProb(base MINUTE, custom_number 1, subscribe_type KLINE)。

所以「2→3、4→35、11→10001」係 translator mapping,唔係 enum 數值相等。

3. request_history_kline / proto 3103 對 0x1811

OpenD 參數0x1811 KlineReq今次值
codesecurity_id field1+market ext header;crypto broker optional。BTC SID 12000015,mkt17。
start, endepoch begin_time field6/end_time field7,並配 data_range_type field5:1=begin+end、2=begin+count、3=end+count。type3;end=now+120s。
ktype=K_1Mkline_type field2=1+KlineTypeV2 field12 {base_type=2, custom_number=1}。response ktype=1。
autypeexright field3。0 / NONE。
max_countitem_count field8。8;回7條有OHLC+1條metadata-only future/forming placeholder。
page_req_keyOpenD 3103 自己嘅 opaque paging token;raw 0x1811 無同型 bytes。回覆可有 has_more/next_time;若冇 token,type3 向前翻頁可用 end_time=first_ts-1。has_more=0, next_time=0。
3100 邊界:三份 pinned page 只直接釘實 3001 與 3103,無展示 3100 章節;依 owner 指示,今次排除 3100/local-cache 路徑,亦無讀任何本地 DB。不能假裝三份文件本身證明咗 3100 細節。

實測 request / response

request: cmd=0x1811, sid=12000015, mkt=17,
         data_range_type=3 (END_TIME_ITEM_COUNT), end_time=now+120,
         kline_type=1 + KlineTypeV2(2,1), exright=0, item_count=8
response: result=0, req_sid=rsp_sid=12000015, rtt_ms=3907,
          bar_count=7, placeholder_count=1,
          first_ts=1795880520, last_ts=1795880880,
          has_more=0, next_time=0

第一次 parser 將最後一條「有 ts 但未有 OHLC」placeholder 當 malformed;私下 wire reconciliation 證實佢結構合法。Final parser 只喺 history response 路徑 drop 呢條 placeholder,push parser 仍 fail-closed;ASan/UBSan 124 checks、0 failures。

tsopenhighlowclosevolturnover
179588052059224.4459248.5259223.2559243.304,353258,085,271
179588058059243.3059249.4159231.5159243.431,66298,562,001
179588064059244.1459250.5959229.8059235.681,42284,329,069
179588070059235.5759269.4759235.0359259.933,580212,354,622
179588076059259.7159351.2859258.8759345.136,428381,555,195
179588082059345.1359351.5759317.9059326.445,751341,619,632
179588088059326.5859342.3659326.5859333.771,38982,505,418

最後一條有 OHLC 但仍可能係 forming bar;finalized 要以收到下一個 bar_ts(或 end_time 限在已收市分鐘)確認。

4. Ticker fields 對 clean bit35

OpenD TickerA88 clean tick差異
sequenceseq_id一對一成交序號。
dirdir BUY/SELL/NEUTRALraw 1/2/3 對 OpenD TickerDirection。
priceprice同義。
volumeqty+qty_strcrypto 要跟 volume precision;exact string 避免浮點誤差,唔好硬 cast OpenD int64。
time/timestampmatch_ms交易所成交時間;格式層不同。
recvTimerx_ms本機收到 push 時間。
turnover目前 clean 無 raw 同名欄可計 price×qty,但要標作 derived,唔冒充 server turnover。
type/typeSign/pushDataType目前 clean 未完整保留要 parity 就需加欄;Rev-10 只統計 raw tick_type buckets。
—svr_ms, prev_closeinternal clean 比 OpenD Ticker schema 多一個 server timestamp 同 outer previous close。
{
  "dir": "BUY",
  "match_ms": 1795398353729,
  "prev_close": 129.76,
  "price": 132.52,
  "qty": 1.647,
  "qty_str": "1.647",
  "rx_ms": 1795398354167,
  "seq_id": 7711177209427263488,
  "sid": 88537463839746,
  "svr_ms": 1795398354092,
  "type": "tick_35"
}

5. OrderBook fields 對 clean bit3

OpenDInternal bit3目前 clean output
每 level:price, volume, orederCountOrderBookItem:price, volume, order_countnbids/nasks, bid1_p/v/c, ask1_p/v/c
detailList(orderID, volume)orders / OrderInfo submessages(權限依賴)strict validation 有做,但現時 aggregate log 無逐單 detail。
完整 Bid / Ask level arraysrepeated bid / ask現時只保留 top1+bid_sum/ask_sum/imb,未達 OpenD full parity。
例子另有 svr_recv_time_bid/askserver/exchange timing fields現時只輸出 exch_ms;需補 timing 先 parity。

證據域:bit3 decoder 有 golden harness,但 NVDA live bit3 仍係0 frames;所以只能報 schema crosswalk,不能報 real NVDA orderbook 實物。

測試安全與 pin

Final live test
PASS
1 pull / 1 response / 7 bars
Rollback
PASS
restored PID 491588 · r5 only
OpenD runtime
0
not installed · not started
Local DB reads
0
0x1811 server path only
sub.html379,214 B · 74442587bc6ddf34708d167a65c123cd7b080262898b2a97dfc104f9c9f8117d
quote.html611,464 B · 727fd9749fb58c42228f519223da09734f40be4e1c8c0b3717c262a82d060029
request-history-kline.html347,478 B · ea608de89fac5d2f163d342f6977a7724928e44f5c34a648b59ab9da53175178
final result JSON10,317 B · 7cc6003874881ad6cb11b1647cf36a7b3387ed01af51d55b26ca7cbb7e398180
live JSONL5,441 B · 7c2e046b2af9d76e9cbe14ff88e6f9b1a191a870cc1f0d54141b8755c8822576
history-fix source110,914 B · 2a5a3dd7047519deabb8c86da7bc07fb1d4b30c6ffaa74df9c8c3d0c9d03bb8c
x86-64 shared object113,304 B · 646c9ce831571108694bdfba0d6eb63453a9018ec359dda191336c1e3cec1575
remote test harness15,105 B · f386d49c19e28325638c00a71664b1e4aef6bf290f8a84888a43ad651fd30d54
ASan/UBSan output1,350 B · 5800361b277577e50b703834162ddceb035b5dded3a3b95483280ceb41699140

Full final result

A88_REV10_HISTORY_0X1811_COMPLETE_BAR_TEST_V1
{
  "cpu_percent_one_core": 37.589,
  "duration_requested": 90,
  "elapsed_seconds": 110.479,
  "log_windows": {
    "/root/.local/share/fex-emu/RootFS/Ubuntu_24_04/tmp/a88-rev10/rev10-historyfix-live.jsonl": {
      "appended_bytes": 0,
      "rows": 0
    },
    "/tmp/a88-rev10/rev10-historyfix-live.jsonl": {
      "appended_bytes": 5441,
      "rows": 18
    }
  },
  "new_alive_after_test": true,
  "new_binary_sha256": "646c9ce831571108694bdfba0d6eb63453a9018ec359dda191336c1e3cec1575",
  "new_maps_gate": true,
  "new_pid": 490477,
  "observe_seconds": 90.0,
  "old_pid": 487484,
  "process_samples": [
    {
      "elapsed_s": 5.001,
      "guest_log_bytes": 0,
      "host_log_bytes": 0,
      "rss_kib": 431572,
      "state": "State:\tR (running)",
      "stime": 61,
      "utime": 697
    },
    {
      "elapsed_s": 10.002,
      "guest_log_bytes": 0,
      "host_log_bytes": 0,
      "rss_kib": 618560,
      "state": "State:\tR (running)",
      "stime": 91,
      "utime": 1062
    },
    {
      "elapsed_s": 15.004,
      "guest_log_bytes": 0,
      "host_log_bytes": 0,
      "rss_kib": 783416,
      "state": "State:\tR (running)",
      "stime": 123,
      "utime": 1478
    },
    {
      "elapsed_s": 20.006,
      "guest_log_bytes": 0,
      "host_log_bytes": 622,
      "rss_kib": 1071468,
      "state": "State:\tR (running)",
      "stime": 163,
      "utime": 1872
    },
    {
      "elapsed_s": 25.008,
      "guest_log_bytes": 0,
      "host_log_bytes": 1113,
      "rss_kib": 1331228,
      "state": "State:\tR (running)",
      "stime": 228,
      "utime": 2174
    },
    {
      "elapsed_s": 30.014,
      "guest_log_bytes": 0,
      "host_log_bytes": 1604,
      "rss_kib": 1453028,
      "state": "State:\tR (running)",
      "stime": 288,
      "utime": 2413
    },
    {
      "elapsed_s": 35.016,
      "guest_log_bytes": 0,
      "host_log_bytes": 2256,
      "rss_kib": 1395248,
      "state": "State:\tR (running)",
      "stime": 325,
      "utime": 2683
    },
    {
      "elapsed_s": 40.017,
      "guest_log_bytes": 0,
      "host_log_bytes": 4948,
      "rss_kib": 1461036,
      "state": "State:\tS (sleeping)",
      "stime": 359,
      "utime": 2911
    },
    {
      "elapsed_s": 45.028,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1501416,
      "state": "State:\tR (running)",
      "stime": 399,
      "utime": 3162
    },
    {
      "elapsed_s": 50.029,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1512592,
      "state": "State:\tS (sleeping)",
      "stime": 421,
      "utime": 3262
    },
    {
      "elapsed_s": 55.029,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1510692,
      "state": "State:\tS (sleeping)",
      "stime": 427,
      "utime": 3283
    },
    {
      "elapsed_s": 60.03,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1508100,
      "state": "State:\tS (sleeping)",
      "stime": 431,
      "utime": 3294
    },
    {
      "elapsed_s": 65.03,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1506016,
      "state": "State:\tS (sleeping)",
      "stime": 433,
      "utime": 3297
    },
    {
      "elapsed_s": 70.031,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1496792,
      "state": "State:\tS (sleeping)",
      "stime": 435,
      "utime": 3302
    },
    {
      "elapsed_s": 75.031,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1485496,
      "state": "State:\tS (sleeping)",
      "stime": 438,
      "utime": 3304
    },
    {
      "elapsed_s": 80.032,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1481444,
      "state": "State:\tS (sleeping)",
      "stime": 439,
      "utime": 3307
    },
    {
      "elapsed_s": 85.032,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1479968,
      "state": "State:\tS (sleeping)",
      "stime": 441,
      "utime": 3310
    },
    {
      "elapsed_s": 90.0,
      "guest_log_bytes": 0,
      "host_log_bytes": 5441,
      "rss_kib": 1481908,
      "state": "State:\tS (sleeping)",
      "stime": 442,
      "utime": 3316
    }
  ],
  "restored_pid": 491588,
  "rollback_checks": {
    "fex_env_exact": true,
    "old_conf_exact": true,
    "r10_absent": true,
    "r5_mapped": true
  },
  "rollback_pass": true,
  "rss_delta_kib": 1209340,
  "schema": "A88_REV10_HISTORY_0X1811_COMPLETE_BAR_TEST_V1",
  "stop_new_signal": "SIGKILL",
  "stop_old_signal": "SIGKILL",
  "summary": {
    "event_counts": {
      "config_armed": 1,
      "rsp_0x1811_summary": 1,
      "rsp_0x1843": 1,
      "rsp_kline_0x1811": 7,
      "sent_batch_0x1843": 1,
      "sent_pull_0x1811": 1,
      "sustained_status": 6
    },
    "history_bar_count": 7,
    "history_bars": [
      {
        "bit": 6161,
        "c": 59243.3,
        "ev": "rsp_kline_0x1811",
        "h": 59248.52,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59223.25,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59224.44,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880520,
        "turn": 258085271,
        "vol": 4353,
        "wall_ms": 1795880851681
      },
      {
        "bit": 6161,
        "c": 59243.43,
        "ev": "rsp_kline_0x1811",
        "h": 59249.41,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59231.51,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59243.3,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880580,
        "turn": 98562001,
        "vol": 1662,
        "wall_ms": 1795880851681
      },
      {
        "bit": 6161,
        "c": 59235.68,
        "ev": "rsp_kline_0x1811",
        "h": 59250.59,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59229.8,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59244.14,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880640,
        "turn": 84329069,
        "vol": 1422,
        "wall_ms": 1795880851681
      },
      {
        "bit": 6161,
        "c": 59259.93,
        "ev": "rsp_kline_0x1811",
        "h": 59269.47,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59235.03,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59235.57,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880700,
        "turn": 212354622,
        "vol": 3580,
        "wall_ms": 1795880851681
      },
      {
        "bit": 6161,
        "c": 59345.13,
        "ev": "rsp_kline_0x1811",
        "h": 59351.28,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59258.87,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59259.71,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880760,
        "turn": 381555195,
        "vol": 6428,
        "wall_ms": 1795880851681
      },
      {
        "bit": 6161,
        "c": 59326.44,
        "ev": "rsp_kline_0x1811",
        "h": 59351.57,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59317.9,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59345.13,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880820,
        "turn": 341619632,
        "vol": 5751,
        "wall_ms": 1795880851681
      },
      {
        "bit": 6161,
        "c": 59333.77,
        "ev": "rsp_kline_0x1811",
        "h": 59342.36,
        "hp_turn": "",
        "hp_vol": "",
        "l": 59326.58,
        "mkt": 17,
        "mono_ms": 3469225309,
        "o": 59326.58,
        "sec_id": 12000015,
        "seq": 9,
        "ts": 1795880880,
        "turn": 82505418,
        "vol": 1389,
        "wall_ms": 1795880851681
      }
    ],
    "history_responses": [
      {
        "bar_count": 7,
        "ev": "rsp_0x1811_summary",
        "exright": 0,
        "first_ts": 1795880520,
        "has_more": 0,
        "ktype": 1,
        "last_ts": 1795880880,
        "mkt": 17,
        "mono_ms": 3469225309,
        "next_time": 0,
        "placeholder_count": 1,
        "req_sid": 12000015,
        "result": 0,
        "rsp_sid": 12000015,
        "rtt_ms": 3907,
        "seq": 9,
        "wall_ms": 1795880851681
      }
    ],
    "kline_overall_span_ms": 0,
    "kline_per_sid": {},
    "response_success_count": 1,
    "responses": [
      {
        "err": 0,
        "max_sub_count": 100,
        "mkt": 17,
        "result": 0,
        "rtt_ms": 3913,
        "seq": 8,
        "warn": 0
      }
    ],
    "rows": 18,
    "sid_counts": {
      "12000015": 14
    },
    "status_tail": [
      {
        "abi_mask": 0,
        "kl_gap_ms": 0,
        "kl_n": 0,
        "kl_sil_ms": -1,
        "malformed": 0,
        "offscope": 0,
        "resubs": 0,
        "sec_id": 12000015,
        "sub_ok": 0,
        "timeouts": 0,
        "uptime_s": 24
      },
      {
        "abi_mask": 5,
        "kl_gap_ms": 0,
        "kl_n": 0,
        "kl_sil_ms": -1,
        "malformed": 0,
        "offscope": 0,
        "resubs": 0,
        "sec_id": 12000015,
        "sub_ok": 0,
        "timeouts": 0,
        "uptime_s": 29
      },
      {
        "abi_mask": 5,
        "kl_gap_ms": 0,
        "kl_n": 0,
        "kl_sil_ms": -1,
        "malformed": 0,
        "offscope": 0,
        "resubs": 0,
        "sec_id": 12000015,
        "sub_ok": 0,
        "timeouts": 0,
        "uptime_s": 34
      },
      {
        "abi_mask": 13,
        "kl_gap_ms": 0,
        "kl_n": 0,
        "kl_sil_ms": -1,
        "malformed": 0,
        "offscope": 0,
        "resubs": 0,
        "sec_id": 12000015,
        "sub_ok": 0,
        "timeouts": 0,
        "uptime_s": 39
      },
      {
        "abi_mask": 13,
        "kl_gap_ms": 0,
        "kl_n": 0,
        "kl_sil_ms": -1,
        "malformed": 0,
        "offscope": 0,
        "resubs": 0,
        "sec_id": 12000015,
        "sub_ok": 1,
        "timeouts": 0,
        "uptime_s": 44
      },
      {
        "abi_mask": 13,
        "kl_gap_ms": 0,
        "kl_n": 0,
        "kl_sil_ms": -1,
        "malformed": 0,
        "offscope": 0,
        "resubs": 0,
        "sec_id": 12000015,
        "sub_ok": 1,
        "timeouts": 0,
        "uptime_s": 49
      }
    ]
  },
  "targets": [
    12000015
  ],
  "ts_utc": "2026-11-28T15:48:44Z"
}