Skip to content

Download Latest Stocks #736

Download Latest Stocks

Download Latest Stocks #736

Workflow file for this run

name: Download Latest Stocks
# Controls when the action will run.
on:
schedule:
- cron: "0 0 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
fetch:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Generate NASDAQ Data
- name: get-nasdaq
run: "curl --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0' https://api.nasdaq.com/api/screener/stocks\\?tableonly\\=true\\&limit\\=25\\&offset\\=0\\&exchange\\=nasdaq\\&download\\=true > /tmp/nasdaq.json"
- name: gen-nasdaq-txt
run: "cat /tmp/nasdaq.json | jq '[.data.rows | .[] | .symbol]' | grep -Ei '([A-Za-z]+)' -o > $GITHUB_WORKSPACE/nasdaq_tickers.txt"
# Generate NYSE Data
- name: get-nyse
run: "curl --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0' https://api.nasdaq.com/api/screener/stocks\\?tableonly\\=true\\&limit\\=25\\&offset\\=0\\&exchange\\=nyse\\&download\\=true > /tmp/nyse.json"
- name: gen-nyse-txt
run: "cat /tmp/nyse.json | jq '[.data.rows | .[] | .symbol]' | grep -Ei '([A-Za-z]+)' -o > $GITHUB_WORKSPACE/nyse_tickers.txt"
# Generate AMEX Data
- name: get-amex
run: "curl --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0' https://api.nasdaq.com/api/screener/stocks\\?tableonly\\=true\\&limit\\=25\\&offset\\=0\\&exchange\\=amex\\&download\\=true > /tmp/amex.json"
- name: gen-amex-txt
run: "cat /tmp/amex.json | jq '[.data.rows | .[] | .symbol]' | grep -Ei '([A-Za-z]+)' -o > $GITHUB_WORKSPACE/amex_tickers.txt"
# Concat all Data
- name: make-all-directory
run: mkdir -p $GITHUB_WORKSPACE/all
- name: concat-files
run: cat $GITHUB_WORKSPACE/amex_tickers.txt $GITHUB_WORKSPACE/nyse_tickers.txt $GITHUB_WORKSPACE/nasdaq_tickers.txt > /tmp/all_tickers.txt
- name: head
run: cat /tmp/all_tickers.txt | sort -u | uniq > $GITHUB_WORKSPACE/all_tickers.txt
- name: cleanup
run: rm $GITHUB_WORKSPACE/amex_tickers.txt $GITHUB_WORKSPACE/nyse_tickers.txt $GITHUB_WORKSPACE/nasdaq_tickers.txt
- name: commit-new-files
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "update"
git push