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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gotdx"
|
"github.com/bensema/gotdx"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, obj := range reply.List {
|
for _, obj := range reply.List {
|
||||||
log.Println(obj)
|
log.Printf("%+v", obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = api.Disconnect()
|
_ = api.Disconnect()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"compress/zlib"
|
"compress/zlib"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"gotdx/proto"
|
"github.com/bensema/gotdx/proto"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package gotdx
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"gotdx/proto"
|
"github.com/bensema/gotdx/proto"
|
||||||
"testing"
|
"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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"gotdx/util"
|
"github.com/bensema/gotdx/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetSecurityList struct {
|
type GetSecurityList struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gotdx/util"
|
"github.com/bensema/gotdx/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetSecurityQuotes struct {
|
type GetSecurityQuotes struct {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"gotdx/util"
|
"github.com/bensema/gotdx/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Hello1 struct {
|
type Hello1 struct {
|
||||||
@@ -54,6 +54,7 @@ func (obj *Hello1) Serialize() ([]byte, error) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
00e60708051 50 f0 00 d3 a02b2020c03840384038403840384033a02b2020c0384038403840384038403 00 5a8a3401 f94a0100 5a8a3401 fd4a0100ff00e 700000101013f
|
00e60708051 50 f0 00 d3 a02b2020c03840384038403840384033a02b2020c0384038403840384038403 00 5a8a3401 f94a0100 5a8a3401 fd4a0100ff00e 700000101013f
|
||||||
|
|
||||||
分 时 秒 日期
|
分 时 秒 日期
|
||||||
*/
|
*/
|
||||||
func (obj *Hello1) UnSerialize(header interface{}, data []byte) error {
|
func (obj *Hello1) UnSerialize(header interface{}, data []byte) error {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"gotdx/util"
|
"github.com/bensema/gotdx/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Hello2 struct {
|
type Hello2 struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user