diff --git a/protocol/model_connect_test.go b/protocol/model_connect_test.go index a2fdd67..aaa3072 100644 --- a/protocol/model_connect_test.go +++ b/protocol/model_connect_test.go @@ -10,10 +10,7 @@ import ( 0c02000000011a001a003e05050000000000000002000030303030303101363030303038 */ func TestNewSecurityQuotes(t *testing.T) { - f, err := MStockQuote.Frame(map[Exchange]string{ - ExchangeSH: "000001", - ExchangeSZ: "600008", - }) + f, err := MQuote.Frame("sz000001", "sh600008") if err != nil { t.Error(err) return @@ -48,12 +45,12 @@ func Test_getPrice(t *testing.T) { 0c020000000106000600500400000000 */ func Test_securityList_Frame(t *testing.T) { - f := MStockList.Frame(ExchangeSH, 0) + f := MCode.Frame(ExchangeSH, 0) t.Log(f.Bytes().HEX()) } func Test_stockCount_Frame(t *testing.T) { //预期0c0200000001080008004e04000075c73301 // 0c0000000001070007004e040075c73301 - t.Log(MStockCount.Frame(ExchangeSH).Bytes().HEX()) + t.Log(MCount.Frame(ExchangeSH).Bytes().HEX()) } diff --git a/protocol/model_history_minute_trade_test.go b/protocol/model_history_minute_trade_test.go index d3484c3..f4c1aa3 100644 --- a/protocol/model_history_minute_trade_test.go +++ b/protocol/model_history_minute_trade_test.go @@ -2,14 +2,13 @@ package protocol import ( "testing" - "time" ) func Test_stockHistoryMinuteTrade_Frame(t *testing.T) { // 预期 0c 02000000 00 1200 1200 b50f 84da3401 0000 30303030303100006400 // 0c000000000112001200b50f84da3401000030303030303100006400 - f, err := MStockHistoryMinuteTrade.Frame(StockHistoryMinuteTradeReq{ - Time: time.Date(2024, 10, 28, 0, 0, 0, 0, time.Local), + f, err := MHistoryMinuteTrade.Frame(HistoryMinuteTradeReq{ + Date: "20241028", Exchange: ExchangeSZ, Code: "000001", Start: 0, diff --git a/protocol/model_kline_test.go b/protocol/model_kline_test.go index cc024ca..4f8cfa8 100644 --- a/protocol/model_kline_test.go +++ b/protocol/model_kline_test.go @@ -8,7 +8,7 @@ import ( func Test_stockKline_Frame(t *testing.T) { //预期0c02000000001c001c002d050000303030303031 0900 0100 0000 0a00 00000000000000000000 // 0c00000000011c001c002d050000313030303030 0900 0000 0000 0a00 00000000000000000000 - f, _ := MStockKline.Frame(TypeKlineDay, &StockKlineReq{ + f, _ := MKline.Frame(TypeKlineDay, KlineReq{ Exchange: ExchangeSH, Code: "000001", Start: 0, @@ -24,7 +24,7 @@ func Test_stockKline_Decode(t *testing.T) { t.Error(err) return } - resp, err := MStockKline.Decode(bs, 9) + resp, err := MKline.Decode(bs, 9) if err != nil { t.Error(err) return diff --git a/protocol/model_quote_test.go b/protocol/model_quote_test.go new file mode 100644 index 0000000..ad3a7aa --- /dev/null +++ b/protocol/model_quote_test.go @@ -0,0 +1,15 @@ +package protocol + +import ( + "testing" +) + +func Test_quote_Frame(t *testing.T) { + //0c0000000001130013003e050500000000000000010000303030303031 + f, err := MQuote.Frame("sz000001") + if err != nil { + t.Error(err) + return + } + t.Log(f.Bytes().HEX()) +}