gitee.com/quant1x/engine@v1.8.4/market/szse/szse_stock.go (about) 1 package szse 2 3 import ( 4 "fmt" 5 "gitee.com/quant1x/engine/utils" 6 "gitee.com/quant1x/gox/http" 7 urlpkg "net/url" 8 ) 9 10 const ( 11 kUrlMarketSzseCodeList = "http://www.szse.cn/api/report/ShowReport/data" 12 ) 13 14 func GetStockList() { 15 timestamp := utils.Timestamp() 16 params := urlpkg.Values{ 17 "SHOWTYPE": {"JSON"}, 18 "CATALOGID": {"1815_stock_snapshot"}, 19 "TABKEY": {"tab1"}, 20 "txtBeginDate": {"2023-06-16"}, 21 "txtEndDate": {"2023-06-16"}, 22 "archiveDate": {"2021-06-01"}, 23 "random": {fmt.Sprintf("0.%d", timestamp)}, 24 "PAGENO": {"2"}, 25 "PAGESIZE": {"100"}, 26 "tab1PAGESIZE": {"100"}, 27 } 28 header := map[string]any{ 29 "Referer": "http://www.szse.cn/market/trend/index.html", 30 //"Cookie": "ba17301551dcbaf9_gdp_user_key=; gdp_user_id=gioenc-1aadbe52,d720,54c2,9271,29b7b6dda362; ba17301551dcbaf9_gdp_session_id_2960a971-ddff-48be-827f-6eb99e891735=true; ba17301551dcbaf9_gdp_session_id_4602911b-d360-4f09-a438-3d40bca228d7=true; ba17301551dcbaf9_gdp_session_id_86910507-dd22-4b31-9749-e3a3b18eae25=true; ba17301551dcbaf9_gdp_session_id_1bb67914-f729-4e41-b75c-d09a6b0d7873=true; JSESSIONID=7052255EE4B2357019E75B7B09D6D571; ba17301551dcbaf9_gdp_session_id=2a1f157c-1605-45e8-a68b-e4196d04b2af; ba17301551dcbaf9_gdp_session_id_2a1f157c-1605-45e8-a68b-e4196d04b2af=true; ba17301551dcbaf9_gdp_sequence_ids={\"globalKey\":42,\"VISIT\":6,\"PAGE\":14,\"VIEW_CHANGE\":2,\"CUSTOM\":3,\"VIEW_CLICK\":21}", 31 } 32 url := kUrlMarketSzseCodeList + "?" + params.Encode() 33 data, _ := http.Get(url, header) 34 fmt.Println(string(data)) 35 //if err != nil { 36 // return nil, err 37 //} 38 ////fmt.Println(string(data), tm, err) 39 ////fmt.Println(string(data)) 40 //var raw rawShangHaiSecurities 41 //err = json.Unmarshal(data, &raw) 42 //if err != nil { 43 // return 44 //} 45 //for _, vs := range raw.List { 46 // arr := []string{} 47 // for _, v := range vs { 48 // arr = append(arr, stat.AnyToString(v)) 49 // } 50 // var info sseSecurityEntity 51 // _ = api.Convert(arr, &info) 52 // list = append(list, info) 53 //} 54 }