AlphaVantage Action Bot - renders realtime chart of a stock/cryptocurrency inside Readme

manojnaidu619

Manoj Naidu

Posted on September 17, 2020

AlphaVantage Action Bot - renders realtime chart of a stock/cryptocurrency inside Readme

Hello programmers, hope you are all doing fantastic!🥳 .We all know that Readme file is crucial for any repository, it serves as a user manual and helps us in getting started.

This action makes the best use of Readme file to show the trajectory of stock prices in order to gauge your company’s general health.

What I Built?

AlphaVantage Action Bot is a Github action that renders the realtime chart of a stock/cryptocurrency inside the readme file. We will be using the Alpha Vantage Public Stock APIs to build the action bot. You may also check out this finance API guide that surveys some of the popular stock and crypto data APIs in the market.

Submission Category:

Wacky Wildcards

Screenshots

  • BITCOIN open price trajectory

Bitcoin open trajectory

  • close price trajectory of APPLE

Apple close trajectory

  • Market Capital(USD) of BTC

BTC market capital

How to Setup?

This action could be adopted easily into your project in just 3 steps...

Step 1 - Adding script file into your repo.

This step is pretty simple, all you need to do is..

  • Create folder named alphavantage in the root of your repo.
  • Inside alphavantage folder, add a new python script file with name alphavantage-bot.py and paste the complete code below
  • From line 8-50, the variables could be customized to requirements.

So now, your repo will contain a python script file, whose path is YOUR_REPO_NAME/alphavantage/alphavantage-bot.py. It should look like this...

Script Path

Step 2 - Adding AlphaVantage API key to repo secrets.

After filling the basic details, you should get your API key instantly.

Alt Text

  • Now, paste the API key inside your repo secrets with the name ALPHA_VANTAGE_KEY.

Alt Text

Step 3 - Setup Workflow file(Final step, yay!).

Paste the below code inside
REPO_ROOT/.github/workflows/AlphaVantage-Action-Bot.yml


name: AlphaVantage-Action-Bot

on:
  schedule:
    - cron: "*/30 * * * *"  
    # Runs every 30th minute
    # Could be customized to requirement
    # To know more about crontabs refer https://crontab.guru/ 


jobs:
  alphavantage-render-chart:
    runs-on: ubuntu-latest
    steps:
      - name: checkout repo content
        uses: actions/checkout@v2 # checkout the repository content to github runner.
      - name: setup python
        uses: actions/setup-python@v2
        with:
           python-version: 3.8 #install the python needed
      - name: Install dependencies
        run: python -m pip install --upgrade pip matplotlib pandas alpha_vantage
      - name: execute python script 
        run: python ./alphavantage/alphavantage-bot.py
        env:
           ALPHA_VANTAGE_KEY: ${{ secrets.ALPHA_VANTAGE_KEY }}
      - name: Commit and push if changed
        run: |
         git add .
         git diff
         git config --global user.email "alphavantage-action-bot@example.com"
         git config --global user.name "AlphaVantage Action Bot"
         git commit -m "AlphaVantage Action Bot Updated README" -a || echo "No changes to commit"
         git push
Enter fullscreen mode Exit fullscreen mode

Now, your workflow file's path should like something like this...

Wokflow file path

Congrats! You have successfully set up the workflow 😎

Link to Code

GitHub logo manojnaidu619 / AlphaVantage-Action-Bot

A github action to render real-time stocks/cryptocurrency charts inside readme

AlphaVantage-Action-Bot

A github action to render real-time stocks/cryptocurrency charts inside readme

AlphaVantage-Action-Bot-Chart **Realtime Stock/Crytpocurrency Chart📈 Rendered By AlphaVantage-Action-Bot | Last updated the above chart on Oct 07, 2024(00:57:34) **

Hello programmers, hope you are all doing fantastic!🥳 .We all know that Readme file is crucial for any repository, it serves as a user manual and helps us in getting started.

This action makes the best use of readme file to show the trajectory of stock prices in order to gauge your company’s general health.

📌 Click on DEV logo below to view detailed article

Manoj Naidu's DEV Profile

What Is it?

AlphaVantage Action Bot is a Github action that renders the realtime chart of a stock/cryptocurrency inside the readme file. We will be using the Alpha Vantage Public Stock APIs to build the action bot. You may also check out this finance API guide that surveys some of the popular stock and crypto data APIs…

Additional Resources / Info

Special Thanks to the AlphaVantage team for reaching me out on this article✌️

💖 💪 🙅 🚩
manojnaidu619
Manoj Naidu

Posted on September 17, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related