获取并清洗金融和经济数据。
Operation-Pluto的Python项目详细描述
Operation Pluto是 管道设置。它调查金融和经济数据重点市场 是{EM1} $香港EEM>,^ {EM1} $美国EEE>和^ {EM1}$China EEE>。
这个数据管道是用python在Luigi framework中组织的。
可用数据
当前连接的数据源:
<香港>< > >
中国
- 是吗?
主数据
管道组织
- 抓取网站,回填过去的数据,并构建文件目录。 全部按代码执行。
- 数据源中的一个表对应于一个目标文件。
- 管道任务是有状态的尽可能少地覆盖源文件
开始
安装Python3.5并克隆此存储库:
# Clone this repository $ git clone https://github.com/hydra-lab/operation-pluto
安装Python依赖项:
# Installing with Conda may not work $ pip install -r requirements.txt
设置Luigi配置文件:
# Rename luigi.cfg.sample to luigi.cfg $ mv luigi.cfg.sample luigi.cfg如果您位于后面,则在其中配置代理:
[proxies] https = https://username:password@hostname:port/
测试安装应提取新数据并将其解析为 文件夹test/data:
$ python -m luigi --module main RunMock --local-scheduler $ ls test/data
高级作业编排在main.py中完成。例如RunAll() 是初始化整个data目录和触发器的包装类 所有处理任务。在生产中,任务应该在luigi上运行 服务器因为luigi守护进程不会在windows上运行,所以只需运行:
# Run Luigi server on http://localhost:8082 $ luigid # Run task on Luigi server $ python -m luigi --module main RunAll
计划管道定期在任务计划程序或cron中运行。设置 run.sh在Windows上:
# Script on Windows start luigid python -m luigi --module main RunAll cmd "/c taskkill /IM "luigid.exe" /T /F"