- Collect stocks : add, delete, and check the list.
- Look up the name of a stock by its ID and vice versa.
- Check the current price, daily trading statistics, and the latest ex-dividend information about the collected stocks.
- Support multi-user execution.
- Line Bot Server : LINE Messaging API based on Flask.
- Finite State Machine : based on pytransitions.
- Web API : TWSE Open API and FinMind.
- Database : SQLite with Flask-SQLAlchemy.
- Docker : Simplify the deployment procedure with Docker images and Docker Compose.
- Clone this repository.
$ git clone https://github.com/Jench2103/tw-stock-linebot.git $ cd tw-stock-linebot
- Create your own
config.json
and fill the parameters.$ cd /path/to/tw-stock-linebot $ cp config.example.json config.json
- Execute the server with Docker Compose. The server will be running on port 5000.
$ cd /path/to/tw-stock-linebot $ docker compose up -d
- Stop the server.
$ docker compose down
tw-stock-linebot/
├── config/
│ └── __init__.py
├── config.example.json
├── config.json # copy from `config.example.json`
├── data/ # database and other temp files
├── docs/
├── flask_line/
│ ├── __init__.py
│ └── entrypoint.py
├── fsm/ # the implementation of the Linebot FSM
│ ├── __init__.py
│ ├── linebot_machine.py
│ ├── states.py
│ └── transistions.py
├── models/ # the schema of the database tables
│ ├── __init__.py
│ ├── data_update_history.py
│ ├── stock_info.py
│ ├── user_state.py
│ └── user_stock.py
├── pyproject.toml
├── requirements.txt
├── server.py # the entrypoint of this system
└── stock_api/ # the interfaces for accessing third-party APIs
├── __init__.py
├── fin_mind.py
└── twse.py