Giter VIP home page Giter VIP logo

stock-prediction's Introduction

stock-prediction

股票预测。

1 数据简介

  1. 非时间序列类型指标

    • 代表股票的一些基本特性。
    • 其中有部分连续指标做过正态化,也包含部分不连续指标(离散或缺失)。
    • flag 一列带买哦股票的分类属性,属于类别指标。
  2. 时间序列类型指标

    • {t0, t1, t2..., t20} 代表股票的某一个属性。
    • 并未全部做过正态化处理。
  3. 股票未来收益

    • 存储在 y.csv

训练数据

  • 2013/02 - 2017/03
├── 20130201 数据选取时间
│   ├── non_ts.csv 非时间序列类型指标
│   ├── ts_1.csv 时间序列类型指标
│   ├── ts_2.csv 时间序列类型指标
│   ├── ts_3.csv 时间序列类型指标
│   ├── ts_4.csv 时间序列类型指标
│   ├── ts_5.csv 时间序列类型指标
│   └── y.csv 股票未来收益
├── 20130204
...

测试数据

  • 2017/04 - 2018/09
├── 20170330 数据选取时间
│   ├── non_ts.csv 非时间序列类型指标
│   ├── ts_1.csv 时间序列类型指标
│   ├── ts_2.csv 时间序列类型指标
│   ├── ts_3.csv 时间序列类型指标
│   ├── ts_4.csv 时间序列类型指标
│   └── ts_5.csv 时间序列类型指标
├── 20170331
...

2 预处理

2.1 去极值

如果数据服从正态分布,在3σ原则下,异常值被定义为与平均值的偏差超过了3倍标准差的值。 这是因为,在正态分布的假设下,具体平均值3倍标准差之外的值出现的概率低于0.003,属于极个别的小概率事件。

使用上述方法去极值前后对比图如下:

3 使用方法

本项目使用的 Python 版本必须大于 3.6.0,环境配置参考这里

git clone https://github.com/Ailln/stock-prediction.git

cd stock-prediction

# 安装依赖
pip install -r requirements.txt

# 自定义你的配置
vi config.yaml

# 每次运行需要手动替换配置中的 $model_name
python -m run.sklearn

4 结果

序号 模型类型 模型名称 标准化 R-Square 标准化 + 中性化 R-Square 标准化 + 去极值 R-Square 标准化 + 中性化 + 去极值 R-Square
1 linear SGDRegressor 0.009278 0.007107 0.010176 0.009471
2 linear HuberRegressor -0.001619 -0.002465 -0.001277 -0.001330
3 linear LinearRegression 0.009210 0.007160 0.010125 0.010128
4 svm LinearSVR -0.014114 -0.009051 -0.001348 -0.110621
5 ensemble BaggingRegressor -0.132400 -0.143860 -0.129165 -0.128520
6 ensemble AdaBoostRegressor -0.794503 -0.530176 -0.775948 -0.805070
7 ensemble ExtraTreesRegressor -0.121669 -0.133189 -0.124746 -0.123891
8 ensemble RandomForestRegressor -0.132016 -0.144166 -0.128739 -0.128699
9 ensemble GradientBoostingRegressor 0.009432 0.00724 0.010659 0.010591

5 其他

Q: 数据在哪里?

A: 好问题!别急,先等等。

stock-prediction's People

Contributors

ailln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

stock-prediction's Issues

new

My name is Luis, I'm a big-data machine-learning developer, I'm a fan of your work, and I usually check your updates.

I was afraid that my savings would be eaten by inflation. I have created a powerful tool that based on past technical patterns (volatility, moving averages, statistics, trends, candlesticks, support and resistance, stock index indicators).
All the ones you know (RSI, MACD, STOCH, Bolinger Bands, SMA, DEMARK, Japanese candlesticks, ichimoku, fibonacci, williansR, balance of power, murrey math, etc) and more than 200 others.

The tool creates prediction models of correct trading points (buy signal and sell signal, every stock is good traded in time and direction).
For this I have used big data tools like pandas python, stock market libraries like: tablib, TAcharts ,pandas_ta... For data collection and calculation.
And powerful machine-learning libraries such as: Sklearn.RandomForest , Sklearn.GradientBoosting, XGBoost, Google TensorFlow and Google TensorFlow LSTM.

With the models trained with the selection of the best technical indicators, the tool is able to predict trading points (where to buy, where to sell) and send real-time alerts to Telegram or Mail. The points are calculated based on the learning of the correct trading points of the last 2 years (including the change to bear market after the rate hike).

I think it could be useful to you, to improve, I would like to share it with you, and if you are interested in improving and collaborating I am also willing, and if not file it in the box.

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.