Quotation from Sina source
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package easyquotation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"easyquotation/sina"
|
|
|
|
"easyquotation/stock"
|
|
|
|
"fmt"
|
|
|
|
"github.com/gocolly/colly"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestInit(t *testing.T) {
|
|
|
|
Init()
|
|
|
|
|
|
|
|
c := colly.NewCollector()
|
|
|
|
SinaStock_spider := sina.NewSinaStock(c)
|
|
|
|
SinaStock_spider.Start("")
|
|
|
|
|
|
|
|
tt := time.NewTicker(time.Second * 2)
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case <- tt.C:
|
|
|
|
currentTime := time.Now()
|
|
|
|
timeFormatted := currentTime.Format("2006-01-02 15:04:05")
|
|
|
|
fmt.Println("Current time:", timeFormatted)
|
|
|
|
fmt.Println(stock.G_STOCK_MANAGER.StockList["sz002215"])
|
|
|
|
fmt.Println(stock.G_STOCK_MANAGER.StockList["sh000001"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|