This project is indexed by GitNexus as futu-python-samples (3391 symbols, 4890 relationships, 164 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
If any GitNexus tool warns the index is stale, run
npx gitnexus analyzein terminal first.
- MUST run impact analysis before editing any symbol. Before modifying a function, class, or method, run
gitnexus_impact({target: "symbolName", direction: "upstream"})and report the blast radius (direct callers, affected processes, risk level) to the user. - MUST run
gitnexus_detect_changes()before committing to verify your changes only affect expected symbols and execution flows. - MUST warn the user if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
- When exploring unfamiliar code, use
gitnexus_query({query: "concept"})to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. - When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use
gitnexus_context({name: "symbolName"}).
- NEVER edit a function, class, or method without first running
gitnexus_impacton it. - NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
- NEVER rename symbols with find-and-replace — use
gitnexus_renamewhich understands the call graph. - NEVER commit changes without running
gitnexus_detect_changes()to check affected scope.
| Resource | Use for |
|---|---|
gitnexus://repo/futu-python-samples/context |
Codebase overview, check index freshness |
gitnexus://repo/futu-python-samples/clusters |
All functional areas |
gitnexus://repo/futu-python-samples/processes |
All execution flows |
gitnexus://repo/futu-python-samples/process/{name} |
Step-by-step execution trace |
| Task | Read this skill file |
|---|---|
| Understand architecture / "How does X work?" | .claude/skills/gitnexus/gitnexus-exploring/SKILL.md |
| Blast radius / "What breaks if I change X?" | .claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md |
| Trace bugs / "Why is X failing?" | .claude/skills/gitnexus/gitnexus-debugging/SKILL.md |
| Rename / extract / split / refactor | .claude/skills/gitnexus/gitnexus-refactoring/SKILL.md |
| Tools, resources, schema reference | .claude/skills/gitnexus/gitnexus-guide/SKILL.md |
| Index, status, clean, wiki CLI commands | .claude/skills/gitnexus/gitnexus-cli/SKILL.md |
124 verified examples for the Futu OpenAPI Python SDK. Every script fires live API calls — no mocks.
| Variable | What it does | Default |
|---|---|---|
FUTU_OPEND_HOSTS |
host:port:is_rsa[,...] HA gateway list |
falls back to FUTU_ADDR |
FUTU_ADDR |
Single host fallback | 127.0.0.1:11111 |
FUTU_RSA_KEY |
RSA private key path | /etc/futu/keys/private_key.pem |
FUTU_TCP_TIMEOUT |
TCP probe timeout | 3 seconds |
FUTU_TRADE_PWD |
SIMULATE unlock password | 123456 |
Remote gateways require RSA. There is no localhost-vs-remote auto-detection — set is_rsa=True in FUTU_OPEND_HOSTS for remote hosts.
Return types that differ from the docs:
get_history_kl_quota()→(used: int, remain: int, None)— plain 3-tuple, not a dictrequest_history_kline()→(ret, DataFrame, next_page_token)— 3-tuple, third value is a pagination cursorget_warrant()→(DataFrame, has_more: bool, total: int)— 3-tupleget_order_book()→(ret, dict)where dict entries are(price, vol, count, extra)4-tuplessubscribe()→(ret_code, None)— unpack asret, _ = ctx.subscribe(...)request_trading_days()→ plainlist[str]— no tuple wrapper at all
Enum names that don't exist:
ft.AuType.BFQ→ft.AuType.HFQft.PriceReminderOp→ft.SetPriceReminderOpft.SecurityReferenceType.BULL_BEAR→ not available
pandas traps:
hist[-1]on a Series →KeyError— usehist.iloc[-1]if df:on a DataFrame →ValueError— useif df is not None and not df.empty:
Column and parameter names:
get_plate_list()→ column isplate_name, notnameget_capital_flow()→ noperiod_typeparam; columns arecapital_flow_item_time,in_flowsubscribe/unsubscribe→ parameter iscode_list=, notcodes=
examples/connect.py is the shared HA connection module.
| Function | What it does |
|---|---|
create_quote_context(is_rsa=None) |
Probes all hosts, picks fastest, configures RSA, returns OpenQuoteContext |
create_trade_context(is_rsa=None, **kwargs) |
Reuses cached probe result, returns OpenSecTradeContext |
get_demo_trade_password() |
Returns FUTU_TRADE_PWD — SIMULATE only |
clear_connection_cache() |
Force a fresh probe on the next context creation |
The HA algorithm probes all hosts in parallel, sorts by TCP latency, attempts the connection, retries without RSA on failure. The result is cached so both quote and trade contexts land on the same gateway.
python3 scripts/run_all.py # recommended — full runner with PASS/FAIL
bash scripts/test_all.sh # delegates to run_all.py