gitee.com/quant1x/engine@v1.8.4/factors/dataset_wide_test.go (about) 1 package factors 2 3 import ( 4 "fmt" 5 "gitee.com/quant1x/engine/cache" 6 "gitee.com/quant1x/exchange" 7 "gitee.com/quant1x/gox/api" 8 "gitee.com/quant1x/pandas" 9 "testing" 10 ) 11 12 func TestKLine(t *testing.T) { 13 code := "002882" 14 securityCode := exchange.CorrectSecurityCode(code) 15 var wides []SecurityFeature 16 filename := cache.KLineFilename(securityCode) 17 err := api.CsvToSlices(filename, &wides) 18 if err != nil || len(wides) == 0 { 19 return 20 } 21 wides = wides[len(wides)-1:] 22 df := pandas.LoadStructs(wides) 23 fmt.Println(df) 24 } 25 26 func TestKLineWide(t *testing.T) { 27 code := "002882" 28 code = "600178" 29 securityCode := exchange.CorrectSecurityCode(code) 30 var wides []SecurityFeature 31 filename := cache.WideFilename(securityCode) 32 err := api.CsvToSlices(filename, &wides) 33 if err != nil || len(wides) == 0 { 34 return 35 } 36 //wides = wides[len(wides)-1:] 37 df := pandas.LoadStructs(wides) 38 fmt.Println(df) 39 } 40 41 func TestGetKLineAll(t *testing.T) { 42 code := "600178" 43 securityCode := exchange.CorrectSecurityCode(code) 44 df := GetKLineAll(securityCode) 45 fmt.Println(df) 46 } 47 48 func TestDataSetWide_pullWideByDate(t *testing.T) { 49 code := "sz003007" 50 date := "20240315" 51 securityCode := exchange.CorrectSecurityCode(code) 52 lines := pullWideByDate(securityCode, date) 53 df := pandas.LoadStructs(lines) 54 fmt.Println(df) 55 } 56 57 func TestWideTableValuate(t *testing.T) { 58 code := "002615" 59 code = "sh000002" 60 date := "20240130" 61 lines := CheckoutWideTableByDate(code, date) 62 df := pandas.LoadStructs(lines) 63 fmt.Println(df) 64 }