investool icon indicating copy to clipboard operation
investool copied to clipboard

支持神奇九转

Open axiaoxin opened this issue 2 years ago • 15 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

axiaoxin avatar Sep 06 '21 15:09 axiaoxin

大佬 东方财富的 api url 是从什么地方获取啊, 有文档/文章链接吗?

mojocn avatar Sep 23 '21 11:09 mojocn

大佬 东方财富的 api url 是从什么地方获取啊, 有文档/文章链接吗?

抓包获取的

axiaoxin avatar Sep 23 '21 11:09 axiaoxin

大佬 东方财富的 api url 是从什么地方获取啊, 有文档/文章链接吗?

抓包获取的

大佬 这个数据是需要自己抓吗? 基金列表打开一片空白……

GGACHA avatar Oct 14 '21 12:10 GGACHA

大佬 东方财富的 api url 是从什么地方获取啊, 有文档/文章链接吗?

抓包获取的

大佬 这个数据是需要自己抓吗? 基金列表打开一片空白……

定时任务工作日18点更新,手动更新可以把 https://github.com/axiaoxin-com/x-stock/blob/main/cron/fund_test.go#L10 这个单元测试打开跑一下就可以了。

或者把配置文件里面的 env改为prod,启动服务时会进行数据同步

axiaoxin avatar Oct 14 '21 12:10 axiaoxin

大佬 东方财富的 api url 是从什么地方获取啊, 有文档/文章链接吗?

抓包获取的

大佬 这个数据是需要自己抓吗? 基金列表打开一片空白……

定时任务工作日18点更新,手动更新可以把 https://github.com/axiaoxin-com/x-stock/blob/main/cron/fund_test.go#L10 这个单元测试打开跑一下就可以了。

或者把配置文件里面的 env改为prod,启动服务时会进行数据同步

> x-stock.exe webserver
 {"level":"INFO","time":"2021-10-14 21:06:35.944761","logger":"logging.ctx_logger","caller":"webserver/webserver.go:InitWithConfigFile:31","msg":"load toml type config file config from ./","pid":13176,"server_ip":"192.168.1.100","trace_id":"logging_c5k2mmp8oau36u349i80"}
 {"level":"DEBUG","time":"2021-10-14 21:06:35.945867","logger":"logging.ctx_logger","caller":"webserver/webserver.go:InitWithConfigFile:69","msg":"Sentry use dns: ","pid":13176,"server_ip":"192.168.1.100","trace_id":"logging_c5k2mmp8oau36u349i8g"}
 {"level":"ERROR","time":"2021-10-14 21:06:35.946441","logger":"logging.ctx_logger","caller":"webserver/webserver.go:InitWithConfigFile:72","msg":"Sentry client create error:no dsn","pid":13176,"server_ip":"192.168.1.100","trace_id":"logging_c5k2mmp8oau36u349i90"}
> panic: The system cannot find the path specified. 

运行以后以后开始报错了……我没有go的运行环境, 直接下的x64 exe, 是必须得去下go吗

GGACHA avatar Oct 14 '21 13:10 GGACHA

不需要,你要把配置文件也下下来 config.toml @GGACHA

axiaoxin avatar Oct 14 '21 13:10 axiaoxin

不需要,你要把配置文件也下下来 config.toml @GGACHA

部署环境标志 该值关联影响其他配置,如数据库, redis 等涉及不同环境的配置 如 配置为 localhost , 使用 goutils 获取 mysql 相关实例时将使用 [mysql.localhost] 的配置 prod手动更新 env = "prod"

不是改这部分吗

GGACHA avatar Oct 14 '21 13:10 GGACHA

第12行的env @GGACHA

axiaoxin avatar Oct 14 '21 13:10 axiaoxin

@GGACHA 你用---config参数指定绝对路径的配置文件试试行不行,我没有在windows上跑过,估计是windows的路径问题

不行…… D:\new\x-stock>x-stock.exe webserver --config D:\new\x-stock\config.toml 以这条命令行为基础,长路径短路径,有无后缀,双正斜杠,正斜杠,反斜杠,--config=,,等等. 全试了一遍。 配置文件是env = "prod" 没改

