add money flow
This commit is contained in:
@@ -16,6 +16,30 @@ func NewApiClient() {
|
||||
TushareClient = tushare.New(TushareToken)
|
||||
}
|
||||
|
||||
// 获取最近N个交易日,asc=true 顺序:asc=false 倒序
|
||||
func GetTradeDateBy(max int, asc bool) []string {
|
||||
reply, _ := TushareClient.TradeCal(map[string]string{
|
||||
"is_open": "1",
|
||||
"end_date": time.Now().Format("20060102"),
|
||||
}, []string{"exchange", "cal_date"})
|
||||
|
||||
var days []string
|
||||
for i := 0; i < max; i++ {
|
||||
days = append(days, reply.Data.Items[i][1].(string))
|
||||
}
|
||||
|
||||
// 将days的数据倒序
|
||||
if asc {
|
||||
var newDays []string
|
||||
for i := len(days) - 1; i >= 0; i-- {
|
||||
newDays = append(newDays, days[i])
|
||||
}
|
||||
return newDays
|
||||
}
|
||||
|
||||
return days
|
||||
}
|
||||
|
||||
func ReturnLastDay() (string, string) {
|
||||
now := time.Now()
|
||||
end := now.Format("20060102")
|
||||
|
||||
Reference in New Issue
Block a user