2 Star 4 Fork 10

王布衣/engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sse_index.go 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-10-01 17:49 . 增加第一个策略执行的demo
package shse
import (
"fmt"
"gitee.com/quant1x/gox/http"
"math"
"math/rand"
urlpkg "net/url"
"time"
)
const (
// http://www.sse.com.cn/market/sseindex/indexlist/
urlSSEIndex = "https://query.sse.com.cn/commonSoaQuery.do"
//urlSSEIndex = "http://query.sse.com.cn/commonQuery.do"
)
// IndexList 上海指数列表
func IndexList() {
//isPagination=false&sqlId=DB_SZZSLB_ZSLB&_=1682986576599
now := time.Now()
timestamp := now.UnixMilli()
cbNum := int(math.Floor(rand.Float64() * (100000000 + 1)))
// 37039113
params := urlpkg.Values{
"jsonCallBack": {fmt.Sprintf("jsonpCallback%d", cbNum)},
"isPagination": {"false"},
"sqlId": {"DB_SZZSLB_ZSLB"},
"_": {fmt.Sprintf("%d", timestamp)},
}
header := map[string]any{
"Referer": "http://www.sse.com.cn/",
//"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}",
}
url := urlSSEIndex + "?"
//url += fmt.Sprintf("jsonCallBack=jsonpCallback%d&", cbNum)
//url += "isPagination=false&"
//url += "sqlId=DB_SZZSLB_ZSLB&"
url += params.Encode()
data, tm, err := http.Request(url, "get", header)
fmt.Println(string(data), tm, err)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.8.35

搜索帮助

Cb406eda 1850385 E526c682 1850385