Documentation
¶
Overview ¶
Package futuapi4go is a typed Go SDK for the Futu OpenD / OpenAPI protocol.
It wraps the protobuf-over-TCP Qot (market data), Trd (trading), and Sys services in idiomatic Go, and adds a connection state machine with auto-reconnect, real-time push via channels or typed callbacks, rate limiting, circuit breaking and retry, optional OpenTelemetry tracing and metrics, a K-line LRU cache, and order pre-flight validation.
The high-level entry point is the client package:
import "github.com/shing1211/futuapi4go/client"
cli := client.New(client.WithEnvConfig())
if err := cli.Connect("127.0.0.1:11111"); err != nil {
log.Fatal(err)
}
defer cli.Close()
See the client package and the repository README for details.
简体中文: futuapi4go 是富途 OpenD / OpenAPI 协议的 Go 语言 SDK,封装了行情(Qot)、 交易(Trd)和系统(Sys)服务,并提供断线重连、实时推送、限流、熔断重试、 OpenTelemetry 可观测性、K 线缓存和下单前校验等能力。
繁體中文: futuapi4go 是富途 OpenD / OpenAPI 協定的 Go 語言 SDK,封裝了行情(Qot)、 交易(Trd)與系統(Sys)服務,並提供斷線重連、即時推送、限流、熔斷重試、 OpenTelemetry 可觀測性、K 線快取與下單前校驗等能力。
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client provides a public Client type for the Futu OpenD SDK.
|
Package client provides a public Client type for the Futu OpenD SDK. |
|
mock
Package mock provides a simulated Futu OpenD mock server for integration testing.
|
Package mock provides a simulated Futu OpenD mock server for integration testing. |
|
internal
|
|
|
pkg
|
|
|
breaker
Package breaker implements the Circuit Breaker pattern for the futuapi4go SDK.
|
Package breaker implements the Circuit Breaker pattern for the futuapi4go SDK. |
|
constant
Package constant provides enums and constants compatible with the Python futu-api SDK.
|
Package constant provides enums and constants compatible with the Python futu-api SDK. |
|
degradation
Package degradation provides graceful degradation utilities for the Futu OpenD SDK.
|
Package degradation provides graceful degradation utilities for the Futu OpenD SDK. |
|
futuapi
Package futuapi is a convenience re-export package that provides direct access to the internal futuapi.Client type.
|
Package futuapi is a convenience re-export package that provides direct access to the internal futuapi.Client type. |
|
health
Package health provides health check utilities for monitoring the connection status and responsiveness of Futu OpenD. Use it to implement liveness and readiness probes in production deployments.
|
Package health provides health check utilities for monitoring the connection status and responsiveness of Futu OpenD. Use it to implement liveness and readiness probes in production deployments. |
|
history
Package history provides historical data retrieval and pagination support for K-line, tick, and other time-series market data from Futu OpenD.
|
Package history provides historical data retrieval and pagination support for K-line, tick, and other time-series market data from Futu OpenD. |
|
logger
Package logger provides a configurable logging interface for the Futu OpenD SDK.
|
Package logger provides a configurable logging interface for the Futu OpenD SDK. |
|
market
Package market provides market hours, trading calendars, and market status information for HK, US, CN, SG, and other supported markets.
|
Package market provides market hours, trading calendars, and market status information for HK, US, CN, SG, and other supported markets. |
|
metrics
Package metrics provides client-side performance metrics collection for monitoring Futu OpenD connection health, request latency, error rates, and push message throughput.
|
Package metrics provides client-side performance metrics collection for monitoring Futu OpenD connection health, request latency, error rates, and push message throughput. |
|
option
Package option provides options chain querying and parsing utilities for HK and US stock options traded through Futu OpenD.
|
Package option provides options chain querying and parsing utilities for HK and US stock options traded through Futu OpenD. |
|
push
Package push provides handlers for parsing push notification payloads from Futu OpenD. Use RegisterHandler on the client to receive real-time market data and order updates.
|
Package push provides handlers for parsing push notification payloads from Futu OpenD. Use RegisterHandler on the client to receive real-time market data and order updates. |
|
push/chan
Package chan provides channel-based push notification delivery for the futuapi4go SDK.
|
Package chan provides channel-based push notification delivery for the futuapi4go SDK. |
|
qot
Package qot provides market data APIs for the Futu OpenD SDK.
|
Package qot provides market data APIs for the Futu OpenD SDK. |
|
ratelimit
Package ratelimit provides API rate limiting utilities to prevent exceeding Futu OpenD's request rate limits.
|
Package ratelimit provides API rate limiting utilities to prevent exceeding Futu OpenD's request rate limits. |
|
retry
Package retry provides configurable retry logic with exponential backoff for transient failures in Futu OpenD operations.
|
Package retry provides configurable retry logic with exponential backoff for transient failures in Futu OpenD operations. |
|
sys
Package sys provides system-level APIs for the Futu OpenD SDK, including global state queries, user info retrieval, and connection keep-alive management.
|
Package sys provides system-level APIs for the Futu OpenD SDK, including global state queries, user info retrieval, and connection keep-alive management. |
|
tracing
Package tracing provides the core interfaces for distributed tracing within the Futu OpenD SDK.
|
Package tracing provides the core interfaces for distributed tracing within the Futu OpenD SDK. |
|
tracing/otel
Package otel provides an OpenTelemetry-backed Tracer implementation for the Futu OpenD SDK tracing framework.
|
Package otel provides an OpenTelemetry-backed Tracer implementation for the Futu OpenD SDK tracing framework. |
|
trd
Package trd provides trading APIs for the Futu OpenD SDK, including order placement, modification, cancellation, position/portfolio queries, account management, and order building.
|
Package trd provides trading APIs for the Futu OpenD SDK, including order placement, modification, cancellation, position/portfolio queries, account management, and order building. |
|
util
Package util provides code parsing, formatting, and market utility helpers for working with Futu OpenAPI stock codes.
|
Package util provides code parsing, formatting, and market utility helpers for working with Futu OpenAPI stock codes. |
|
test
|
|