GithubHelp home page GithubHelp logo

tw_stock_predictor's Introduction

tw_stock_predictor

paper

link: https://drive.google.com/file/d/18LaSD_i7G3_wZnDFkqbBoT5IaZPyrHqu/view?usp=sharing

Dataset

auto_update.py

download data from: https://www.twse.com.tw/exchangeReport/MI_5MINS_INDEX
This file is responsible for automatically updating stock datafrom TWSE(Taiwan Stock Exchange).
It utilizes finlab.crawler to fetch data.

flowchart LR
A(TWSE) -->|auto_update.py| B(collect data)
B(collect data) -->|data wrangling| C(save)
Loading

traditional strategy

traditional_strategy.py

calculate the deviation rate between the quarterly moving average and the daily chart.
When the stock price is greater than one standard deviation above the deviation rate, buy it.
When it's lower than one standard deviation below the deviation rate, sell it (buy high, sell low).
At the same time, including the transaction fees of Taiwan Stock Exchange into the cost.

graph LR
A[get moving average] -->|calculate| B(standard deviation)
B --> C{greater or lower?}
C -->|greater| D[Buy]
C -->|lower| E[Sell]
Loading

GradientBoost predictor

GradientBoost.py

This file uses GradientBoostingRegressor to predict stock prices. It first fetches data from finlab.data, performs feature engineering, and then trains the model.

flowchart LR
A(data) -->|GradientBoost.py| B(training complete)
B(training complete) -->|backtest| C(return)
Loading

lgbm_BetterParams.py

use to optimize the parameters compute the best parameters for GradientBoost to fit the data. website: https://medium.com/@pushkarmandot/https-medium-com-pushkarmandot-what-is-lightgbm-how-to-implement-it-how-to-fine-tune-the-parameters-60347819b7fc

RandomForest and traditional strategy predictor

RandomForest.py

This file uses RandomForestRegressor to find the best features that influence stock the most. Then, combine them with tradition strategy. theory: https://link.springer.com/content/pdf/10.1023/A:1010933404324.pdf

flowchart LR
A(data) -->|RandomForest.py| B(training complete)
B(training complete) -->|backtest| C(return)
Loading

Finlab

graph TD
    finlab_backtest["finlab.backtest"] -->|provide| backtest["backtest"]
    finlab_crawler["finlab.crawler"] -->|provide| scraping_stock_data["scraping stock data"]
    finlab_data["finlab.data"] -->|provide| obtain_and_process_data["obtain and process data"]
    finlab_labels["finlab.labels"] -->|provide| generate_stock_labels["generate stock labels"]
    finlab_ml["finlab.ml"] -->|provide| tools_for_machine_learning["tools for machine learning"]
    finlab_utility["finlab.utility"] -->|provide| several_tools["several tools"]
Loading

tw_stock_predictor's People

Contributors

balaboom123 avatar

Stargazers

 avatar  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.