Last active
August 24, 2022 08:19
-
-
Save pimpelsang/2d7573424fc3cb97af1a1eb480b1dd38 to your computer and use it in GitHub Desktop.
Funderbeam to google sheets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Load funderbeam instruments latest price info into google sheets | |
| 1. Open google sheets | |
| 2. Open scripts editor from "extensions" menu -> Apps Script | |
| 3. in code editor replace the example function by with the function below | |
| 4. in code editor click save button and close the window | |
| 5. in google sheets write this formula into cell: =FUNDERBEAM("ampler") | |
| after some loading you should see the latest ampler price value. | |
| Where to get the instrument ID? | |
| In funderbeam to it's detail page and you can see ID from the browser URL | |
| Example: Bikeep - Loan notes, page url is https://www.funderbeam.com/market/bikeepl1/trades | |
| And use the ID "bikeepl1" | |
| You can turn on hourly auto refresh from menu File->Settings, | |
| under "Calculation" tab change Recalculation to "On change and every hour" | |
| */ | |
| function FUNDERBEAM(id) { | |
| var url = 'https://www.funderbeam.com/api/market' | |
| var list = JSON.parse(UrlFetchApp.fetch(url).getContentText()) | |
| for(var entry of list) { | |
| if (entry.slug == id) { | |
| return entry.lastTradePrice; | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment