May 05, 2017 08:20 PM
Is it possible to enter a stock symbol such as AAPL and get the price update as is offered in other spreadsheet programs?
Thanks
May 07, 2017 06:02 AM
Hi Stan,
You can achieve this using ifttt.com stocks triggers and airtable recording.
Let me know if you would like help in setting this up.
Michael
May 07, 2017 06:33 AM
Hi Michael,
I have read about ifttt but have not tried using it. I searched on google and could not find anything about Airtable using ifttt to retrieve stock prices. If you could offer some hints as to how to do this I would appreciate it.
I would basically like to enter a list of stock symbols and pull their price from Yahoo or Google.
Thanks,
Stan
May 08, 2017 12:17 AM
Ok - I tried to get it to work and it appears not to have that functionality at the moment - I have requested it and if I get a response I will let you know.
May 08, 2017 05:28 AM
OK Michael, thanks for trying,
Stan
Jan 13, 2020 01:45 PM
We made this tool. It allows you to enter a list of stock symbols in Airtable and it will pull their prices. It can be scheduled to run regularly too.
May 18, 2020 06:13 PM
Hi @Moe, it says in your video that this tool makes an API call to Alpha Vantage once per minute, and that Alpha Vantage only allows a maximum of 500 API requests per day on their free plan. This is true, as I saw on their website here. But if your tool is making an API call once per minute, then after approximately 8.3 hours of running this tool in one day, the free 500 API limit for the day will be reached. So it seems like everyone will need to pay for at least the cheapest pricing plan for Alpha Vantage, which is currently $30 per month. Am I understanding this correctly?
May 19, 2020 11:55 AM
The API limit would only be an issue if you have more than 500 stock and you need to update all stock prices every day. So it depends on how many records (stock symbols) you have. Obviously, this tool is not ideal for updating stock prices in real-time throughout the day (Airtable is not the right platform for this anyway).
May 19, 2020 01:00 PM
Thanks. Can we limit this tool to not update every 1 minute, but perhaps once an hour?
May 19, 2020 01:16 PM
We don’t support that feature currently. Maybe in the future.
Sep 30, 2020 10:07 AM
In Airtable’s Example Script Showcase, there is an Airtable script that is created to retrieve stock quotes from financialmodelingprep.com.
The actual script is located here:
Dec 20, 2020 03:00 PM
@ScottWorld I may be missing something but I get the prices listed as “undefined.” (See attached.) Have you or anyone else run into this before?
Dec 20, 2020 03:33 PM
Not sure. I don’t know Javascript. It’s very possible that the script might be broken. Hopefully, one of the JavaScript experts in the forum can help. Maybe try reaching out to Airtable support, too, since it’s one of their scripts. Their email is support@airtable.com.
Dec 20, 2020 04:10 PM
Thanks! I sent a note to the team.
Feb 02, 2021 06:33 PM
I’ve had the same problem.
I tried an alternative script below, but this actually clears the current price field in my base rather than recording the quote value. If I copy the URL into a browser window, it returns the ticker and price.
Any idea how to capture the price returned from API and update the price field in the base? I’m sure its a notation issue as the URL will return the data in a normal browser window…
let tblStocks = base.getTable(“stk_price”);
let fldTblStocks_symbol = tblStocks.getField(“symbol”);
let fldTblStocks_currentValue = tblStocks.getField(“curr_price”);
let result = await tblStocks.selectRecordsAsync();
for (let record of result.records) {
let stkSymbol = record.getCellValue (fldTblStocks_symbol);
let response = await fetch ('https://financialmodelingprep.com/api/v3/stock/real-time-price/${stkSymbol}?apikey=abcMYKEY123');
let data = await response.json();
if (data) {
console.log(stkSymbol);
console.log(data);
await tblStocks.updateRecordAsync(record, {
[fldTblStocks_currentValue.id]: data.price
});
}
}
Feb 16, 2021 01:05 PM
This would be an amazing add-on. Hoping Airtable would want to create something like this.
Jul 18, 2021 06:33 AM
Use the character ` instead of ’ for your fetch statement:
let response = await fetch (`https://financialmodelingprep.com/api/v3/stock/real-time-price/${stkSymbol}?apikey=abcMYKEY123`);
This will allow ${stkSymbol} to be replaced with the actual value.
Jun 05, 2022 07:11 PM
I created a script to add the current price of a given stock symbol to a specific field. The endpoint it hits is free and doesn’t need any configuration so should be straight forward to use but if not just let me know!
let config = input.config({
title: 'Current Stock Price Settings',
description: 'Get the current price of a stock.',
items: [
input.config.table('selectedTable', {
label: 'Table to use',
description: 'Pick any table in this base!',
}),
input.config.field('selectedSymbolField', {
label: 'Field inside the above table where the stock symbol is',
parentTable: 'selectedTable',
}),
input.config.field('selectedPriceField', {
label: 'Field inside the above table where the current price should be shown',
parentTable: 'selectedTable',
}),
]
});
const table = config.selectedTable;
const { records } = await table.selectRecordsAsync({
fields: [config.selectedSymbolField.name]
});
const priceField = config.selectedPriceField.name;
let itemsToUpdate = [];
const badStockSymbols = [];
// Loop through all stock symbols, get the price, and create the update objects
await Promise.all(records.map(async (record, index) => {
// Don't look up empty records
if (!record.name || record.name === `Unnamed record`) {
return;
}
try {
const response = await remoteFetchAsync(`https://query1.finance.yahoo.com/v8/finance/chart/${record.name}`);
const { chart } = await response.json();
if (chart?.error) {
badStockSymbols.push(record.name);
return;
}
itemsToUpdate.push({
id: record.id,
fields: {
[`${priceField}`]: chart?.result[0]?.meta?.regularMarketPrice
}
})
output.clear();
output.markdown(`Fetched ${(((itemsToUpdate.length + badStockSymbols.length) / records.length) * 100).toFixed(2)}% of stock prices.`);
return;
} catch (err) {
console.log(err);
}
}));
// Bulk update fields with the current price
while (itemsToUpdate.length > 0) {
await table.updateRecordsAsync(itemsToUpdate.slice(0, 50));
itemsToUpdate = itemsToUpdate.slice(50);
}
output.markdown(`Added stock prices!`);
output.markdown(`Fields with bad symbols. Count: ${badStockSymbols.length}`);
output.table(badStockSymbols);
Jun 29, 2022 01:01 PM
Thanks Derek! Great to get some practical language/functionality around pulling off this integration.
I’m a noob at developing my own extensions, but can hang a little.
I’d like to modify this so it returns the Stock Symbol only from a company name field. Anyone have insights into pulling that off?
Thank you for taking the time to read!
-Mike
Oct 06, 2022 07:09 PM
Hi Michael! For example, you want it to take a company field that could be google and return GOOGL. Is that correct?