Skip to content

Day Trading

Day Trading #220

Workflow file for this run

name: Day Trading
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
jobs:
fetch:
name: Update day traing report
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: |
sudo apt install python3-full
python3 -m venv virtual
source virtual/bin/activate
pip3 install pandas twstock lxml bs4 google-api-python-client google-auth-oauthlib
- name: create token file
uses: jsdaniell/create-json@v1.2.3
with:
name: "token.json"
json: ${{ secrets.GOOGLE_API_TOKEN }}
- name: Checkout stock tool
uses: actions/checkout@v4
with:
path: stock
- name: Checkout google API tool
uses: actions/checkout@v4
with:
repository: xanthein/google_api_tool
path: google
- name: Get day trading report
run: |
source virtual/bin/activate
python3 stock/stock/get_report.py trading
- name: Download and update db
run: |
source virtual/bin/activate
python3 google/google_drive.py --file_id ${{ vars.FILE_ID }} --filename daily_report --token token.json download
python3 stock/stock/db.py add --trading-report=$(ls trading_*) daily_report
- name: Update db in google driver
run: |
source virtual/bin/activate
python3 google/google_drive.py --file_id ${{ vars.FILE_ID }} --filename daily_report --token token.json update