GGACHA avatar Oct 14 '21 13:10 GGACHA

@GGACHA 你下的不是最新版本吗?或者看看配置文件里面sentry dsn随便填个字符串不要为空

axiaoxin avatar Oct 14 '21 13:10 axiaoxin

>D:\new\x-stock>x-stock.exe -v
>x-stock version 1.2.27
> D:\x-stock_1.2.27_Windows_i386>x-stock.exe webserver --config "D://x-stock_1.2.27_Windows_i386//config.toml"

> {"level":"INFO","time":"2021-10-14 21:53:16.505835","logger":"logging.ctx_logger","caller":"webserver/webserver.go:InitWithConfigFile:31","msg":"load toml type config file config from D://x-stock_1.2.27_Windows_i386//","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jvcg"}
> {"level":"DEBUG","time":"2021-10-14 21:53:16.509810","logger":"logging.ctx_logger","caller":"webserver/webserver.go:InitWithConfigFile:69","msg":"Sentry use dns: 1","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jvd0"}
> {"level":"ERROR","time":"2021-10-14 21:53:16.510804","logger":"logging.ctx_logger","caller":"webserver/webserver.go:InitWithConfigFile:72","msg":"Sentry client create error:[Sentry] DsnParseError: invalid scheme","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jvdg"}
> {"level":"DEBUG","time":"2021-10-14 21:53:16.510804","logger":"logging.ctx_logger","caller":"eastmoney/industry_list.go:QueryIndustryList:39","msg":"EastMoney IndustryList https://datacenter.eastmoney.com/stock/selection/api/data/get/ begin","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jve0","reqData":{"client":"APP","source":"SELECT_SECURITIES","sty":"ALL","type":"RPTA_APP_INDUSTRY"}}
> {"level":"DEBUG","time":"2021-10-14 21:53:16.510804","logger":"logging.ctx_logger","caller":"[email protected]/logger.go:func1:280","msg":"Running AtomicLevel HTTP server on :4870/","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jveg"}
> {"level":"DEBUG","time":"2021-10-14 21:53:16.763363","logger":"logging.ctx_logger","caller":"eastmoney/industry_list.go:QueryIndustryList:48","msg":"EastMoney IndustryList https://datacenter.eastmoney.com/stock/selection/api/data/get/ end","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jvf0","latency(ms)":250}
> {"level":"ERROR","time":"2021-10-14 21:53:16.765290","logger":"logging.ctx_logger","caller":"cmds/webserver_cmd.go:func1:59","msg":"services init error:open ./fund_all_list.json: The system cannot find the file specified.","pid":19880,"server_ip":"192.168.1.100","trace_id":"logging_c5k3cj18oau4ra62jvfg"}
> panic: The system cannot find the path specified.
> goroutine 1 [running]:
> github.com/axiaoxin-com/x-stock/cron.RunCronJobs(0x14368001)
>         /Users/axiaoxin/go/src/github.com/axiaoxin-com/x-stock/cron/cron.go:29 +0x2b9
> github.com/axiaoxin-com/x-stock/cmds.ActionWebserver.func1(0x14280e40, 0x2, 0x2)
>         /Users/axiaoxin/go/src/github.com/axiaoxin-com/x-stock/cmds/webserver_cmd.go:64 +0xe9
> github.com/urfave/cli/v2.(*Command).Run(0x140a8c60, 0x14280b40, 0x0, 0x0)
>         /Users/axiaoxin/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:163 +0x3c4
> github.com/urfave/cli/v2.(*App).RunContext(0x14368000, 0x1e7b89c, 0x140a00b8, 0x1408a100, 0x4, 0x4, 0x0, 0x0)
>         /Users/axiaoxin/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:313 +0x651
> github.com/urfave/cli/v2.(*App).Run(...)
>         /Users/axiaoxin/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:224
> main.main()
>         /Users/axiaoxin/go/src/github.com/axiaoxin-com/x-stock/main.go:76 +0x476

env = "prod" i386 运行后是这样的, 没改的时候这条命令行没问题

@axiaoxin dsn非空也试过了.

---cli的另外一个小问题---

