vincetran96 / Scrape-Finance-Data-v2

A standalone package to scrape financial data from listed Vietnamese companies via Vietstock
MIT License
52 stars 29 forks source link
data docker finance python redis scrape

Scrape Financial Data of Vietnamese Listed Companies - Version 2

A standalone package to scrape financial data from listed Vietnamese companies via Vietstock. If you are looking for raw financial data from listed Vietnamese companies, this may help you.

Table of Contents

Report type code Meaning
CTKH Financial targets/Chỉ Tiêu Kế Hoạch
CDKT Balance sheet/Cân Đối Kế Toán
KQKD Income statement/Kết Quả Kinh Doanh
LC Cash flow statement/Lưu Chuyển (Tiền Tệ)
CSTC Financial ratios/Chỉ STài Chính

Financial report terms and their meanings:

Report term code Meaning
1 Annually
2 Quarterly

Noting the project folder

All core functions are located within the functions_vietstock folder and so are the scraped files; thus, from now on, references to the functions_vietstock folder will be simply put as ./.

Run within Docker Compose (recommended)

Configuration

It should be in this area:

...
functions-vietstock:
    build: .
    container_name: functions-vietstock
    command: wait-for-it -s scraper-redis:6379 -t 600  -- bash
    stdin_open: true
    tty: true
    environment: 
        - REDIS_HOST=scraper-redis
        - REQ_VER_TOKEN_POST=
        - REQ_VER_TOKEN_COOKIE=
        - USER_COOKIE=
...

Build image and start related services

At the project folder, run:

docker-compose build --no-cache && docker-compose up -d

Next, open the scraper container in another terminal:

docker exec -it functions-vietstock ./userinput.sh

From now, you can follow along the userinput script

Note: To stop the scraping, stop the userinput script terminal, then open another terminal and run:

docker exec -it functions-vietstock ./celery_stop.sh

to clean everything related to the scraping process (local scraped files are intact).

Some quesitons require you to answer in a specific syntax, as follows: