A股量化数据工具
Project description
Stockman
友好的A股量化数据包,支持tushare等多数据渠道(其他渠道开发中)收集,自带常用和非常用数据指标(开发中)
一、使用方式
1、生成配置文件清单
import stockman
stock = stockman.Stock()
stock.generate_config()
上述代码将会在项目当前目录生成 sample.yaml 配置文件, 请根据实际情况进行填写
DBCONFIG: # MYSQL数据库配置
host: 127.0.0.1 # MYSQL数据库主机地址
dbname: stock_db # MYSQL数据库名称,需要自己创建该名称数据库
username: root # MYSQL数据库用户名
password: stock_db # MYSQL数据库密码
port: 3306 # MYSQL数据库端口
charset: utf8 # MYSQL数据库默认字符集
prefix: stockman_ # MYSQL数据库表前缀
APIS: # 数据渠道配置
Tushare: # Tushare 数据渠道
Params: # Tushare 数据渠道配置
token: '' # Tushare 数据渠道TOKEN,请于Tushare个人中心获取
Permissions: # Tushare 数据功能权限配置
stock_list: true # 是否使用Tushare渠道进行股票列表数据权限获取
stock_daily: true # 是否使用Tushare渠道进行股票日线数据权限获取
stock_trade_cal: true # 是否使用Tushare渠道进行股票交易日历数据获取
2、自动安装数据表
import stockman
with open("sample.yaml", "r") as f:
res = f.read()
stock = stockman.Stock(res)
stock.install()
上述代码将会根据配置文件 sample.yaml 的数据库部分配置,生成各项数据表
3、初始化数据
import stockman
with open("sample.yaml", "r") as f:
res = f.read()
stock = stockman.Stock(res)
stock.init()
上述代码将会自动依次根据配置文件 sample.yaml 中的数据渠道部分中的权限配置去导入历史数据,目前包含有交易日历、股票列表、历史日K线数据等。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stockman-0.0.1.tar.gz
(11.5 kB
view hashes)
Built Distribution
stockman-0.0.1-py3-none-any.whl
(14.0 kB
view hashes)