diff --git a/formula/avedev_test.go b/formula/avedev_test.go index 7d834c4ccccf959062f069c1234377be5fea7e15..d0f7ad0388b7f20b7ffdbee125a6eb57649e9752 100644 --- a/formula/avedev_test.go +++ b/formula/avedev_test.go @@ -2,8 +2,8 @@ package formula import ( "fmt" + "gitee.com/quant1x/data/cache" "gitee.com/quant1x/pandas" - "gitee.com/quant1x/pandas/internal" "testing" ) @@ -12,7 +12,7 @@ func TestAVEDEV(t *testing.T) { Y := pandas.NewSeriesWithoutType("y", y) fmt.Println(AVEDEV(Y, 5)) - df := internal.KLine("sz002528") + df := cache.KLine("sz002528") df.SetNames("data", "open", "close", "high", "low", "volume", "amount", "zf", "zdf", "zde", "hsl") fmt.Println(df) fmt.Println(df.Names()) diff --git a/go.mod b/go.mod index a415c4bd65851e0936e3a1f310f6138713f4cffd..e65f6d0999c6ed08a0d00d7d3da7211d187f90df 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module gitee.com/quant1x/pandas go 1.20 require ( - gitee.com/quant1x/data v0.7.3 + gitee.com/quant1x/data v0.7.5 github.com/chewxy/math32 v1.10.1 github.com/huandu/go-clone v1.4.1 - github.com/mymmsc/gox v1.3.5 + github.com/mymmsc/gox v1.3.6 github.com/olekukonko/tablewriter v0.0.5 github.com/shirou/gopsutil/v3 v3.23.1 github.com/tealeg/xlsx v1.0.5 @@ -18,12 +18,13 @@ require ( ) require ( + gitee.com/quant1x/gotdx v1.1.5 // indirect github.com/frankban/quicktest v1.11.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/google/btree v1.0.0 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/kr/pretty v0.2.1 // indirect - github.com/kr/text v0.1.0 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -31,6 +32,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/rivo/uniseg v0.4.3 // indirect github.com/rogpeppe/fastuuid v1.2.0 // indirect + github.com/rogpeppe/go-internal v1.6.1 // indirect github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect diff --git a/go.sum b/go.sum index 78123f3c1dad9897fb6479a74576ed189295c6e3..7f13ebe9242aeac21d37a6107313019415ebc348 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,10 @@ -gitee.com/quant1x/data v0.7.3 h1:FdsonzbONvgkhPs8+rJkJz2zluhqHxbF8hr9xAvEXP0= -gitee.com/quant1x/data v0.7.3/go.mod h1:YLGV0f90tPx8un8LTa8nCe+auFCq6/W7cYC+eK1U09I= +gitee.com/quant1x/data v0.7.5 h1:2oW+LRleh+WDEBrR4yw0gNgjhEmkMSsuTfT9jh8WnFs= +gitee.com/quant1x/data v0.7.5/go.mod h1:dGm/ivza6ZsbqLijJJ5hvRNj7vP2CafEX12gp9QQzWo= +gitee.com/quant1x/gotdx v1.1.5 h1:XGxTWV+X0lJeZliWLrM/W7nO9E37hCzYOFHGoYo26uY= +gitee.com/quant1x/gotdx v1.1.5/go.mod h1:J1vbp9YtBR1eYAiSFdsgjniPbFW68wcldfj6zyeWwrE= github.com/chewxy/math32 v1.10.1 h1:LFpeY0SLJXeaiej/eIp2L40VYfscTvKh/FSEZ68uMkU= github.com/chewxy/math32 v1.10.1/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -22,11 +25,13 @@ github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0Jr github.com/huandu/go-clone v1.4.1 h1:QQYjiLadyxOvdwgZoH8f1xGkvvf4+Cm8be7fo9W2QQA= github.com/huandu/go-clone v1.4.1/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -34,8 +39,8 @@ github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWV github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mymmsc/gox v1.3.5 h1:ohUs5JVWmmbHlFxHkGjbXOZliR8DEDtc7jyNF3jiu1U= -github.com/mymmsc/gox v1.3.5/go.mod h1:A67NVxiHB3ZBcRfZVjvDfIVTUe5JaUjuy/F70ucUtdk= +github.com/mymmsc/gox v1.3.6 h1:wVOeSr3uy2ENvio01C1yNLRopU/qiGRjEwI3FQRZlDc= +github.com/mymmsc/gox v1.3.6/go.mod h1:A67NVxiHB3ZBcRfZVjvDfIVTUe5JaUjuy/F70ucUtdk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -52,6 +57,8 @@ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa h1:2cO3RojjYl3hVTbEvJVqrMaFmORhL6O06qdW42toftk= github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa/go.mod h1:Yjr3bdWaVWyME1kha7X0jsz3k2DgXNa1Pj3XGyUAbx8= github.com/shirou/gopsutil/v3 v3.23.1 h1:a9KKO+kGLKEvcPIs4W62v0nu3sciVDOOOPUD0Hz7z/4= @@ -98,9 +105,11 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/indicator/brar_test.go b/indicator/brar_test.go index 265bc7653af69fcf3a579260bb980e173638c740..29d2c0624540ca841b71e653b818d3999243f53d 100644 --- a/indicator/brar_test.go +++ b/indicator/brar_test.go @@ -2,12 +2,12 @@ package indicator import ( "fmt" - "gitee.com/quant1x/pandas/internal" + "gitee.com/quant1x/data/cache" "testing" ) func TestBRAR(t *testing.T) { - df := internal.KLine("sz002528") + df := cache.KLine("sz002528") fmt.Println(df) df1 := BRAR(df, 26) fmt.Println(df1) diff --git a/indicator/kdj_test.go b/indicator/kdj_test.go index 3ccaebb1fa5a94cff70c1ecd1cbf9856efc50c1c..0c031641eb20f5017cb9c1482ff09ce351f69d9a 100644 --- a/indicator/kdj_test.go +++ b/indicator/kdj_test.go @@ -2,12 +2,12 @@ package indicator import ( "fmt" - "gitee.com/quant1x/pandas/internal" + "gitee.com/quant1x/data/cache" "testing" ) func TestKDJ(t *testing.T) { - df := internal.KLine("sz002528") + df := cache.KLine("sz002528") fmt.Println(df) df1 := KDJ(df, 9, 3, 3) fmt.Println(df1) diff --git a/indicator/macd_test.go b/indicator/macd_test.go index 1fe3216be4f4bb9f9186a1660703565bb2213de0..a7a8b3760e974164bc7aae858489e82dda0e7e9d 100644 --- a/indicator/macd_test.go +++ b/indicator/macd_test.go @@ -2,12 +2,12 @@ package indicator import ( "fmt" - "gitee.com/quant1x/pandas/internal" + "gitee.com/quant1x/data/cache" "testing" ) func TestMACD(t *testing.T) { - df := internal.KLine("sz002528") + df := cache.KLine("sz002528") fmt.Println(df) df1 := MACD(df, 5, 13, 3) fmt.Println(df1) diff --git a/indicator/rsi_test.go b/indicator/rsi_test.go index 7c2809586a481c70c718dd101dfdab3075a1f934..9673257ef27025035050f212763fb075afa95414 100644 --- a/indicator/rsi_test.go +++ b/indicator/rsi_test.go @@ -2,12 +2,12 @@ package indicator import ( "fmt" - "gitee.com/quant1x/pandas/internal" + "gitee.com/quant1x/data/cache" "testing" ) func TestRSI(t *testing.T) { - df := internal.KLine("sz002528") + df := cache.KLine("sz002528") fmt.Println(df) df1 := RSI(df, 6, 12, 24) fmt.Println(df1) diff --git a/internal/kline.go b/internal/kline.go deleted file mode 100644 index 1c1d0d236d5aa9b106856d89079d8322d56a5a8b..0000000000000000000000000000000000000000 --- a/internal/kline.go +++ /dev/null @@ -1,14 +0,0 @@ -package internal - -import ( - "gitee.com/quant1x/data/cache" - "gitee.com/quant1x/pandas" -) - -// KLine 加载K线 -func KLine(code string) pandas.DataFrame { - filename := cache.GetKLineFilename(code) - df := pandas.ReadCSV(filename) - _ = df.SetNames("date", "open", "high", "low", "close", "volume") - return df -}