>x-stock.exe -?

>{"level":"FATAL","time":"2021-10-14 22:11:33.980706","logger":"logging.ctx_logger","caller":"x-stock/main.go:main:77","msg":"flag provided but not defined: -?","pid":18260,"server_ip":"192.168.1.100","trace_id":"logging_c5k3l598oau4el1kn4m0"}

-? 也报了个小错误囧

GGACHA avatar Oct 14 '21 13:10 GGACHA

@GGACHA 没有-?这个参数。问题已经修复了。定时任务获取时区导致的,代码已经改成获取失败不panic了,下载v1.2.28应该可以正常用了。

golang获取时区在windows上需要有go环境,如果定时任务执行时间不对的话可以考虑安装下golang环境

axiaoxin avatar Oct 14 '21 14:10 axiaoxin

@axiaoxin 看上去似乎引发了新的报错…好像还是时区的问题

goroutine 1 [running]:
time.Time.In(...)
        /usr/local/Cellar/go/1.16/libexec/src/time/time.go:1099
github.com/go-co-op/gocron.(*trueTime).Now(0x39e25a8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/axiaoxin/go/pkg/mod/github.com/go-co-op/[email protected]/timeHelper.go:16 +0xd9
github.com/go-co-op/gocron.(*Scheduler).now(0x1428d650, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/axiaoxin/go/pkg/mod/github.com/go-co-op/[email protected]/scheduler.go:886 +0x3e
github.com/go-co-op/gocron.(*Scheduler).scheduleNextRun(0x1428d650, 0x140855e0)
        /Users/axiaoxin/go/pkg/mod/github.com/go-co-op/[email protected]/scheduler.go:149 +0x32
github.com/go-co-op/gocron.(*Scheduler).runJobs(0x1428d650, 0x1429ce70, 0x2, 0x2)
        /Users/axiaoxin/go/pkg/mod/github.com/go-co-op/[email protected]/scheduler.go:82 +0x34
github.com/go-co-op/gocron.(*Scheduler).start(0x1428d650)
        /Users/axiaoxin/go/pkg/mod/github.com/go-co-op/[email protected]/scheduler.go:77 +0x5f
github.com/go-co-op/gocron.(*Scheduler).StartAsync(0x1428d650)
        /Users/axiaoxin/go/pkg/mod/github.com/go-co-op/[email protected]/scheduler.go:69 +0x3a
github.com/axiaoxin-com/x-stock/cron.RunCronJobs(0x1410ac01)
        /Users/axiaoxin/go/src/github.com/axiaoxin-com/x-stock/cron/cron.go:39 +0x262
github.com/axiaoxin-com/x-stock/cmds.ActionWebserver.func1(0x1430ac00, 0x2, 0x2)
        /Users/axiaoxin/go/src/github.com/axiaoxin-com/x-stock/cmds/webserver_cmd.go:64 +0xe9
github.com/urfave/cli/v2.(*Command).Run(0x1440a870, 0x1430ab20, 0x0, 0x0)
        /Users/axiaoxin/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:163 +0x3c4
github.com/urfave/cli/v2.(*App).RunContext(0x140ee000, 0x295b8ec, 0x1401e0fc, 0x140040f0, 0x2, 0x2, 0x0, 0x0)
        /Users/axiaoxin/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:313 +0x651
github.com/urfave/cli/v2.(*App).Run(...)
        /Users/axiaoxin/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:224
main.main()
        /Users/axiaoxin/go/src/github.com/axiaoxin-com/x-stock/main.go:76 +0x476

GGACHA avatar Oct 14 '21 16:10 GGACHA

麻烦贴一下完整的报错

axiaoxin avatar Oct 14 '21 16:10 axiaoxin

麻烦贴一下完整的报错

不用了,已经跑起来了

os.Setenv("ZONEINFO", '/home/tz/data.zip')

我根据这行代码上网下了个包然后加载一波环境变量就好了 (:3|∠) image 想问下是不是这些文件齐了 @axiaoxin

我等会开个issue把日志贴那边吧, 然后在那边写一下流程

GGACHA avatar Oct 14 '21 17:10 GGACHA