From dbe4d8c52ccb6b8e6e0c39a3a01872e475fbd234 Mon Sep 17 00:00:00 2001 From: injoyai <1113655791@qq.com> Date: Wed, 30 Oct 2024 17:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index f5f9449..1a1ce66 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,36 @@ ![](docs/plan20241028-2.png) * K线 ![](docs/plan20241029.png) + +### 如何使用 + +```go +package main + +import ( + "fmt" + "github.com/injoyai/tdx" + "github.com/injoyai/tdx/protocol" +) + +func main() { + //连接服务器,开启日志,开启断连重试 + c, err := tdx.Dial("124.71.187.122:7709", tdx.WithDebug(true), tdx.WithRedial(true)) + if err != nil { + panic(err) + } + resp, err := c.GetStockQuotes(map[protocol.Exchange]string{ + protocol.ExchangeSH: "000001", + protocol.ExchangeSZ: "600008", + }) + if err != nil { + panic(err) + } + + for _, v := range resp { + fmt.Printf("%#v\n", v) + } + <-c.Done() +} + +``` \ No newline at end of file