update mod,readme file

This commit is contained in:
bense
2023-01-31 08:49:16 +08:00
parent 13073cd8e4
commit 5d86baf170
9 changed files with 44 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
package main
import (
"gotdx"
"github.com/bensema/gotdx"
"log"
)
@@ -28,7 +28,7 @@ func main() {
}
for _, obj := range reply.List {
log.Println(obj)
log.Printf("%+v", obj)
}
_ = api.Disconnect()

View File

@@ -5,7 +5,7 @@ import (
"compress/zlib"
"encoding/binary"
"errors"
"gotdx/proto"
"github.com/bensema/gotdx/proto"
"io"
"log"
"net"

View File

@@ -2,7 +2,7 @@ package gotdx
import (
"fmt"
"gotdx/proto"
"github.com/bensema/gotdx/proto"
"testing"
)

31
examples/main.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"github.com/bensema/gotdx"
"log"
)
func main() {
var opt = &gotdx.Opt{
Host: "119.147.212.81",
Port: 7709,
}
api := gotdx.NewClient(opt)
connectReply, err := api.Connect()
if err != nil {
log.Println(err)
}
log.Println(connectReply.Info)
reply, err := api.GetSecurityQuotes([]uint8{gotdx.MarketSh, gotdx.MarketSz}, []string{"000001", "600008"})
if err != nil {
log.Println(err)
}
for _, obj := range reply.List {
log.Printf("%+v", obj)
}
_ = api.Disconnect()
}

6
go.mod
View File

@@ -1,5 +1,5 @@
module gotdx
module github.com/bensema/gotdx
go 1.18
go 1.19
require golang.org/x/text v0.3.7
require golang.org/x/text v0.6.0

View File

@@ -3,7 +3,7 @@ package proto
import (
"bytes"
"encoding/binary"
"gotdx/util"
"github.com/bensema/gotdx/util"
)
type GetSecurityList struct {

View File

@@ -5,7 +5,7 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"gotdx/util"
"github.com/bensema/gotdx/util"
)
type GetSecurityQuotes struct {

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/binary"
"encoding/hex"
"gotdx/util"
"github.com/bensema/gotdx/util"
)
type Hello1 struct {
@@ -54,7 +54,8 @@ func (obj *Hello1) Serialize() ([]byte, error) {
/*
00e60708051 50 f0 00 d3 a02b2020c03840384038403840384033a02b2020c0384038403840384038403 00 5a8a3401 f94a0100 5a8a3401 fd4a0100ff00e 700000101013f
分 时 秒 日期
分 时 秒 日期
*/
func (obj *Hello1) UnSerialize(header interface{}, data []byte) error {
obj.respHeader = header.(*RespHeader)

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/binary"
"encoding/hex"
"gotdx/util"
"github.com/bensema/gotdx/util"
)
type Hello2 struct {