-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (45 loc) · 2.58 KB
/
fetch-stocks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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