稳定版本

This commit is contained in:
eson 2022-06-23 22:59:47 +08:00
parent 58c19218bf
commit 04fec33a01
3 changed files with 5 additions and 4 deletions

4
api.go
View File

@ -12,9 +12,9 @@ func GetFromAPI() {
for _, code := range GetStocks() { for _, code := range GetStocks() {
if code.MCAP >= 20000000000 { if code.MCAP >= 200*100000000 {
pcode.StringSet(code.CODE) pcode.StringSet(code.CODE)
start.StringSet("20170101") start.StringSet("20150101")
end.StringSet("20220622") end.StringSet("20220622")
resp, err := tp.Execute() resp, err := tp.Execute()

View File

@ -123,7 +123,7 @@ var err error
func init() { func init() {
log.SetFlags(log.Llongfile | log.LstdFlags) log.SetFlags(log.Llongfile | log.LstdFlags)
client, err = mongo.Connect(context.TODO(), options.Client().ApplyURI("mongodb://root:6601502@localhost:27017")) client, err = mongo.Connect(context.TODO(), options.Client().ApplyURI("mongodb://localhost:27017"))
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -173,7 +173,7 @@ func GetStocks() []*StockBase {
} }
} else { } else {
murl := `curl 'http://quotes.money.163.com/hs/service/diyrank.php?count=5000'` murl := `curl 'http://quotes.money.163.com/hs/service/diyrank.php?page=0&query=STYPE%3AEQA&fields=NO%2CSYMBOL%2CNAME%2CPRICE%2CPERCENT%2CUPDOWN%2CFIVE_MINUTE%2COPEN%2CYESTCLOSE%2CHIGH%2CLOW%2CVOLUME%2CTURNOVER%2CHS%2CLB%2CWB%2CZF%2CPE%2CMCAP%2CTCAP%2CMFSUM%2CMFRATIO.MFRATIO2%2CMFRATIO.MFRATIO10%2CSNAME%2CCODE%2CANNOUNMT%2CUVSNEWS&sort=PERCENT&order=asc&count=6000&type=query'`
tp := gcurl.Parse(murl).Temporary() tp := gcurl.Parse(murl).Temporary()
resp, err := tp.Execute() resp, err := tp.Execute()
if err != nil { if err != nil {
@ -181,6 +181,7 @@ func GetStocks() []*StockBase {
} }
jr := gjson.ParseBytes(resp.Content()) jr := gjson.ParseBytes(resp.Content())
log.Println(len(jr.Get("list").Array()))
for _, s := range jr.Get("list").Array() { for _, s := range jr.Get("list").Array() {
var stockCode StockBase var stockCode StockBase
err = json.Unmarshal([]byte(s.String()), &stockCode) err = json.Unmarshal([]byte(s.String()), &stockCode)

Binary file not shown.