Skip to content

Update Portfolio Data #22304

Update Portfolio Data

Update Portfolio Data #22304

name: Update Portfolio Data
on:
schedule:
# Run every 15 minutes
- cron: '*/15 * * * *'
workflow_dispatch: # Allow manual trigger
jobs:
update-data:
runs-on: ubuntu-latest
permissions:
contents: write # Give the workflow write permissions to the repository
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: true # Ensure credentials are passed to later steps
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run update job
env:
ALPACA_API_KEY: ${{ secrets.ALPACA_API_KEY }}
ALPACA_SECRET_KEY: ${{ secrets.ALPACA_SECRET_KEY }}
ALPACA_PAPER: ${{ secrets.ALPACA_PAPER || 'true' }}
run: |
cd dashboard/update_jobs
python positions_job.py
- name: Commit and push changes
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"
git pull --rebase
git add dashboard/data/snapshots/
git commit -m "Update portfolio data [skip ci]" || echo "No changes to commit"
git push