Esempio n. 1
0
func (w *Okcoin) analyzePeroidLine(filename string, content string) bool {
	//logger.Infoln(content)
	//logger.Infoln(filename)
	ret, PeroidRecords := parsePeroidArray(content)
	if ret == false {
		logger.Errorln("Okcoin parsePeroidArray failed....")
		return false
	}
	//logger.Traceln(PeroidRecords)
	//return true
	var Time []string
	var Price []float64
	var Volumn []float64
	for _, v := range PeroidRecords {
		const layout = "2006-01-02 15:04:05"
		t := time.Unix(v.Time, 0)
		Time = append(Time, t.Format(layout))
		Price = append(Price, v.Close)
		Volumn = append(Volumn, v.Volumn)
	}

	//logger.Infoln(Time[len(Time)-1], Price[len(Time)-1], Volumn[len(Time)-1])
	w.Time = Time
	w.Price = Price
	w.Volumn = Volumn
	strategyName := Option["strategy"]
	strategy.Perform(strategyName, *w, Time, Price, Volumn)

	return true
}
Esempio n. 2
0
func (w *Huobi) analyzeMinuteLine(filename string, content string) bool {
	//logger.Infoln(content)
	//logger.Debugln(filename)
	MinuteRecords := parseMinuteCSV(filename)
	var Time []string
	var Price []float64
	var Volumn []float64
	for _, v := range MinuteRecords {
		Time = append(Time, v.Time)
		Price = append(Price, v.Price)
		Volumn = append(Volumn, v.Volumn)
	}

	w.Time = Time
	w.Price = Price
	w.Volumn = Volumn

	strategyName := Option["strategy"]
	strategy.Perform(strategyName, *w, Time, Price, Volumn)
	return true
}
Esempio n. 3
0
func (w *Huobi) analyzePeroidLine(filename string, content string) bool {
	//logger.Infoln(content)
	//logger.Infoln(filename)
	PeroidRecords := parsePeroidCSV(filename)

	//	var order []Order
	var Time []string
	var Price []float64
	var Volumn []float64
	for _, v := range PeroidRecords {
		Time = append(Time, v.Date+" "+v.Time)
		Price = append(Price, v.Close)
		Volumn = append(Volumn, v.Volumn)
		//Price = append(Price, (v.Close+v.Open+v.High+v.Low)/4.0)
		//Price = append(Price, v.Low)
	}
	w.Time = Time
	w.Price = Price
	w.Volumn = Volumn
	strategyName := Option["strategy"]
	strategy.Perform(strategyName, *w, Time, Price, Volumn)

	return true
}