Tiger Quant Open Platform Go SDK Complete Skill Set / Complete AI skill set for Tiger Brokers OpenAPI (Go)
Safety Warning / Safety Warning: Trading involves real money. When generating trading code, default tosimulated account, unless the user explicitly requests live trading. Before placing a live order, you must confirm the order details with the user. Trading involves real money. Default to Paper Trading when generating trading code. Always confirm order details before live orders.
- Docs: https://docs.itigerup.com/docs/prepare
- GitHub: https://github.com/tigerfintech/openapi-go-sdk
- Module:
github.com/tigerfintech/openapi-go-sdk| Go 1.20+
Language Rules / Language Rules
Reply automatically based on the user's input language. Keep technical terms (code, API names, parameter names) in their original form without translation. Reply in the user's language. Keep technical terms (code, API names, parameters) as-is.
Reference Guides
- Quickstart — SDK install, config, client setup, enums, error handling
- Market Data — Real-time quotes, K-lines, depth, options, futures
- Trading — Place/modify/cancel orders, query positions and assets
- Real-time Push — WebSocket push for quotes, orders, positions, assets
- Account Management — Account list, assets, positions, fund transfer, deposit/withdrawal
- Options Trading — Option chain, expirations, Greeks, multi-leg strategies
Quick Start
package main
import (
"fmt"
"log"
"github.com/tigerfintech/openapi-go-sdk/client"
"github.com/tigerfintech/openapi-go-sdk/config"
"github.com/tigerfintech/openapi-go-sdk/model"
"github.com/tigerfintech/openapi-go-sdk/quote"
"github.com/tigerfintech/openapi-go-sdk/trade"
)
func main() {
// 1. 创建配置 / Create config
cfg, err := config.NewClientConfig(
config.WithTigerID("your_tiger_id"),
config.WithPrivateKey("your_rsa_private_key"),
config.WithAccount("your_account"),
)
if err != nil {
log.Fatal(err)
}
// 2. 创建 HTTP 客户端 / Create HTTP client
httpClient := client.NewHttpClient(cfg)
// 3. 查询行情 / Query quotes
qc := quote.NewQuoteClient(httpClient)
briefs, err := qc.GetRealTimeQuote(model.BriefRequest{
Symbols: []string{"AAPL", "TSLA"},
})
if err != nil {
log.Fatal(err)
}
for _, b := range briefs {
fmt.Printf("%s latest=%.2f\n", b.Symbol, b.LatestPrice)
}
// 4. 交易操作 / Trading
tc := trade.NewTradeClient(httpClient, cfg.Account)
orders, err := tc.Orders(model.OrdersRequest{Limit: 20})
if err != nil {
log.Fatal(err)
}
fmt.Println("orders:", len(orders))
}
When to Use Each Reference
| Task | Reference |
|---|---|
| First time setup, SDK install, auth config | quickstart.md |
| Get stock/option/future quotes, K-lines | quote.md |
| Place/modify/cancel orders, check positions/assets | trade.md |
| Real-time streaming data via WebSocket | push.md |
| Account info, assets, fund transfer, deposit/withdrawal | account.md |
| Option chain, Greeks, expirations, multi-leg orders | option.md |
Common Symbols / Common Symbols Quick Reference
Hong Kong Stocks HK
| Common Name | Symbol Symbol |
|---|---|
| Tencent | 00700 |
| Alibaba | 09988 |
| Meituan | 03690 |
| Xiaomi | 01810 |
US Stocks US
| Common Name | Symbol Symbol |
|---|---|
| Apple / Apple | AAPL |
| Tesla / Tesla | TSLA |
| NVIDIA / NVIDIA | NVDA |
| Microsoft / Microsoft | MSFT |
| Google / Google | GOOGL |
| Amazon / Amazon | AMZN |
| Meta | META |
| Tiger Brokers / TIGR | TIGR |
| S&P 500 ETF / SPY | SPY |
| Nasdaq ETF / QQQ | QQQ |