From f5bf41bf1da4fad9a41d3d6e877013c59d8b2ab4 Mon Sep 17 00:00:00 2001 From: bense Date: Sat, 16 Sep 2023 15:09:08 +0800 Subject: [PATCH] =?UTF-8?q?security=5Flist=20=E4=BF=AE=E5=A4=8D=20name?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client_test.go | 26 ++++++++++++++++++-------- docs/ip.show | 19 +++++++++++++++++++ go.mod | 4 ++-- proto/get_security_list.go | 2 +- 4 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 docs/ip.show diff --git a/client_test.go b/client_test.go index d7975dd..07ef967 100644 --- a/client_test.go +++ b/client_test.go @@ -22,6 +22,7 @@ func prepare() *Client { } func Test_tdx_Connect(t *testing.T) { + fmt.Println("================ Connect ================") api := NewClient(opt) reply, err := api.Connect() if err != nil { @@ -33,6 +34,7 @@ func Test_tdx_Connect(t *testing.T) { } func Test_tdx_GetSecurityCount(t *testing.T) { + fmt.Println("================ GetSecurityCount ================") api := prepare() reply, err := api.GetSecurityCount(MarketSh) if err != nil { @@ -44,6 +46,7 @@ func Test_tdx_GetSecurityCount(t *testing.T) { } func Test_tdx_GetSecurityQuotes(t *testing.T) { + fmt.Println("================ GetSecurityQuotes ================") api := prepare() reply, err := api.GetSecurityQuotes([]uint8{MarketSh}, []string{"002062"}) if err != nil { @@ -51,7 +54,7 @@ func Test_tdx_GetSecurityQuotes(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -59,13 +62,14 @@ func Test_tdx_GetSecurityQuotes(t *testing.T) { } func Test_tdx_GetSecurityList(t *testing.T) { + fmt.Println("================ GetSecurityList ================") api := prepare() reply, err := api.GetSecurityList(MarketSh, 0) if err != nil { t.Errorf("error:%s", err) } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -73,6 +77,7 @@ func Test_tdx_GetSecurityList(t *testing.T) { } func Test_tdx_GetSecurityBars(t *testing.T) { + fmt.Println("================ GetSecurityBars ================") // GetSecurityBars 与 GetIndexBars 使用同一个接口靠market区分 api := prepare() reply, err := api.GetSecurityBars(proto.KLINE_TYPE_RI_K, 0, "000001", 0, 10) @@ -81,7 +86,7 @@ func Test_tdx_GetSecurityBars(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -89,6 +94,7 @@ func Test_tdx_GetSecurityBars(t *testing.T) { } func Test_tdx_GetIndexBars(t *testing.T) { + fmt.Println("================ GetIndexBars ================") // GetSecurityBars 与 GetIndexBars 使用同一个接口靠market区分 api := prepare() reply, err := api.GetIndexBars(proto.KLINE_TYPE_RI_K, 1, "000001", 0, 10) @@ -97,7 +103,7 @@ func Test_tdx_GetIndexBars(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -105,6 +111,7 @@ func Test_tdx_GetIndexBars(t *testing.T) { } func Test_tdx_GetMinuteTimeData(t *testing.T) { + fmt.Println("================ GetMinuteTimeData ================") api := prepare() reply, err := api.GetMinuteTimeData(0, "159607") if err != nil { @@ -112,7 +119,7 @@ func Test_tdx_GetMinuteTimeData(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -120,6 +127,7 @@ func Test_tdx_GetMinuteTimeData(t *testing.T) { } func Test_tdx_GetHistoryMinuteTimeData(t *testing.T) { + fmt.Println("================ GetHistoryMinuteTimeData ================") api := prepare() //reply, err := api.GetHistoryMinuteTimeData(20220511, 0, "159607") reply, err := api.GetHistoryMinuteTimeData(20220511, 0, "159607") @@ -128,7 +136,7 @@ func Test_tdx_GetHistoryMinuteTimeData(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -136,6 +144,7 @@ func Test_tdx_GetHistoryMinuteTimeData(t *testing.T) { } func Test_tdx_GetTransactionData(t *testing.T) { + fmt.Println("================ GetTransactionData ================") api := prepare() //reply, err := api.GetHistoryMinuteTimeData(20220511, 0, "159607") reply, err := api.GetTransactionData(0, "159607", 0, 10) @@ -144,7 +153,7 @@ func Test_tdx_GetTransactionData(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() @@ -152,6 +161,7 @@ func Test_tdx_GetTransactionData(t *testing.T) { } func Test_tdx_GetHistoryTransactionData(t *testing.T) { + fmt.Println("================ GetHistoryTransactionData ================") api := prepare() //reply, err := api.GetHistoryMinuteTimeData(20220511, 0, "159607") reply, err := api.GetHistoryTransactionData(20220511, 0, "159607", 0, 10) @@ -160,7 +170,7 @@ func Test_tdx_GetHistoryTransactionData(t *testing.T) { } for _, obj := range reply.List { - fmt.Println(obj) + fmt.Printf("%+v \n", obj) } _ = api.Disconnect() diff --git a/docs/ip.show b/docs/ip.show new file mode 100644 index 0000000..cc846f4 --- /dev/null +++ b/docs/ip.show @@ -0,0 +1,19 @@ +˫վ1 120.79.60.82 7709 +˫վ2 8.129.13.54 7709 +˫վ3 120.24.149.49 7709 +˫վ4 47.113.94.204 7709 +˫վ5 8.129.174.169 7709 +˫վ6 47.113.123.248 7709 +Ϻ˫վ1 47.103.48.45 7709 +Ϻ˫վ2 47.100.236.28 7709 +Ϻ˫վ3 101.133.214.242 7709 +Ϻ˫վ4 47.116.21.80 7709 +Ϻ˫վ5 47.116.105.28 7709 +Ϻ˫վ6 47.116.10.29 7709 +˫վ1 39.98.234.173 7709 +˫վ2 39.98.198.249 7709 +˫վ3 39.100.68.59 7709 +ݸվ 113.105.142.162 7721 +˫վ1 106.53.96.220 7709 +˫վ2 106.53.99.72 7709 +˫վ3 106.55.12.89 7709 \ No newline at end of file diff --git a/go.mod b/go.mod index 9629744..82f2bc5 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/bensema/gotdx -go 1.19 +go 1.21.0 -require golang.org/x/text v0.6.0 +require golang.org/x/text v0.13.0 diff --git a/proto/get_security_list.go b/proto/get_security_list.go index 2d97c5f..18b5ce9 100644 --- a/proto/get_security_list.go +++ b/proto/get_security_list.go @@ -88,7 +88,7 @@ func (obj *GetSecurityList) UnSerialize(header interface{}, data []byte) error { binary.Read(bytes.NewBuffer(data[pos:pos+8]), binary.LittleEndian, &name) pos += 8 - ele.Code = util.Utf8ToGbk(name[:]) + ele.Name = util.Utf8ToGbk(name[:]) pos += 4 binary.Read(bytes.NewBuffer(data[pos:pos+1]), binary.LittleEndian, &ele.DecimalPoint)