What is API
In this article, I will share the basics of setting up simple API calls from GoogleFinance, IEX and Alpha Vantage.
Credits to fellow bloggers for your tips and tricks – twoinvesting and $$$KPO and CZM$$$.
Another reason will be the GOOGLEFINANCE function that I use. As a tech noob person, I prefer simplicity to writing the codes so that I can spend more time doing analysis (which is what I prefer) instead of figuring out bugs and editing the script. (if you’re into coding and would like to showcase/ share your talent, please beep me and I would be glad to speak with you)
GOOGLEFINANCE API calls
Syntax will be:
GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])where ticker = ticker symbol for the security
[ ] = optional attributes; “price” by default
For full list of attributes available on GOOGLEFINANCE, please refer to link.
Currency exchange rate – GOOGLEFINANCE(“CURRENCY:USDSGD”)
Create an account on IEX website for an API key. Keep this unique key safe as you will be using it in the calls. Documentation can be found here.
1. Register for API Key
2. Create Google Sheets IMPORTJSON Function using Google Script
3. Create API calls from IEX
https://api.iextrading.com/1.0/stock/aapl/price
Register for a free API key on their website and refer to their Documentation for the API functions and parameters.
Steps:
1. Register for API Key
2. Create Google Sheets IMPORTJSON Function (refer to video on steps) using Google Script Editor
3. Create API calls from Alpha Vantage
Syntax will be:
https://www.alphavantage.co/query?function=RSI&symbol=AXP&interval=weekly&time_period=10&series_type=open&apikey=YOUR_API_KEY