Exemple #1
0
// ShowAll is lazy to show all XD.
func ShowAll(stock *twse.Data) {
	fmt.Println(stock.RawData)
	fmt.Println(stock.MA(6))
	fmt.Println(stock.MAV(6))
	fmt.Println(stock.GetPriceList())
	fmt.Println(utils.ThanPastFloat64(stock.GetPriceList(), 3, true))
	fmt.Println(utils.ThanPastFloat64(stock.GetPriceList(), 3, false))
	fmt.Println(stock.GetVolumeList())
	fmt.Println(utils.ThanPastUint64(stock.GetVolumeList(), 3, true))
	fmt.Println(utils.ThanPastUint64(stock.GetVolumeList(), 3, false))
	fmt.Println(stock.GetRangeList())
	fmt.Println(stock.IsRed())
}
func TestGetList(*testing.T) {
	for _, stock := range []*Data{twse, otc} {
		log.Println(stock.URL())
		stock.Get()
		log.Println(stock.RawData)
		stock.MA(6)
		stock.MAV(6)
		stock.GetPriceList()
		utils.ThanPastFloat64(stock.GetPriceList(), 3, true)
		utils.ThanPastFloat64(stock.GetPriceList(), 3, false)
		stock.GetVolumeList()
		utils.ThanPastUint64(stock.GetVolumeList(), 3, true)
		utils.ThanPastUint64(stock.GetVolumeList(), 3, false)
		stock.GetRangeList()
		stock.GetDailyRangeList()
		stock.GetOpenList()
		log.Println(stock.GetHighList())
		log.Println(stock.GetLowList())
		stock.IsRed()
		stock.IsThanYesterday()
	}
}