Coder Social home page Coder Social logo

easyhistory's Introduction

easyhistory

用于获取维护股票的历史数据

引入

import easyhistory

初始化日线历史数据

easyhistory.init('D', export='csv', path='history')

注1: 下载后的原始数据在 path/day/raw_data 下, 复权后数据在 path/day/data

注2: 下载所有股票的历史数据需要很长时间,推荐直接从百度盘(数据到 20160318 )下载,

更新

easyhistory.update('D', export='csv', path='history')

指标系统

目前还在测试中,指标计算使用了 talibpandas, 可以直接调用 talib 计算一百多种指标,包括 MACD, EMA, MA

使用

his = easyhistory.History(dtype='D', path='行情目录')

# MA 计算, 直接调用的 talib 的对应函数
res = his['000001'].MA(5)


# 返回的是 pandas 的 dataframe 格式

             open   high  close    low     volume      amount  factor     MA5
date                                                                         
2016-03-10  10.24  10.35  10.15  10.13  506112.94  5193459.68  93.659  10.268
2016-03-11  10.10  10.22  10.16  10.04  409716.87  4160186.89  93.659  10.220

注: talib 可用指标以及相关参数 以及 pandas 相关

Q&A

Q:安装 talib 提示找不到 vcvarsall.bat ? A: 去 http://www.lfg.uci.edu/~gohlke/pythonlibs 下载 wheels版本的包使用 pip install xxx.whl 安装

easyhistory's People

Contributors

shidenggui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.