快速入门
安装公开版本
go get github.com/tigerfintech/[email protected]需要 Go 1.20 或更高版本。先在开发者中心开通权限,并阅读账户类型、行情权限与限制、市场与交易规则和接口请求限制。
配置模板
优先使用开发者中心导出的真实配置;也可参考统一配置模板和统一 Token 模板。复制后去掉 .example 后缀并替换占位符,请勿将凭证提交到版本库。
package main
import (
"fmt"
"log"
"github.com/tigerfintech/openapi-go-sdk/config"
"github.com/tigerfintech/openapi-go-sdk/quote"
)
func main() {
cfg, err := config.NewClientConfig()
if err != nil { log.Fatal(err) }
qc := quote.NewQuoteClientFromConfig(cfg)
states, err := qc.GetMarketState("US")
if err != nil { log.Fatal(err) }
fmt.Printf("%#v\n", states)
}客户端构造函数
// package quote
func NewQuoteClient(httpClient *client.HttpClient) *QuoteClient
func NewQuoteClientFromConfig(cfg *config.ClientConfig) *QuoteClient
// package trade
func NewTradeClient(httpClient *client.HttpClient, account string) *TradeClient
func NewTradeClientFromConfig(cfg *config.ClientConfig) *TradeClient
// package push
func NewPushClient(cfg *config.ClientConfig, opts ...PushClientOption) *PushClientUpdated about 1 month ago
Did this page help you?
