mirror of
https://github.com/bensema/gotdx.git
synced 2025-11-21 02:45:33 +08:00
update mod,readme file
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"compress/zlib"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"gotdx/proto"
|
||||
"github.com/bensema/gotdx/proto"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
|
||||
@@ -2,7 +2,7 @@ package gotdx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gotdx/proto"
|
||||
"github.com/bensema/gotdx/proto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
31
examples/main.go
Normal file
31
examples/main.go
Normal 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
6
go.mod
@@ -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
|
||||
|
||||
@@ -3,7 +3,7 @@ package proto
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"gotdx/util"
|
||||
"github.com/bensema/gotdx/util"
|
||||
)
|
||||
|
||||
type GetSecurityList struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"gotdx/util"
|
||||
"github.com/bensema/gotdx/util"
|
||||
)
|
||||
|
||||
type GetSecurityQuotes struct {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"gotdx/util"
|
||||
"github.com/bensema/gotdx/util"
|
||||
)
|
||||
|
||||
type Hello2 struct {
|
||||
|
||||
Reference in New Issue
Block a user